Clarifying the ConjunctiveGraph deprecation: recommend Dataset(default_union=True)? #3334
scott-huberty
started this conversation in
Development
Replies: 1 comment
-
|
That sounds sensible - and the RDFLib docs could certainly benefit from more improvements. Would you be open to contributing this suggestion as a PR? I'd also be very interested to hear your perspective on changing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a small suggestion regarding the deprecation of ConjunctiveGraph in rdflib 7.x and how users are expected to migrate their code.
EDIT: This is related to the discussion happening over at #2591
Minimally Working Example
Say I have some pre-existing script that used
ConjunctiveGraph:This makes sense: the triple was in a named graph, but ConjunctiveGraph exposes the union of all graphs, so serializing to Turtle produces a non-empty triple-only view.
Migration per the deprecation message
DeprecationWarning: ConjunctiveGraph is deprecated, use Dataset insteadIf I follow that guidance literally:
'\n'The default graph is now empty. I guess this also makes sense, as Turtle is a triple-only format, so serializing this Dataset’s default graph (which is empty) produces no triples.
But it is not equivalent to the behavior of
ConjunctiveGraph, which returned the union.Suggestion
Since
ConjunctiveGraphwas historically used specifically as a union-of-all-named-graphs view, andDataset(default_union=True)is the only construct that preserves those semantics, should the deprecation message explicitly recommendDataset(default_union=True)instead of the bareDataset()?I think you hint at exactly this in your source code:
rdflib/rdflib/plugins/parsers/hext.py
Lines 109 to 110 in 72a98ed
As an aside, there's no API docstring for the
default_unionparameter ofDataset, which made it harder to discover and reason about.Beta Was this translation helpful? Give feedback.
All reactions