Open anatoly-scherbakov opened 3 years ago
Full code example is in this Gist.
I am trying to import a JSON-LD document into an RDFLib ConjunctiveGraph. The document:
ConjunctiveGraph
{ "@context": { "schema": "https://schema.org/", "blog": "https://blog.me/", "ex": "https://example.org/", "rdfs": "http://www.w3.org/2000/01/rdf-schema#" }, "@id": "blog:JSONLD-and-named-graphs", "@type": "schema:blogPost", "rdfs:label": "JSON-LD and Named Graphs", "@included": [ { "@id": "ex:Robot", "@type": "rdfs:Class" }, { "@id": "ex:Rover", "rdfs:subClassOf": { "@id": "ex:Robot" } } ] }
Notice it has an @included section.
@included
The contents of the @included section is NOT imported, i.e. N3 serialization looks like this:
@prefix blog: <https://blog.me/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix schema: <https://schema.org/> . blog:JSONLD-and-named-graphs a schema:blogPost ; rdfs:label "JSON-LD and Named Graphs" .
... I do jsonld.flatten() before importing, in which case everything works:
jsonld.flatten()
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <https://example.org/Robot> a rdfs:Class . <https://blog.me/JSONLD-and-named-graphs> a <https://schema.org/blogPost> ; rdfs:label "JSON-LD and Named Graphs" . <https://example.org/Rover> rdfs:subClassOf <https://example.org/Robot> .
Is this expected behavior?
Disposition
Full code example is in this Gist.
I am trying to import a JSON-LD document into an RDFLib
ConjunctiveGraph
. The document:Notice it has an
@included
section.Actual Result
The contents of the
@included
section is NOT imported, i.e. N3 serialization looks like this:...Unless
... I do
jsonld.flatten()
before importing, in which case everything works:Is this expected behavior?