Update of /cvsroot/monetdb/pathfinder/runtime/xrpc/demo
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9159/demo
Modified Files:
Tag: xrpcdemo
Makefile.ag demo-mod.xq index.html style.css
Log Message:
- minor layout changes
- modified example queries and default values
U Makefile.ag
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/Makefile.ag,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- Makefile.ag 10 Jun 2008 21:27:24 -0000 1.1.2.3
+++ Makefile.ag 11 Jun 2008 23:47:33 -0000 1.1.2.4
@@ -36,7 +36,7 @@
headers_xq = {
HEADERS = xq
DIR = datadir/MonetDB/xrpc/demo
- SOURCES = demo-mod.xq
+ SOURCES = demo-mod.xq demo-xrpcmod.xq
}
headers_img = {
U index.html
Index: index.html
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/index.html,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -d -r1.1.2.9 -r1.1.2.10
--- index.html 11 Jun 2008 19:41:53 -0000 1.1.2.9
+++ index.html 11 Jun 2008 23:47:33 -0000 1.1.2.10
@@ -67,34 +67,83 @@
}
var funcdefs = new Array();
- funcdefs[funcdefs.length]=new funcdef("add", false, new Array("integer",
"integer"), new Array("", ""),
- "declare function f:add($v1 as xs:integer, $v2 as xs:integer) as
xs:integer\n{ $v1 + $v2 };");
- funcdefs[funcdefs.length]=new funcdef("addSeq", false, new Array("integer",
"integer"), new Array("+", "+"),
- "declare function f:addSeq($v1 as xs:integer+, $v2 as xs:integer+) as
xs:integer\n{ for $vi in $v1, $vj in $v2 return $vi + $vj };");
- funcdefs[funcdefs.length]=new funcdef("firstPerson", false, new
Array("string"), new Array(""),
- "declare function f:firstPerson($doc as xs:string) as node()\n{
exactly-one(doc($doc)//person[1]) };");
- funcdefs[funcdefs.length]=new funcdef("firstPerson", false, new
Array("string", "string"), new Array("+", "+"),
- "declare function f:firstPerson($docs as xs:string+, $dsts as
xs:string+) as node()+\n{ for $d at $pos in $dsts\n return execute at {$d}
{f:firstPerson(exactly-one($docs[$pos]))}\n};");
- funcdefs[funcdefs.length]=new funcdef("boughtItems", false, new
Array("string", "string"), new Array("", ""),
- "declare function f:boughtItems($pid as xs:string, $doc as xs:string) as
node()*\n{ doc($doc)//closed_auction[./buyer/@person=$pid] };");
- funcdefs[funcdefs.length]=new funcdef("boughtItemsSeq", false, new
Array("string", "string"), new Array("+", ""),
- "declare function f:boughtItemsSeq($pid as xs:string+, $doc as
xs:string) as node()*\n{ for $p in $pid\n return\n
doc($doc)//closed_auction[./buyer/@person=$p]\n};");
- funcdefs[funcdefs.length]=new funcdef("boughtItemsAllPersons", false, new
Array("string", "string", "string"), new Array("", "", ""),
- "declare function f:boughtItemsAllPersons($docL as xs:string, $docR as
xs:string, $dst as xs:string) as node()*\n{ for $p in $pid\n return\n for
$ca in doc($doc)//closed_auction[./buyer/@person=$p]\n return\nelement
closed_auction {attribute buyer {$ca/buyer/@person}, $ca/price, $ca/date}\n};");
- funcdefs[funcdefs.length]=new funcdef("insertPerson", true, new
Array("node()", "string"), new Array("", ""),
- "declare updating function f:insertPerson($p as node(), $doc as
xs:string)\n{ do insert $p into doc($doc)//persons };");
- funcdefs[funcdefs.length]=new funcdef("deletePerson", true, new
Array("string", "string"), new Array("", ""),
- "declare updating function f:deletePerson($pid as xs:string, $doc as
xs:string)\n{ do delete doc($doc)//person[./@pid=$pid] };");
- funcdefs[funcdefs.length]=new funcdef("custom...", false, new
Array("integer", "integer", "integer", "integer"), new Array("", "", "", ""),
"");
+ funcdefs[funcdefs.length]=new funcdef("getPerson", false,
+ new Array("string", "string"), new Array("", ""),
+ "declare function dfx:getPerson( \n" +
+ " $doc as xs:string, \n" +
+ " $pid as xs:string) as node() \n" +
+ "{ doc($doc)//person[./@id = $pid]; };");
+
+ funcdefs[funcdefs.length]=new funcdef("auctionsAllPerson", false,
+ new Array("string", "string"), new Array("", ""),
+ "declare function dfx:auctionsAllPerson( \n" +
+ " $dst as xs:string, \n" +
+ " $doc as xs:string) as node()* \n" +
+ "{ \n" +
+ " for $pid in doc($doc)//person/@id \n"+
+ " return \n" +
+ " execute at {$dst} {f2:auctionsByPerson($doc, $pid)} \n"+
+ "};");
+
+ funcdefs[funcdefs.length]=new funcdef("nestedRPC", false,
+ new Array("string", "string", "string", "string"),
+ new Array("", "", "", ""),
+ "declare function dfx:nestedRPC( \n" +
+ " $dst1 as xs:string, \n" +
+ " $dst2 as xs:string, \n" +
+ " $dst3 as xs:string, \n" +
+ " $doc as xs:string) as node()* \n" +
+ "{ \n" +
+ " (execute at {$dst1} {dfx:auctionsAllPerson($dst3, $doc)}, \n" +
+ " execute at {$dst2} {dfx:auctionsAllPerson($dst3, $doc)}) \n" +
+ "}; ");
+
+ funcdefs[funcdefs.length]=new funcdef("insertPerson", true,
+ new Array("string", "node()"), new Array("", ""),
+ "declare updating function dfx:insertPerson( \n" +
+ " $doc as xs:string, $p as node())\n" +
+ "{ do insert $p into doc($doc)//persons };");
+
+ funcdefs[funcdefs.length]=new funcdef("insertPersonNested", true,
+ new Array("string", "string", "node()"), new Array("+", "", ""),
+ "declare updating function dfx:insertPersonNested( \n" +
+ " $dsts as xs:string+, \n" +
+ " $doc as xs:string, \n" +
+ " $p as node()) \n" +
+ "{ \n" +
+ " (do insert $p into doc($doc)//persons, \n" +
+ " for $dst in $dsts return \n" +
+ " execute at {$dst} {dfx:insertPerson($doc, $p)}) \n" +
+ "};");
+
+ funcdefs[funcdefs.length]=new funcdef("deletePerson", true,
+ new Array("string", "string"), new Array("", ""),
+ "declare updating function f:deletePerson( \n" +
+ " $pid as xs:string, $doc as xs:string) \n" +
+ "{ do delete doc($doc)//person[./@pid=$pid] };");
+
+ funcdefs[funcdefs.length]=new funcdef("deletePersonNested", true,
+ new Array("string", "string", "string"), new Array("+", "", ""),
+ "declare updating function dfx:deletePersonNested( \n" +
+ " $dsts as xs:string+, \n" +
+ " $doc as xs:string, \n" +
+ " $pid as xs:string) \n" +
+ "{ \n" +
+ " (do delete doc($doc)//person[./@pid=$pid], \n" +
+ " for $dst in $dsts return \n" +
+ " execute at {$dst} {dfx:deletePerson($doc, $pid)}) \n" +
+ "};");
+
+ funcdefs[funcdefs.length]=new funcdef("custom...", false,
+ new Array("integer", "integer", "integer", "integer"),
+ new Array("", "", "", ""), "");
var par_types = new Array("integer", "string", "node()");
var par_types_display = new Array("xs:integer", "xs:string", "node()");
var quant_types = new Array("", "?", "+", "*");
- var example_nodes = new Array("<person id=\"newperson1\">Schaap<\/person>",
- "<person id=\"newperson2\">John Denver</person>",
- "<person id=\"newperson3\">Elvis Presley</person>",
- "<person id=\"newperson4\">Shania Twain</person>");
-
+ var example_nodes = new Array(
+ "<person id=\"new1\"><name>X</name><\/person>");
+
function fillPostUrlBox() {
var obj = document.getElementById("postUrl");
obj.value = "http://" + window.location.hostname + ":" +
window.location.port + "/xrpc";
@@ -102,7 +151,7 @@
function fillLocationBox() {
var obj = document.getElementById("loc");
- obj.value = "http://" + window.location.hostname + ":" +
window.location.port + "/demo/demo-mod.xq";
+ obj.value = "http://" + window.location.hostname + ":" +
window.location.port + "/demo/demo-xrpcmod.xq";
}
function fillMethodBox() {
@@ -140,7 +189,7 @@
var params = "";
var xrpc_call = "";
- if (form.method.selectedIndex == 0) {
+ if (form.method.selectedIndex < 0) {
for (var l = 0; l < form.loop.value; l++) {
params = "";
for (var i = 1; i <= form.arity.value; i++) {
@@ -280,26 +329,41 @@
html += "<\/select>";
html += "<\/td><td> ";
- var default_val = -1;
- if (funcdefs[idx].getArr(i) == "integer") {
- if (funcdefs[idx].getQArr(i) == "")
- default_val = (i + 1);
- else
- default_val = "(" + (i*3+1) + ", " + (i*3+2) +
", " + (i*3+3) + ")";
- }
- if (funcdefs[idx].getArr(i) == "string") {
- if (funcdefs[idx].getQArr(i) == "")
- default_val = "xmark.xml";
- else
- default_val = "(xmark.xml, xmark.xml,
xmark,xml)";
- }
- if (funcdefs[idx].getArr(i) == "node()") {
- if (funcdefs[idx].getQArr(i) == "")
- default_val = default_val = example_nodes[i];
- else
- default_val = "(" + example_nodes[i] + ", " +
example_nodes[i] + ", " + example_nodes[i] + ")";
- }
- html += "<input type=\"text\" name=\"param" + (i+1) + "\"
id=\"param" + (i+1) + "\" value=\"" + default_val + "\" />";
+ var default_val = "";
+ if(val == "getPerson") {
+ default_val = (i==0) ? "xmark1.xml" : "person10";
+ } else if(val == "auctionsAllPerson") {
+ default_val = (i==0) ? "localhost:60001" : "xmark1.xml";
+ } else if (val == "nestedRPC") {
+ if(i == 0)
+ default_val = "localhost:60001";
+ else if(i == 1)
+ default_val = "localhost:70001";
+ else if(i == 2)
+ default_val = "localhost:80001";
+ else
+ default_val = "xmark1.xml";
+ } else if (val == "insertPerson") {
+ default_val = (i==0) ? "xmark1.xml" : '<person
id=\"new1\"><name>Ronald</name></person>';
+ } else if (val == "insertPersonNested") {
+ if(i == 0)
+ default_val = "(localhost:60001, localhost:70001)";
+ else if (i== 1)
+ default_val = "xmark1.xml";
+ else
+ default_val = '<person id=\"new1\"><name>Ronald</name></person>';
+ } else if (val == "deletePerson") {
+ default_val = (i==0) ? "xmark1.xml" : "new1";
+ } else if (val == "deletePersonNested") {
+ if(i == 0)
+ default_val = "(localhost:60001, localhost:70001)";
+ else if (i== 1)
+ default_val = "xmark1.xml";
+ else
+ default_val = "new1";
+ }
+
+ html += "<input type=\"text\" name=\"param" + (i+1) + "\"
id=\"param" + (i+1) + '\" value=\'' + default_val + '\' />';
html += "<\/td><\/tr>";
}
html += "<\/table>";
@@ -463,7 +527,7 @@
</tr>
<tr>
<td><label for="ns">Module namespace</label></td>
- <td><input type="text" name="ns" value="xrpcdemo-functions"
size="40" /></td>
+ <td><input type="text" name="ns" value="demo-functions-xrpc"
size="40" /></td>
</tr>
<tr>
<td><label for="loc">Module location</label></td>
@@ -477,8 +541,7 @@
</td>
</tr>
<tr>
- <td></td>
- <td><textarea cols="40" rows="14" name="def" id="def"
readonly="readonly"></textarea></td>
+ <td colspan="2"><textarea cols="65" rows="20" name="def"
id="def" readonly="readonly"></textarea></td>
</tr>
<tr>
<td><label for="loop">Loop counter</label></td>
U style.css
Index: style.css
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/style.css,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- style.css 7 Jun 2008 22:13:22 -0000 1.1.2.4
+++ style.css 11 Jun 2008 23:47:33 -0000 1.1.2.5
@@ -54,12 +54,12 @@
border-bottom: 4px solid black;
border-right: 4px solid black;
width: 410px;
- height: 312px;
+ height: 326px;
}
#graph {
- width: 400px;
- height: 640px;
+ width: 430px;
+ height: 670px;
margin-right: 5px;
overflow:auto;
padding: 0px;
@@ -99,4 +99,4 @@
.myinput {
margin-bottom: 4px;
-}
\ No newline at end of file
+}
U demo-mod.xq
Index: demo-mod.xq
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/demo/Attic/demo-mod.xq,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- demo-mod.xq 10 Jun 2008 21:22:11 -0000 1.1.2.4
+++ demo-mod.xq 11 Jun 2008 23:47:33 -0000 1.1.2.5
@@ -1,42 +1,14 @@
-module namespace f="xrpcdemo-functions";
-
-declare function f:add($v1 as xs:integer, $v2 as xs:integer) as xs:integer
-{ $v1 + $v2 };
-
-declare function f:addSeq($v1 as xs:integer+, $v2 as xs:integer+) as
xs:integer+
-{ for $vi in $v1, $vj in $v2 return $vi + $vj };
-
-declare function f:firstPerson($doc as xs:string) as node()
-{ exactly-one(doc($doc)//person[1]) };
-
-declare function f:firstPerson($docs as xs:string+, $dsts as xs:string+) as
node()+
-{ for $d at $pos in $dsts
- return execute at {$d} {f:firstPerson(exactly-one($docs[$pos]))}
-};
-
-declare function f:boughtItems($pid as xs:string, $doc as xs:string) as node()*
-{ doc($doc)//closed_auction[./buyer/@person=$pid] };
+module namespace df="demo-functions";
-declare function f:boughtItemsSeq($pid as xs:string+, $doc as xs:string) as
node()*
-{ for $p in $pid
+declare function df:auctionsByPerson(
+ $doc as xs:string,
+ $pid as xs:string) as node()*
+{
+ for $ca in doc($doc)//closed_auction[./buyer/@person=$pid]
return
- for $ca in doc($doc)//closed_auction[./buyer/@person=$p]
- return
- element closed_auction {attribute buyer {$ca/buyer/@person}, $ca/price,
$ca/date}
-
-};
-
-declare function f:boughtItemsAllPersons($docL as xs:string, $docR as
xs:string, $dst as xs:string) as node()*
-{ for $pid in doc($docL)//person/@pid
- return execute at {$dst} {f:boughtItems($pid, $docR)}
+ element closed_auction {
+ attribute buyer {$ca/buyer/@person},
+ $ca/price
+ }
};
-declare function f:getdoc($url as xs:string) as document-node()?
-{ doc($url) };
-
-declare updating function f:insertPerson($p as node(), $doc as xs:string)
-{ do insert $p into doc($doc)//persons };
-
-declare updating function f:deletePerson($pid as xs:string, $doc as xs:string)
-{ do delete doc($doc)//person[./@pid=$pid] };
-
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins