Skip to content

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

Open
@Tpt

Description

@Tpt

[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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions