. <>

Trig parser can creating multiple contexts for the default graph · Issue #432 · RDFLib/rdflib (original) (raw)

If TriG containing triples in the default graph are specified with and without braces, they end up in 2 separate contexts, e.g.:

import rdflib

data = """
@prefix : <http://example.com/> .
<> <b> <c> .
{ <d> <e> <f> . }
"""
g = rdflib.ConjunctiveGraph()                                                  
g.parse(data=data, format='trig')                                              
print len(list(g.contexts()))

Prints:

2

whereas it should contain only 1 context, i.e. a single default graph that both those triples should belong to.

I've added a unit test for this to #431 .