Hello,
I'm trying to create a graph containing a number of named graphs and serialize it to trig (and possibly eventually to json-ld).
If I only add quads, they will not be included in the output:
G = ConjunctiveGraph()
g1 = Graph("default", "one")
G.add((URIRef("
http://example.com"), RDFS.label, Literal("example 1"), g1))
Full working example is here:
https://gist.github.com/raffazizzi/090e0fca05dec01ddeda
If I only create the assertion in the named graph, serializing the main graph yields nothing, understandably.
I only get the correct output when I add both a quad *and* add the same assertion to the named graph, thus duplicating the data (undesirable).
g1 = Graph("default", "one")
G.add((URIRef("
http://example.com"), RDFS.label, Literal("example 1"), g1))
g1.add((URIRef("
http://example.com"), RDFS.label, Literal("example 1")))
Full working example here:
https://gist.github.com/raffazizzi/11f635eb9a6961658c2d
Any ideas on why this is happening? Is it an issue with the trig serializer, or am I misunderstanding how named graphs should work?
Thank you!
Raff