-
Notifications
You must be signed in to change notification settings - Fork 581
Closed
Labels
bugSomething isn't workingSomething isn't workingserializationRelated to serialization.Related to serialization.
Milestone
Description
When parsing then serialising TriG, the serialiser fails to correctly detect when it's dealing with the default graph, so attempts to serialise it as a named graph (which ends up with 'None' instead of a URI or qname).
E.g.:
import rdflib
data = """
@prefix : <http://example.com/> .
<:a> <:b> <:c> .
"""
g = rdflib.ConjunctiveGraph()
g.parse(data=data, format='trig')
print g.serialize(format='trig')
Produces the output:
@prefix : <http://example.com/> .
@prefix ns1: <:> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<None> {
ns1:a ns1:b ns1:c .
}
whereas for latter part of the output, it should produce either:
ns1:a ns1:b ns1:c .
or
{ ns1:a ns1:b ns1:c . }
I've added a unit test for this to #431 .
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingserializationRelated to serialization.Related to serialization.