-
Notifications
You must be signed in to change notification settings - Fork 560
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
fix: queryGraph
selection for query
and update
#2546
fix: queryGraph
selection for query
and update
#2546
Conversation
`Store.query` and `Store.update` have a parameter `queryGraph`, which presumably specifies the initial [active graph](https://www.w3.org/TR/sparql11-query/#sparqlDataset). When SPARQL is evaluated against a `Dataset`, the initial active graph should be the default graph [[ref](https://www.w3.org/TR/sparql11-query/#sparqlAlgebraEval)], however, when calling `rdflib.graph.Graph.query` or `rdflib.graph.Graph.update`, they were passing `rdflib.graph.Dataset.identifier` as the value of `queryGraph` to `Store.query` and `Store.update`. The passed value would not have been the identifier of the default graph of the Dataset, and would instead have been an identifier that has really no meaning whatsoever (see <RDFLib#2537>). This change fixes the selection of the initial active graph by passing `ConjunctiveGraph.default_context.identifier` if the `Graph.query` or `Graph.update` method is called on a `ConjunctiveGraph` and `ConjunctiveGraph.default_union` is `False`. Related issues: - Fixes <RDFLib#2538>.
92b4181
to
9b9686e
Compare
After this oxigraph/oxrdflib#28 should hopefully not be a thing. |
The other option is to make |
Maybe starting with this PR is best, we can change to having |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! It fixes oxrdflib
Thank you for having a look |
Summary of changes
Store.query
andStore.update
have a parameterqueryGraph
, whichpresumably specifies the initial active
graph.
When SPARQL is evaluated against a
Dataset
, the initial active graphshould be the default graph
[ref],
however, when calling
rdflib.graph.Graph.query
orrdflib.graph.Graph.update
, they were passingrdflib.graph.Dataset.identifier
as the value ofqueryGraph
toStore.query
andStore.update
. The passed value would not have beenthe identifier of the default graph of the Dataset, and would instead
have been an identifier that has really no meaning whatsoever (see
#2537).
This change fixes the selection of the initial active graph by passing
ConjunctiveGraph.default_context.identifier
if theGraph.query
orGraph.update
method is called on aConjunctiveGraph
andConjunctiveGraph.default_union
isFalse
.Related issues:
Graph.{query,update}
should use the default graph as the value for thequeryGraph
when callingStore.{query,update}
#2538.Checklist
the same change.
so maintainers can fix minor issues and keep your PR up to date.