Skip to content
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

Default serialization format for conjunctive graph is turtle, but turtle cannot handle quads (AFAIK) #1674

Open
aucampia opened this issue Jan 16, 2022 · 4 comments
Labels
bug Something isn't working concept: RDF dataset Relates to the RDF datasets concept. good first issue Good for newcomers

Comments

@aucampia
Copy link
Member

I believe turtle does not handle quads, but our default serialization format for ConjunctiveGraph is turtle as turtle does not override the default for Graph, I guess we should probably change this, question is to what.

I think TriG would make most sense, but the other option is n3.

@niklasl
Copy link
Member

niklasl commented Jan 16, 2022

I agree that TriG is best. TriG is explicitly a superset of Turtle for supporting multiple named graphs (RDF datasets). Notation 3 is not a W3C REC, and it extends things with more complex structures (variables, graphs as formulas ("complex values") etc.). It is not (AFAIK) a superset of TriG (if it was, it could make sense).

@aucampia aucampia added good first issue Good for newcomers fix Fixes an issue bug Something isn't working and removed fix Fixes an issue labels Apr 9, 2022
WhiteGobo pushed a commit to WhiteGobo/rdflib that referenced this issue Apr 28, 2023
…ault (RDFLib#1674)

Created method ConjunctiveGraph.serialize(..., format='trig', ...).

Because of typing problems I replaced some annotations in the
overloaded methods of rdflib.Graph.serialize, so that in subclasses
serialize knows, that it returns type(self) and not Graph.

Because Graph.serialize annotations are still incompatible with
ConjunctiveGraph.serialize added type: ignore [overriden]
to let mypy skip that method.
@aucampia aucampia added interface bug An issue with our public interface and removed interface bug An issue with our public interface labels May 19, 2023
aucampia pushed a commit to WhiteGobo/rdflib that referenced this issue May 19, 2023
…ault (RDFLib#1674)

Created method ConjunctiveGraph.serialize(..., format='trig', ...).

Because of typing problems I replaced some annotations in the
overloaded methods of rdflib.Graph.serialize, so that in subclasses
serialize knows, that it returns type(self) and not Graph.

Because Graph.serialize annotations are still incompatible with
ConjunctiveGraph.serialize added type: ignore [overriden]
to let mypy skip that method.
@aucampia
Copy link
Member Author

@WhiteGobo made a PR to fix this, but it occurs to me now that fixing this is potentially a breaking change.

There may be some mitigating factors, in that serializing a ConjunctiveGraph that contains quads outside the default graph using turtle generates output, but the output is wrong. And furthermore, serializing a ConjunctiveGraph that only had triples in the default graph as trig should result in valid turtle output.

Given these two conditions hold, I think it is okay to include a fix in version 6; otherwise this has to be merged in a way that only has an effect on version 7 onwards[ref].

CC: @RDFLib/core-reviewers

@aucampia aucampia added the concept: RDF dataset Relates to the RDF datasets concept. label May 20, 2023
@aucampia
Copy link
Member Author

@aucampia
Copy link
Member Author

aucampia commented Jun 8, 2023

Next release will be 7 and we will generally be more open to breaking changes going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working concept: RDF dataset Relates to the RDF datasets concept. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants