Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On parsing, @included section is ignored unless the JSON-LD document is flattened #98

Open
anatoly-scherbakov opened this issue Nov 29, 2020 · 0 comments

Comments

@anatoly-scherbakov
Copy link

Disposition

Full code example is in this Gist.

I am trying to import a JSON-LD document into an RDFLib ConjunctiveGraph. The document:

{
    "@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.

Actual Result

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" .

...Unless

... I do jsonld.flatten() before importing, in which case everything works:

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant