BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
695 stars 264 forks source link

XQuery: Bug on exist() with non-existing attribute #2212

Closed Twilight-Shuxin closed 1 year ago

Twilight-Shuxin commented 1 year ago

Description of the Problem

Given this XML document:

<K id="1">1</K>

and XPath Query

//*[exists(@n1 >= -1)]

BaseX give result

<K id="1">1</K>

Expected Behavior

Should return empty result set as eXist & Saxon since attribute n1 does not exist in node K.

Steps to Reproduce the Behavior

  1. Create database create database test
  2. Insert XML file into database put test.xml path/to/file
  3. Execute XPath query xquery //*[exists(@n1 >= -1)]

Do you have an idea how to solve the issue?

No response

What is your configuration?

BaseX version: BaseX 10.7 beta latest commit 081fb4d on Windows

ChristianGruen commented 1 year ago

The current behavior is correct; it seems to be wrong in Saxon and eXist:

Feel free to close the issue if you agree.

Twilight-Shuxin commented 1 year ago

Thanks a lot for the explanation! It seems that this is correct while a bit tricky and I will close the issue :)

michaelhkay commented 1 year ago

I tried this under Saxon 12.x and it gives the same (correct) result as BaseX.

martin-honnen commented 1 year ago

@michaelhkay , but 11.5 (tried with both HE 11.5 Java as well as SaxonCS 11.5) doesn't select anything.

michaelhkay commented 1 year ago

@martin-honnen Thanks for the feedback.

Twilight-Shuxin commented 1 year ago

@michaelhkay I initially tested this on Saxon-HE 12.0, which is currently out of date. Today I tried again with the latest Saxon-HE12.2 release and it seems that the problem still exists.

Twilight-Shuxin commented 1 year ago

I used the Saxon-HE 12.2 jar files in SaxonHE12-2J.zip as external libraries and ran from java on Windows.

michaelhkay commented 1 year ago

Thanks. I feel we're trespassing on this space to be discussing this here: could we please continue the conversation at https://saxonica.plan.io/issues/6051 - thank you.

Twilight-Shuxin commented 1 year ago

@michaelhkay Sure, thanks!