jargon-sh / issues

The jargon.sh issue tracker
1 stars 0 forks source link

[JSON-LD Vocabulary]: Imported code lists are included into the vocabulary correctly #9

Open kshychko opened 1 month ago

kshychko commented 1 month ago

DPP vocabulary imports CountryId from BSP as contryCode table:

image

Generated JSON-LD vocabulary is fixed when:

In case of countryCode the @context includes "unece":"https://vocabulary.uncefact.org/" and "schema:rangeIncludes" for originCountry is set to "@id": "unece:CountryId":

{
    "@context": {
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "owl": "http://www.w3.org/2002/07/owl#",
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "schema": "https://schema.org/",
        "DigitalProductPassport": "https://test.uncefact.org/vocabulary/untp/dpp/",
        "unece": "https://vocabulary.uncefact.org/"
    },
    "@graph": [
        {
            "@id": "DigitalProductPassport:originCountry",
            "@type": [
                "rdf:Property",
                "owl:ObjectProperty"
            ],
            "rdfs:label": "originCountry",
            "schema:rangeIncludes": {
                "@id": "unece:CountryId"
            },
            "schema:domainIncludes": {
                "@id": "DigitalProductPassport:Material"
            },
            "rdfs:comment": "A ISO 3166-1 code representing the country of origin of the component or ingredient."
        }
    ]
}

That means that code list export requires the following configuration:

  1. Alias for a code list URI namespace to be included into the context ("unece")
  2. A code list namespace URI ("https://vocabulary.uncefact.org/")
  3. A code list range name ("CountryId")
  4. A code list URI is built from URI namespace + range name ("https://vocabulary.uncefact.org/CountryId")
kshychko commented 1 month ago

@Fak3 is the following variant possible as a temporary solution?

{
    "@context": {
        "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
        "owl": "http://www.w3.org/2002/07/owl#",
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "schema": "https://schema.org/",
        "DigitalProductPassport": "https://test.uncefact.org/vocabulary/untp/dpp/"
    },
    "@graph": [
        {
            "@id": "DigitalProductPassport:originCountry",
            "@type": [
                "rdf:Property",
                "owl:ObjectProperty"
            ],
            "rdfs:label": "originCountry",
            "schema:rangeIncludes": {
                "@id": "https://vocabulary.uncefact.org/CountryId"
            },
            "schema:domainIncludes": {
                "@id": "DigitalProductPassport:Material"
            },
            "rdfs:comment": "A ISO 3166-1 code representing the country of origin of the component or ingredient."
        }
    ]
}
Fak3 commented 1 month ago

Yes, that will work. But I believe the CountryId must be correctly named as Country. Without id.

kshychko commented 1 month ago

Yes, that will work. But I believe the CountryId must be correctly named as Country. Without id.

Thanks! as for the name of the code lists, that's out of scope here, but we can raise a ticket in https://github.com/uncefact/spec-jsonld