Stefan, your rewrite may return different results (at least without schema knowledge). If you have E1/E2[P] the predicate P is evaluated on E2 only. Your rewrite changes the binding to E1/E2 and is thus equivalent to (E1/E2)[P]. The correct rewrite thus would be doc("items.xml")/items/item_tuple[itemno=1002] -> doc(\"items.xml\")/items/(for $i in item_tuple where $i/itemno=1002 return $i) which would result in the same translation as without the for loop. On 10/30/2006 10:09 PM, Stefan Manegold wrote with possible deletions:
Update of /cvsroot/monetdb/pathfinder/tests/W3C_use_cases/XQUF/R/Tests In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14959/XQUF/R/Tests
Modified Files: Q7x.milS Q7x.stable.out Log Message:
with a path expression E and a predicate P, Pathfinder's derives the type of E[P] as "node", while this could be "element" as required by some functions; replacing E[P] by for $i in E where P return $i yields an "element".
Added althernative versions for all tests where E[P] triggers a type error but for $i in E where P return $i works fine.
Index: Q7x.stable.out =================================================================== RCS file: /cvsroot/monetdb/pathfinder/tests/W3C_use_cases/XQUF/R/Tests/Q7x.stable.out,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Q7x.stable.out 30 Oct 2006 20:54:19 -0000 1.2 +++ Q7x.stable.out 30 Oct 2006 21:09:18 -0000 1.3 @@ -15,7 +15,7 @@ xquery("xml"," do insert <comment>This is a bargain !</comment> -as last into exactly-one(doc(\"items.xml\")/items/item_tuple[itemno=1002]) +as last into exactly-one(for $i in doc(\"items.xml\")/items/item_tuple where $i/itemno=1002 return $i) ").printf();
xquery("xml","doc(\"items.xml\")").printf();
Index: Q7x.milS =================================================================== RCS file: /cvsroot/monetdb/pathfinder/tests/W3C_use_cases/XQUF/R/Tests/Q7x.milS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Q7x.milS 30 Oct 2006 20:54:19 -0000 1.2 +++ Q7x.milS 30 Oct 2006 21:09:17 -0000 1.3 @@ -4,7 +4,7 @@ xquery("xml"," do insert <comment>This is a bargain !</comment> -as last into exactly-one(doc(\"items.xml\")/items/item_tuple[itemno=1002]) +as last into exactly-one(for $i in doc(\"items.xml\")/items/item_tuple where $i/itemno=1002 return $i) ").printf();
xquery("xml","doc(\"items.xml\")").printf();
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- Jan Rittinger Database Systems Technische Universität München (Germany) http://www-db.in.tum.de/~rittinge/