BaseXdb / basex

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

XQuery: Check existence of paths in predicates #2109

Closed ChristianGruen closed 2 years ago

ChristianGruen commented 2 years ago

The following query…

db:open('factbook')/mondial/country/country

…will be rewritten to an empty sequence at compile time, because the country element has no country child elements.

The existence checks should be enhanced to also support steps with predicates…

db:open('factbook')/mondial/country/country[@population]

…and paths within predicates:

db:open('factbook')/mondial/country[country]

The optimizations could serve as preparatory step for #2069.