Hi Michael, Thanks for your replying. So this BaseX does not compatible to XQuery 1.0 by this feature? "(/org)[$start to $end]" query excuted well in marklogic and bdbxml.
And I need a solution to make my existing xquery modules could be exuted in BaseX without modifying the codes. Any suggestion?
Thank you, Edward
Dear Edward,
the correct syntax is: (2 to 100)[position() = 5 to 20]
(sequence)[5] is only a shorthand for (sequence*)[position() eq 5] wher 'eq' compares two _single_ items for equality.
With [positon() = 5 to 20] we perform a general comparison, such that the predicate evaluates to true if comparison of any of the items inside both sequences evaluates to true. Thus position() = (5,6,7,?,20) evaluates to true if position() is between 5 and 20, while position() eq (5 to 20) throws an error, as eq is not allowed to compare single items with sequences.
Hope this helped clear things up a little, s/o please correct me if my explanation was faulty :-)
Thanks Michael Am 05.11.2011 um 03:54 schrieb ???:
Hi, I'm using BaseX first time. and using 7.0.1. about 5000 org.xml was loaded into the db in my test enviroment.
But I got an error msg instead of the result i want when I was excuting an simple xquery '(/org)[1 to 5]' in GUI: Query: (/org)[1 to 5] Error: [FORG0006] (1 to 5) not allowed as condition type.
The xquery '(/org)[position()> 2 and position()< 5]' excuted very well.
Thanks, Edward
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Edward,
I'm surprised to hear that MarkLogic and Berkeley support the discussed syntax, as it's actually not allowed by the official XQuery specification.
Some background details (just in case you are interested): if predicates are atomic numeric values, they are handled as numeric predicates [1]. Otherwise, the "effective boolean value" of the predicate is evaluated, which can only be calculcated for atomic values or node sequences.
[1] http://www.w3.org/TR/xquery/#dt-predicate [2] http://www.w3.org/TR/xquery/#dt-ebv
This is why you have to choose the following verbose syntax here to be fully XQuery 1.0/3.0-compliant:
(/org)[position() = $start to $end]
Feel free to ask for more, Christian
On Sat, Nov 5, 2011 at 3:20 PM, 方立厅 tingup@126.com wrote:
Hi Michael, Thanks for your replying. So this BaseX does not compatible to XQuery 1.0 by this feature? "(/org)[$start to $end]" query excuted well in marklogic and bdbxml.
And I need a solution to make my existing xquery modules could be exuted in BaseX without modifying the codes. Any suggestion?
Thank you, Edward
Dear Edward,
the correct syntax is: (2 to 100)[position() = 5 to 20]
(sequence)[5] is only a shorthand for (sequence*)[position() eq 5] wher 'eq' compares two _single_ items for equality.
With [positon() = 5 to 20] we perform a general comparison, such that the predicate evaluates to true if comparison of any of the items inside both sequences evaluates to true. Thus position() = (5,6,7,?,20) evaluates to true if position() is between 5 and 20, while position() eq (5 to 20) throws an error, as eq is not allowed to compare single items with sequences.
Hope this helped clear things up a little, s/o please correct me if my explanation was faulty :-)
Thanks Michael Am 05.11.2011 um 03:54 schrieb ???:
Hi, I'm using BaseX first time. and using 7.0.1. about 5000 org.xml was loaded into the db in my test enviroment.
But I got an error msg instead of the result i want when I was excuting an simple xquery '(/org)[1 to 5]' in GUI: Query: (/org)[1 to 5] Error: [FORG0006] (1 to 5) not allowed as condition type.
The xquery '(/org)[position()> 2 and position()< 5]' excuted very well.
Thanks, Edward
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Edward,
I guess MarkLogic and bdb might have relaxed the standard a little here, again: (i to j)[x to y] is not part of the stanard. I tried some other available engines (eXist, Zorba & Saxon), they all (correctly) refuse to run your query.
To be portable you have to modify the code, but if we are talking only about positional access this should be pretty straight-forward.
Hope this helps
Michael Am 05.11.2011 um 15:20 schrieb 方立厅:
Hi Michael, Thanks for your replying. So this BaseX does not compatible to XQuery 1.0 by this feature? "(/org)[$start to $end]" query excuted well in marklogic and bdbxml.
And I need a solution to make my existing xquery modules could be exuted in BaseX without modifying the codes. Any suggestion?
Thank you,
basex-talk@mailman.uni-konstanz.de