csse-uoft / ckanext-udc

GNU Affero General Public License v3.0
1 stars 0 forks source link

Save metadata in a knowledge graph #18

Closed bgajdero closed 10 months ago

bgajdero commented 1 year ago

Save instances of metadata in a knowledge graph.

Knowledge graph schema will be the maturity models.

bgajdero commented 1 year ago

See mapping file to show how to store the knowledge graph.

LesterLyu commented 1 year ago

Design of mapping configuration:

"mappings": {
        "@context": {
            "dcat": "http://www.w3.org/ns/dcat#",
            "skos": "http://www.w3.org/2004/02/skos/core#",
            "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
            "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
            "dct": "http://purl.org/dc/terms/",
            "foaf": "http://xmlns.com/foaf/0.1/"
        },
        "@id": "http://data.urbandatacentre.ca/catalogue/{ckanField.id}",
        "@type": "http://data.urbandatacentre.ca/catalogue",
        "dct:creator": {
            "@id": "http://data.urbandatacetre.ca/{generate_uuid()}",
            "@type": "foaf:Agent",
            "foaf:mbox": "{ckanField.author_email}",
            "foaf:name": "{ckanField.author}"
        },
        "dct:title": {
            "@type": "xsd:string",
            "@value": "{ckanField.title}"
        }
    }

The mappings part follows the JSON-LD Spec. @context stores the namespaces; @id specify the URI of an instance'; @type specify the rdf:type of the value/instance. The text in the curly bracket {} will be evaluated in Python: