You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "Beaudet, David" <D-...@NGA.GOV.INVALID> on 2022/01/03 21:10:55 UTC

auto-polymorphism?

Greetings and Happy New Year all.

I'm writing some SHACL to validate Linked Art which is based on CiDOC-CRM.  When I consume the following JSON-LD file with Jena, the "Place" object becomes polymorphic in the sense of Jena automatically assigning another class to it due to a property definition in the ontology that sets the rdfs:domain to crm:E33_Linguistic_Object due to the presence of the "language" property.  I've pasted the relevant ontology portion below the JSON-LD.  Is there a way to disable the auto-assignment of this additional class so that SHACL constraints can be used to validate the object of "referred_to_by" instead of it becoming automatically valid due to the polymorphic behavior?  When I remove <rdfs:domain rdf:resource="E33_Linguistic_Object"/> from the definition, the additional class assignment on ingest is prevented.

Thanks,

Dave

{
  "@context": https://linked.art/ns/v1/linked-art.json,
  "id": https://linked.art/example/object/0,
  "type": "HumanMadeObject",
  "_label": "Mona Lisa",
  "referred_to_by": [
    {
      "type": "Place",
      "language": [
        {
          "id": http://vocab.getty.edu/aat/300388277,
          "type": "Language",
          "_label": "English"
        }
      ],
      "classified_as": [
        {
          "id": http://vocab.getty.edu/aat/300435416,
          "type": "Type",
          "_label": "Description",
          "classified_as": [
            {
              "id": http://vocab.getty.edu/aat/300418049,
              "type": "Type",
              "_label": "Brief Text"
            }
          ]
        }
      ],
      "content": "This portrait was doubtless started in Florence around 1503. It is thought to be of Lisa Gherardini, wife of a Florentine cloth merchant ..."
    }
  ]
}

<rdf:Property rdf:about="P72_has_language">
    <rdfs:label xml:lang="fr">est en langue</rdfs:label>
   <rdfs:label xml:lang="ru">&#1080;&#1084;&#1077;&#1077;&#1090; &#1103;&#1079;&#1099;&#1082;</rdfs:label>
    <rdfs:label xml:lang="en">has language</rdfs:label>
    <rdfs:label xml:lang="de">hat Sprache</rdfs:label>
    <rdfs:label xml:lang="el">&#941;&#967;&#949;&#953; &#947;&#955;&#974;&#963;&#963;&#945;</rdfs:label>
    <rdfs:label xml:lang="pt">&#233; da l&#237;ngua </rdfs:label>
    <rdfs:label xml:lang="zh">&#20351;&#29992;&#35821;&#35328;</rdfs:label>

    <rdfs:comment>This property describes the E56 Language of an E33 Linguistic Object.
Linguistic Objects are composed in one or more human Languages. This property allows these languages to be documented.
</rdfs:comment>
    <rdfs:domain rdf:resource="E33_Linguistic_Object"/>
    <rdfs:range rdf:resource="E56_Language"/>
<owl:inverseOf rdf:resource="P72i_is_language_of"/>
</rdf:Property>


RE: auto-polymorphism?

Posted by "Beaudet, David" <D-...@NGA.GOV.INVALID>.
Seems this is due to using a model with inference.   

Switching from

OntModelSpec modelSpec = OntModelSpec.RDFS_MEM_RDFS_INF;

to

OntModelSpec modelSpec = OntModelSpec.RDFS_MEM;

Prevented the additional classes from being added to the individual in the resulting graph. 


-----Original Message-----
From: Beaudet, David <D-...@NGA.GOV.INVALID> 
Sent: Monday, January 3, 2022 4:11 PM
To: users@jena.apache.org
Subject: auto-polymorphism?


Greetings and Happy New Year all.

I'm writing some SHACL to validate Linked Art which is based on CiDOC-CRM.  When I consume the following JSON-LD file with Jena, the "Place" object becomes polymorphic in the sense of Jena automatically assigning another class to it due to a property definition in the ontology that sets the rdfs:domain to crm:E33_Linguistic_Object due to the presence of the "language" property.  I've pasted the relevant ontology portion below the JSON-LD.  Is there a way to disable the auto-assignment of this additional class so that SHACL constraints can be used to validate the object of "referred_to_by" instead of it becoming automatically valid due to the polymorphic behavior?  When I remove <rdfs:domain rdf:resource="E33_Linguistic_Object"/> from the definition, the additional class assignment on ingest is prevented.

Thanks,

Dave

{
  "@context": https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinked.art%2Fns%2Fv1%2Flinked-art.json&amp;data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=IlY6mqroMD56amhcDwKo7zx7VwBaaYstAXpX49poubo%3D&amp;reserved=0,
  "id": https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinked.art%2Fexample%2Fobject%2F0&amp;data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=VkI8Hlctfgl%2FQ05iGO%2Bykp0o6Fy0xkSFy5KtlkixHjs%3D&amp;reserved=0,
  "type": "HumanMadeObject",
  "_label": "Mona Lisa",
  "referred_to_by": [
    {
      "type": "Place",
      "language": [
        {
          "id": https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvocab.getty.edu%2Faat%2F300388277&amp;data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=njMjm2w88Hs5nVun6jVS%2BHb045ZcHlSM%2FCBv61tD7YA%3D&amp;reserved=0,
          "type": "Language",
          "_label": "English"
        }
      ],
      "classified_as": [
        {
          "id": https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvocab.getty.edu%2Faat%2F300435416&amp;data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=n8LiBMGjAFpuVS0J%2F2oOKyAppY3X%2FmYlJ%2B61xC497B8%3D&amp;reserved=0,
          "type": "Type",
          "_label": "Description",
          "classified_as": [
            {
              "id": https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvocab.getty.edu%2Faat%2F300418049&amp;data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=A4Emc9gWvy65ux49%2BCZOYnMQNZeglBUaFDds3eo6oVg%3D&amp;reserved=0,
              "type": "Type",
              "_label": "Brief Text"
            }
          ]
        }
      ],
      "content": "This portrait was doubtless started in Florence around 1503. It is thought to be of Lisa Gherardini, wife of a Florentine cloth merchant ..."
    }
  ]
}

<rdf:Property rdf:about="P72_has_language">
    <rdfs:label xml:lang="fr">est en langue</rdfs:label>
   <rdfs:label xml:lang="ru">&#1080;&#1084;&#1077;&#1077;&#1090; &#1103;&#1079;&#1099;&#1082;</rdfs:label>
    <rdfs:label xml:lang="en">has language</rdfs:label>
    <rdfs:label xml:lang="de">hat Sprache</rdfs:label>
    <rdfs:label xml:lang="el">&#941;&#967;&#949;&#953; &#947;&#955;&#974;&#963;&#963;&#945;</rdfs:label>
    <rdfs:label xml:lang="pt">&#233; da l&#237;ngua </rdfs:label>
    <rdfs:label xml:lang="zh">&#20351;&#29992;&#35821;&#35328;</rdfs:label>

    <rdfs:comment>This property describes the E56 Language of an E33 Linguistic Object.
Linguistic Objects are composed in one or more human Languages. This property allows these languages to be documented.
</rdfs:comment>
    <rdfs:domain rdf:resource="E33_Linguistic_Object"/>
    <rdfs:range rdf:resource="E56_Language"/> <owl:inverseOf rdf:resource="P72i_is_language_of"/>
</rdf:Property>