Hello Antoine,
this appears to be a bug in most recent BaseX version. The optimizer seems to think the where clause is equivilant to the position predicate and it is rewritten to
for $d_0 in document-node()()/descendant::fund/properties/domain[position() = 1] return data($d_0/@reference)
i.e. without a where clause but with the position() predicate. Also, if you return something like "return data($d/@reference) || $i" it works as expected.
Hence, I created a new issue for this at https://github.com/BaseXdb/basex/issues/1189.
Thanks for reporting this. Please be aware that our main developer Christian is currently on vacation (until next week), so it will take slightly longer to get this fixed (as I know Christian usually this would be fixed by the end of the day). I hope this doesn't influence your decision making process in your evaluation.
Cheers Dirk
On 09/09/2015 11:22 AM, Antoine WOLF wrote:
*Hi,* ** *We are in the process of evaluating BaseX and recently upgraded from version 7.9 to 8.2.3
We have a DB “TESTDB” with 50 xml files, named Fund1.xml, Fund2.xml, Fund3.xml,…. each having the same structure:
Fund1.xml
< fund> …
<properties> … <domain reference=”fund1”> … </domain> … </properties> … </fund>
Fund2.xml
< fund> …
<properties> … <domain reference=”fund2”> … </domain> … </properties> … </fund>
…. ….
The following query does not behave the same on both versions :
For $d at $i in db:open(“TESTDB”)/fund/properties/domain where $i < 2 return data($d/@reference)
Result in 7.9
“Fund1”
Result in 8.2.3
“Fund1 Fund2 Fund3 Fund4 …”
Is this a bug or is there something wrong with the query ?
Best Regards,
Antoine Wolf*