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

SPARQLStore query parameter initBindings does not behaves the same way #11

Open
Tpt opened this issue Apr 1, 2022 · 0 comments
Open

Comments

@Tpt
Copy link
Contributor

Tpt commented Apr 1, 2022

[Issue first reported in #8]

RDFLib default SPARQL query processor considers the initBindings parameter of the Store/Graph query method as a set of binds to do at the beginning of the query, inside of the SELECT expression. However Oxigraph (and RDFlib SPARQLStore see RDFLib/rdflib#1772) considers it as a join to be done after the query have been processed using a final VALUES clause when it generates a SPARQL query to send to the remote store.

For example the call

store.query("SELECT ?s WHERE { FILTER(BOUND(?s)) }", initBindings={Variable("s"): URIRef("http://example.com/foo")})

will be evaluated by RDFLib like

SELECT ?s WHERE { VALUES ?s { <http://example.com/foo> } FILTER(BOUND(?s)) }

and by the Oxigraph like:

SELECT ?s WHERE { FILTER(BOUND(?s)) } VALUES ?s { <http://example.com/foo> }

This leads RDFLib store to return one solution with the assignation ?s -> <http://example.com/foo> and Oxigraph to return no solution.

It would be great to harmonize the behavior. However, doing it it cleanly inside of oxrdflib would require to partially parse the query and add a significant overhead in both code and speed. An other option would be to add a similar parameter inside of pyoxigraph but it would allow other pyoxigraph users to use it and I am not a huge fan of helping people using this kind of hacky injection. So, keeping the current behivor that is the same as the SPARQLStore seems to me a sensible way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant