sorry for the irritating quick reply... for me it also works now. what i did wrong this morning, was to write the query like this: count(pf:collection("wikipedia")/child::*) the result is then "0", which is actually correct, since the name-test on "*" selects only element nodes. -henning Andreas Meinl wrote:
Hi Stefan,
thanks for your quick reply!
Regarding fn:collection I'll just wait for the next release of MonetDB/XQuery. But as pf:collection should be faster, I'm going to favor this approach anyway.
On 17.07.2008, at 12:52, Stefan Manegold wrote:
My second question is that I cannot execute this kind of queries, which runs well in eXist and Sedna:
<average> { fn:round(fn:avg( for $doc in fn:collection("samples") return $doc/example/@sum )) } </average>
For MonetDB/XQuery I have to pull out pf:collection and add a second return statement:
let $col := pf:collection("samples")/child::document-node() return <average> { fn:round(fn:avg( for $doc in $col return $doc/example/@sum )) } </average>
Why can't you use "pf:collection("samples")/child::document-node()" in the for loop? Do you get any error? If so which?
When I use pf:collection in the for loop, I get this output:
xquery><average> { more>fn:round(fn:avg( more>for $doc in pf:collection("samples")/child::document-node() more>return $doc/example/@sum more>)) } </average> more><> MAPI = monetdb@localhost:50000 QUERY = <average> { ERROR = !parse error: syntax error, unexpected /, expecting QName on line 5, column 9 (next token is `/') !parse error: XQuery parsing failed xquery>
The expected result is "<average>12345</average>" like it is in eXist and Sedna.
Can you do anything with it? (Is the mentioned slash the one of the end-tag "</average>"? But even so, this is not column 9... and there is no further slash in this line...)
@Henning: For me pf:collection("samples")/child::document-node() works fine and gives me the same result as pf:collection("samples")// document-node().
Regards,
Andreas Meinl
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users