-
Notifications
You must be signed in to change notification settings - Fork 560
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
parseUpdate
refuses valid queries
#1758
Comments
@gromgull @gjhiggins Please give me your expert opinion... |
I have only very limited knowledge of SPARQL but I managed to pull these parser-satisfying usage examples out of the RDFLIb tests in the hope that they'll be useful to you: from rdflib.plugins.sparql.parser import parseQuery
# Adding to the default graph
parseUpdate(
"PREFIX e: <http://example.org/> INSERT DATA {e:a e:b e:c} ")
# Adding to a named graph
parseUpdate(
"INSERT DATA {GRAPH <urn:context1> {<urn:example:tarek> <urn:example:likes> <urn:example:cheese> .}}")
# Deleting from the default graph
parseUpdate(
"DELETE DATA {<urn:example:michel> <urn:example:likes> <urn:example:pizza>}")
# Deleting from a named graph
parseUpdate(
"DELETE DATA {GRAPH <urn:graph> {<urn:john> <urn:likes> <urn:surfing>}}") But you are correct in that it does appear that the usage pattern "WITH <urn:graph> DELETE DATA { <urn:john> <urn:likes> <urn:surfing> }" isn't supported. |
I'll try to debug it when I have time... |
I would like to take up this issue and submit a pr. |
While working on this issue along with @jishnu19048, I found that there is partial support for rdflib/rdflib/plugins/sparql/parser.py Lines 1222 to 1233 in 0be6f60
However, the expression is extended to capture We have come up with an addition to capture this and similar usage patterns and are testing them on different examples before finalizing. |
SPARQLWrapper's way to judge given query's type is to match clauses with regex patterns. So I'm trying to use
from rdflib.plugins.sparql.parser import parseQuery, parseUpdate
for judging.But I found few queries in test_wrapper.py was refused by
parseUpdate
.parseUpdate("WITH <urn:graph> DELETE DATA { <urn:john> <urn:likes> <urn:surfing> }")
pyparsing.exceptions.ParseException: Expected end of text, found 'WITH' (at char 0), (line:1, col:1)
parseUpdate("PREFIX e: <http://example.org/> INSERT {e:a e:b e:c}")
pyparsing.exceptions.ParseException: Expected end of text, found 'INSERT' (at char 32), (line:1, col:33)
I think these queries are valid and some parser syntaxes related to
parseUpdate
are wrong.ref: RDFLib/sparqlwrapper#213
The text was updated successfully, but these errors were encountered: