rdflib icon indicating copy to clipboard operation
rdflib copied to clipboard

SPARQLStore won't work with preparedQuery

Open aucampia opened this issue 2 years ago • 1 comments

When using a graph with SPARQLStore, Graph.query will call Store.query:

https://github.com/RDFLib/rdflib/blob/0856ac8842697fb00199d2beb9ae1ee5b9152c68/rdflib/graph.py#L1381-L1391

And this will then proceed to assert that the query is a str:

https://github.com/RDFLib/rdflib/blob/0856ac8842697fb00199d2beb9ae1ee5b9152c68/rdflib/plugins/stores/sparqlstore.py#L183-L192

And even without this assert, things won't work unless it is a str.

This is not an ideal situation, a better situation would be one of:

  1. Either don't support query objects, and only strings
  2. Obtain a string for the query object in SPARQLStore
  3. Have a different methods for working with prepared query

Either way, the interface of Store ideally should have a good match with all the implementations of it that comes with RDFLib.

aucampia avatar Jul 27 '22 23:07 aucampia