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

Dataset adds graph labels where there were none #2375

Closed
sdasda7777 opened this issue Apr 30, 2023 · 3 comments · Fixed by #2406
Closed

Dataset adds graph labels where there were none #2375

sdasda7777 opened this issue Apr 30, 2023 · 3 comments · Fixed by #2406
Labels
bug Something isn't working concept: RDF dataset Relates to the RDF datasets concept. core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` critical

Comments

@sdasda7777
Copy link

sdasda7777 commented Apr 30, 2023

If you run the following code

from rdflib import Dataset

input_data = "<http://s> <http://v> <http://o>."
ds = Dataset()
ds.parse(data=input_data, format="nquads")
print(ds.serialize(format="nquads"))

you will get something like <http://s> <http://v> <http://o> _:Nf7773353eb67460ab92041894df76998 .

I believe that is wrong, since there was no graph label in the input data, and RDF standard clearly distinguishes between the default graph and named graphs.

Is this a bug, or is there a way to make it not do that? If it is necessary to have some graph in there internally, I think I saw some tools use specific IRIs like http://www.w3.org/1999/02/22-rdf-syntax-ns#defaultGraph, but in that case there wouldn't be a reason not to leave those out when serializing.

@sdasda7777
Copy link
Author

Actually, I managed to get the default graph data serialized with <urn:x-rdflib:default> graph label just now. I think the difference was I didn't use .parse(), but rather entered the data in myself 🤔

@aucampia aucampia added bug Something isn't working core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` labels May 11, 2023
@aucampia aucampia added the concept: RDF dataset Relates to the RDF datasets concept. label May 20, 2023
@aucampia
Copy link
Member

@aucampia
Copy link
Member

Fix is more or less ready, please have a look:

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. core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` critical
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants