Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken XPath queries #65

Closed
bbonf opened this issue Feb 8, 2023 · 3 comments · Fixed by #91
Closed

Broken XPath queries #65

bbonf opened this issue Feb 8, 2023 · 3 comments · Fixed by #91
Labels
bug Something isn't working

Comments

@bbonf
Copy link

bbonf commented Feb 8, 2023

We've received two queries from Aleksei that don't work at all (but they do work with Gretel4):

//node[@cat="inf" and not(@rel="vc" and ../node[@pt="ww" and @rel="hd"]/@lemma="zullen") and not(@rel="cnj" and ../node[node[@rel="vc"]] and ../../node[@pt="ww" and @rel="hd"]/@lemma="zullen") and ((@rel="cnj" and ../../node[@pt="ww" and @rel="hd"] and not(../../@cat="smain" or ../../@cat="sv1")) or (../node[@pt="ww" and @rel="hd"] and not(../@cat="smain" or ../@cat="sv1"))) and node[@rel="svp" and @pt="vz"] and node[@rel="hd" and @pt="ww" and number(@begin) > ../node[@rel="svp" and @pt="vz"]/number(@end) and not(@begin = ancestor::node/node[@lemma="te"]/@end)] and node[@rel="hd" and @pt="ww"]]

//node[not(@cat="smain" or @cat="sv1") and not(@cat="inf" and @rel="vc" and ../node[@pt="ww" and @rel="hd"]/@lemma="zullen") and not(@cat="inf" and @rel="cnj" and ../node[node[@rel="vc"]] and ../../node[@pt="ww" and @rel="hd"]/@lemma="zullen") and not(@cat="ppart" and @rel="vc") and not(@cat="ppart" and @rel="cnj" and ../node[node[@rel="vc"]]) and node[@rel="hd" and @pt="ww"] and node[@cat="pp" and number(@begin) < ../node[@pt="ww" and @rel="hd"]/number(@begin) and node[@rel="hd"]] and not(node[@cat="pp" and number(@end) > ../node[@pt="ww" and @rel="hd"]/number(@end)])]

@bbonf bbonf added the bug Something isn't working label Feb 8, 2023
@bbonf
Copy link
Author

bbonf commented Feb 8, 2023

This is failing because lxml doesn't like these XPath expressions, see https://github.com/UUDigitalHumanitieslab/gretel-django/blob/develop/backend/search/basex_search.py#L19

@bbonf
Copy link
Author

bbonf commented Mar 15, 2023

A possible workaround is to let "advanced users" skip the validation step

@bbonf
Copy link
Author

bbonf commented Aug 25, 2023

Consider https://github.com/ekaats/xpyth_parser for validation

@bbonf bbonf linked a pull request Aug 30, 2023 that will close this issue
@bbonf bbonf closed this as completed in #91 Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant