Simple Xquery '(/org)[1 to 5]' was failed in GUI
Saturday, 5 November 2011 · 2 messages
方
方立厅5 Nov 2011 03:54 #
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
MS
Michael Seiferle5 Nov 2011 11:59 #
Dear Edward,
the correct syntax is:
Quoted text · 方立厅 · 1 line
> (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
Quoted text · 方立厅 · 18 lines
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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery