forked from yql/yql-tables
/
ygroups.HGSP.xml
118 lines (112 loc) · 3.07 KB
/
ygroups.HGSP.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" securityLevel="any">
<meta>
<author>HOUYHNHNM</author>
<description>Acquires the public groups from Yahoo Group search on a given page and type</description>
<documentationURL>http://pulse.yahoo.com/_VASY5CLHMAYFUT265F7HSL3YHE/blog/articles/264307?listPage=index</documentationURL>
<sampleQuery>select * from {table} where query="yahoo"</sampleQuery>
<sampleQuery>select * from {table} where query="yahoo" AND page="1"</sampleQuery>
<sampleQuery>select * from {table} where query="yahoo" AND type="r"</sampleQuery>
<sampleQuery>select * from {table} where query="yahoo" AND type="m" AND page="1"</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<inputs>
<key id='query' type='xs:string' paramType='variable' required="true" />
<key id='type' type='xs:string' paramType='variable' required="false" />
<key id='page' type='xs:string' paramType='variable' required="false" />
</inputs>
<execute>
<![CDATA[
var pagevar=0;
if(page)
{
pagevar=parseInt(page);
if(pagevar>0)
{
//do nothing and jump out
}
else
{
pagevar=1;
}
}
else
{
pagevar=1;
}
var typevar="";
if(type)
{
if(type.match("r")!=null)
{
typevar=type;
}
else
{
if(type.match("o")!=null)
{
typevar=type;
}
else
{
if(type.match("n")!=null)
{
typevar=type;
}
else
{
if(type.match("m")!=null)
{
typevar=type;
}
else
{
typevar="r";
}
}
}
}
}
else
{
typevar="r";
}
var yqlstring1="USE \"http://houyhnhnmui.wikispaces.com/file/view/HGS.xml\" AS mytable; select * from mytable where query=\"";
var yqlstring2="\" AND type=\"";
var yqlstring3="\" AND page=\"";
var yqlstring4="\"";
var yqlquery=y.query(yqlstring1+query+yqlstring2+typevar+yqlstring3+String(pagevar)+yqlstring4);
var yqlresults=yqlquery.results;
var yqlcounter=parseInt(yqlresults.root.node.length());
var index=0;
var counter=0;
var checker="";
var xmlret=new XML();
xmlret=<root></root>;
while(index<yqlcounter)
{
checker=yqlresults.root.node[index].archive.text();
if(checker.match("Public")!=null)
{
xmlret.root+=<node>
<anchor>{yqlresults.root.node[index].anchor.text()}</anchor>
<name>{yqlresults.root.node[index].name.text()}</name>
<description>{yqlresults.root.node[index].description.text()}</description>
<members>{yqlresults.root.node[index].members.text()}</members>
<latest>{yqlresults.root.node[index].latest.text()}</latest>
<creation>{yqlresults.root.node[index].creation.text()}</creation>
<archive>{yqlresults.root.node[index].archive.text()}</archive>
<moderated>{yqlresults.root.node[index].moderated.text()}</moderated>
</node>
counter=counter+1;
}
index=index+1;
}
xmlret.root+=<count>{counter}</count>;
response.object=xmlret;
]]>
</execute>
</select>
</bindings>
</table>