Skip to content

Parse JSON-LD as list? #3166

@edsu

Description

@edsu

👋 If I already have some JSON-LD as a dict and would like to create a rdflib Graph from it, is there a way to do that?

For example:

test_json = {
    "@context": {
        "dc": "http://purl.org/dc/terms/",
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#"
    },
    "@id": "http://example.org/about",
    "dc:title": {
        "@language": "en",
        "@value": "Someone's Homepage"
    }
}

g = Graph().parse(data=test_json, format='json-ld')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions