That was fast. Thanks for the fix!
Regards, Amanda
-----Original Message----- From: Christian Grün [mailto:christian.gruen@gmail.com] Sent: Friday, September 18, 2015 4:46 AM To: Amanda Galtman Amanda.Galtman@mathworks.com Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Different result in BaseX 8.1 vs. 8.2.3 for path starting with slash
Hi Amanda,
Thanks for the elaborate report. I can confirm it is/was a bug (which got introduced by some path caching optimizations), and it is fixed in the latest snapshot [1].
Best, Christian
[1] http://files.basex.org/releases/latest/
On Thu, Sep 17, 2015 at 8:33 PM, Amanda Galtman Amanda.Galtman@mathworks.com wrote:
Hi,
While debugging a query, I noticed a difference in behavior between BaseX 8.1 and BaseX 8.2.3. I boiled it down to this short example, which I hope is understandable even if you don’t have my database at hand.
for $node in collection("DocLibrary")//chapter return $node/ends-with(/book/title,'Examples')
In version 8.2.3, all the results are false, which is unexpected. In version 8.1, I get a mix of true and false values, which is what I expect based on the documents in the database.
The XQuery 3.0 and 3.1 specs say the following in the “Path Expressions” section:
A "/" at the beginning of a path expression is an abbreviation for the initial step (fn:root(self::node()) treat as document-node())/ (however, if the "/" is the entire path expression, the trailing "/" is omitted from the expansion.) The effect of this initial step is to begin the path at the root node of the tree that contains the context node.
If I make the substitution mentioned in the spec,
for $node in collection("DocLibrary")//chapter return $node/ends-with((fn:root(self::node()) treat as
document-node())/book/title,'Examples')
then I get expected results in both BaseX 8.1 and BaseX 8.2.3. Do my unexpected results with 8.2.3 arise from a bug?
Perhaps the syntax is not that intuitive in either case (my real query is generated rather than coded by hand, so normally no human needs to look at it), but I still wanted to pose this question in case there is a bug.
Thanks, Amanda