jargon-sh / issues

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

owl:DatatypeProperty is assigned for RDF properties with schema:rangeIncludes set to a code list #2

Closed kshychko closed 1 month ago

kshychko commented 1 year ago

During UN/CEFACT JSON-LD BSP vocabulary implementation the following approach was chosen to support code lists:

  1. Define RDF Class to indicate a code list type
  2. Define RDF Resource with the type from the first step and code value
  3. Define RDF Property with schema:rangeIncludes set to the RDF Class from the first step

Below are the snippets from the vocabulary to illustrate the approach

{
      "rdfs:label": "AccessRightsTypeCodeList",
      "@type": "rdfs:Class",
      "@id": "unece:AccessRightsTypeCodeList",
      "rdfs:comment": "A character string used to represent the type of access rights.",
      "unece:businessDomain": "finance"
    },
    {
      "@id": "unece:AccessRightsTypeCodeList#P",
      "@type": "unece:AccessRightsTypeCodeList",
      "rdf:value": "P",
      "rdfs:comment": "Prohibited",
      "unece:businessDomain": "finance"
    },
    {
      "@id": "unece:AccessRightsTypeCodeList#R",
      "@type": "unece:AccessRightsTypeCodeList",
      "rdf:value": "R",
      "rdfs:comment": "Restricted",
      "unece:businessDomain": "finance"
    },
    {
      "@id": "unece:AccessRightsTypeCodeList#U",
      "@type": "unece:AccessRightsTypeCodeList",
      "rdf:value": "U",
      "rdfs:comment": "Unlimited",
      "unece:businessDomain": "finance"
    }
{
            "@id": "unece:accessRightsTypeAccessRightsCode",
            "schema:rangeIncludes": {
                "@id": "unece:AccessRightsTypeCodeList"
            },
            "@type": [
                "rdf:Property",
                "owl:ObjectProperty"
            ],
            "schema:domainIncludes": {
                "@id": "unece:RequestingParty"
            },
            "rdfs:comment": "The code specifying the access rights, such as unlimited, restricted, prohibited, for this requesting party.",
            "rdfs:label": "accessRightsTypeAccessRightsCode",
            "unece:cefactElementMetadata": [
                {
                    "@id": "cefact:Requesting_Party.AccessRights.Code",
                    "@type": "unece:BasicBIE",
                    "unece:propertySchemaName": "accessRightsCode",
                    "unece:cefactUNId": "UN01002022",
                    "unece:cefactBieDomainClass": "cefact:Requesting_Party.Details",
                    "unece:cefactBusinessProcess": "Project Management",
                    "rdfs:comment": "The code specifying the access rights, such as unlimited, restricted, prohibited, for this requesting party.",
                    "unece:domainName": "RequestingParty"
                }
            ]
        }

But jargon defines it as owl:DatatypeProperty

{
      "@id": "unece:accessRightsTypeAccessRightsCode",
      "@type": [
        "rdf:Property",
        "owl:DatatypeProperty"
      ],
      "rdfs:label": "accessRightsTypeAccessRightsCode",
      "schema:rangeIncludes": {
        "@id": "unece:AccessRightsTypeCodeList"
      },
      "schema:domainIncludes": {
        "@id": "unece:RequestingParty"
      },
      "rdfs:comment": "The code specifying the access rights, such as unlimited, restricted, prohibited, for this requesting party."
    }

Which is not correct from the perspective of the approach that was taken for UN/CEFACT JSON-LD BSP vocabulary implementation, because the schema:rangeIncludes doesn't refer to a simple data type like xsd:string for example.

@Fak3 could you please confirm my assumption above?

Fak3 commented 1 year ago

It should be ObjectProperty instead of DatatypeProperty

colugo commented 1 year ago

Hey @kshychko

Here is what Jargon was producing:

image

But now for types that point to a code, and not a primitive or other class, it now produces:

image

Is that what you were after?

Fak3 commented 1 year ago

No, that's not correct. DatatypeProperty should only be assigned to properties which have range in the xsd namespace. Ie integers, decimals, strings, datetime, etc

colugo commented 1 year ago

Thanks @Fak3

So DatatypeProperty is exclusively for primitives. If it's from XSD, it should be DatatypeProperty ObjectProperty is for everything else, always. If its not from XSD, it should be ObjectProperty?

Is that correct?

Fak3 commented 1 year ago

Yes, that's correct

colugo commented 1 year ago

Thanks @Fak3 . @kshychko I have changed this, and it's now live. Next time you save a snapshot the jsonld should align with what you've outlined above.

Let me know if you can verify, and I'll close this issue.