Skip to content

Dataset adds graph labels where there were none #2375

@sdasda7777

Description

@sdasda7777

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconcept: RDF datasetRelates to the RDF datasets concept.coreRelates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}`critical

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions