Closed
Description
In nquads, the 4th component (graph id) of each line can be omitted, meaning that the triple belongs to the default graph.
Currently, the nquads parser puts every such triple in a different context, identified by a fresh BNode, which is clearly wrong.
E.g.:
from rdflib import ConjunctiveGraph, Dataset
from rdflib.parser import StringInputSource
ds = ConjunctiveGraph()
src = StringInputSource("""
<http://example.org/s1> <http://example.org/p1> <http://example.org/o1> .
<http://example.org/s2> <http://example.org/p2> <http://example.org/o2> .
<http://example.org/s3> <http://example.org/p3> <http://example.org/o3> <http://example.org/g3> .
""")
ds.parse(src, format="nquads")
assert len(ds) == 3, len(g)
assert len(list(ds.contexts())) == 2, len(list(ds.contexts()))