-
Notifications
You must be signed in to change notification settings - Fork 546
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
Using the result of a SPARQL query with EXISTS and AS raises an exception #1472
Comments
Technically it's “unhandled” (as indicated by the output) rather than a bug per se but the difference is moot. FWIW, the RDFLib SPARQL test suite shows a basic use of EXISTS in the context of a FILTER (as opposed to a BIND): |
@gjhiggins,
|
I didn't mean to imply that you were wrong and I'm sorry if I gave that impression. The TL;DR on this is basically “Thanks for drawing our attention to this, it will get added to the maintenance TODO list but I couldn't even venture a guess as to when it might get fixed, hope you can find a workaround in the interim.” Thanks for posting the spec, that's useful. |
@gjhiggins, thank you. |
Trying to work around the bug, I have found another manifestation thereof. import rdflib
QUERY = """
SELECT (
EXISTS {
<http://example.com/a>
<http://example.com/b>
<http://example.com/c>
}
AS ?exists
)
{}
"""
graph = rdflib.Graph()
result = graph.query(QUERY)
for row in result:
print(row) ought to print (rdflib.term.Literal('false', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#boolean')),) Instead the following exception is raised.
|
Thanks for helping to clarify the scope of the issue. The Exception makes sense given that RDFLib only recognises EXISTS in a FILTER context. |
@gjhiggins Hi. I encountered the same problem in my work. I want to ask, maybe could you recommend some temporary workaround. Also, could you share if you have some progress on that? |
I'm also running into this issue. Hoping there will be a fix in the somewhat near future. |
This patch fixes an issue with `BIND( EXISTS ... )` in SPARQL, for example: ```sparql SELECT * WHERE { BIND( EXISTS { <http://example.com/a> <http://example.com/b> <http://example.com/c> } AS ?bound ) } ``` The graph pattern of `EXISTS` needs to be translated for it to operate correctly during evaluation, but this was not happening. This patch corrects that so that the graph pattern is translated as part of translating `BIND`. This patch also adds a bunch of tests for EXISTS to ensure there is no regression and that various EXISTS cases function correctly. Fixes RDFLib#1472
This patch fixes an issue with `BIND( EXISTS ... )` in SPARQL, for example: ```sparql SELECT * WHERE { BIND( EXISTS { <http://example.com/a> <http://example.com/b> <http://example.com/c> } AS ?bound ) } ``` The graph pattern of `EXISTS` needs to be translated for it to operate correctly during evaluation, but this was not happening. This patch corrects that so that the graph pattern is translated as part of translating `BIND`. This patch also adds a bunch of tests for EXISTS to ensure there is no regression and that various EXISTS cases function correctly. Fixes RDFLib#1472
@mgberg @JDawson-Camlin @amediantsev PR to fix this is here: #1794 - please review if you feel comfortable doing so. |
This patch fixes an issue with `BIND( EXISTS ... )` in SPARQL, for example: ```sparql SELECT * WHERE { BIND( EXISTS { <http://example.com/a> <http://example.com/b> <http://example.com/c> } AS ?bound ) } ``` The graph pattern of `EXISTS` needs to be translated for it to operate correctly during evaluation, but this was not happening. This patch corrects that so that the graph pattern is translated as part of translating `BIND`. This patch also adds a bunch of tests for EXISTS to ensure there is no regression and that various EXISTS cases function correctly. Fixes RDFLib#1472
This patch fixes an issue with `BIND( EXISTS ... )` in SPARQL, for example: ```sparql SELECT * WHERE { BIND( EXISTS { <http://example.com/a> <http://example.com/b> <http://example.com/c> } AS ?bound ) } ``` The graph pattern of `EXISTS` needs to be translated for it to operate correctly during evaluation, but this was not happening. This patch corrects that so that the graph pattern is translated as part of translating `BIND`. This patch also adds a bunch of tests for EXISTS to ensure there is no regression and that various EXISTS cases function correctly. Fixes RDFLib#1472
@aucampia, the PR fixes the first manifestation of the bug, but not the second.
This issue ought to be reopened. |
ought to print
This result would agree with that of SPARQL playground. Instead, the following exception is raised.
I observed this bug under the following conditions.
The text was updated successfully, but these errors were encountered: