Skip to content
New issue

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

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

Already on GitHub? # to your account

Store query and update methods queryGraph parameter does not support ConjunctiveGraph and Dataset #1396

Open
Tpt opened this issue Aug 29, 2021 · 2 comments
Labels
concept: RDF dataset Relates to the RDF datasets concept. core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` id-as-cntxt tracking related issues

Comments

@Tpt
Copy link
Contributor

Tpt commented Aug 29, 2021

The query and update methods of the Store abstract class allows to overide rdflib default SPARQL evaluator.
They both provide a queryGraph parameter to provide the default graph identifier.
However this parameter is not helpful enough to allow a proper implementation of SPARQL evaluation if the Store is used inside of a ConjunctiveGraph (for update) or a Dataset (both query and update).

Problems:

  1. With query and Dataset.
    Dataset(store="MyCustomStore").update("INSERT DATA {}") will call the underlying MyCustomStore with the parameter queryGraph=BNode("abcde") with BNode("abcde") the dataset identifier instead of queryGraph=URI("urn:x-rdflib:default") that identifies the default graph and is used by the basic triple insertion and deletion method. With this parameter the Store query evaluator will query the _:abcde graph even if the triples are by default added in the default graph identified by <urn:x-rdflib:default>.

  2. With update and ConjunctiveGraph.
    ConjunctiveGraph(store="MyCustomStore").update("INSERT DATA {}") will call the underlying MyCustomStore with the parameter queryGraph="__UNION__". With only this information the underlying store does not know what is the identifier of the ConjunctiveDataset default graph in which the triples should be added if the update contains an INSERT or a LOAD action.

  3. With update and Dataset.
    Similarly to the query method the queryGraph parameter is set to the Dataset identifier and not URI("urn:x-rdflib:default") so the update is evaluated against the _:abcde graph even if triples are by default added to the default graph (<urn:x-rdflib:default>) by the add method.

A possible solution might be to:

  1. Set queryGraph to URI("urn:x-rdflib:default") for Dataset query and update.
  2. Add a new parameter updateGraph to the update method. It would keep the same value as queryGraph if the update is called from a Graph or a Dataset and to the ConjunctiveGraph identifier if the update is called from a ConjunctiveGraph.
@Tpt Tpt changed the title Store query and update method queryGraph parameter does not support ConjunctiveGraph and Dataset Store query and update methods queryGraph parameter does not support ConjunctiveGraph and Dataset Aug 29, 2021
@ghost ghost added the id-as-cntxt tracking related issues label Dec 27, 2021
@aucampia aucampia added concept: RDF dataset Relates to the RDF datasets concept. core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` labels May 20, 2023
@namedgraph
Copy link

Any ETA for this?

@aucampia
Copy link
Member

aucampia commented Jun 8, 2023

Nobody is looking at this right now and there are some critical issues in RDFLib that needs addressing that will be looked at before this.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
concept: RDF dataset Relates to the RDF datasets concept. core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` id-as-cntxt tracking related issues
Projects
None yet
Development

No branches or pull requests

3 participants