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 <[email protected]> Sent: Monday, January 3, 2022 4:11 PM To: [email protected] 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&data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=IlY6mqroMD56amhcDwKo7zx7VwBaaYstAXpX49poubo%3D&reserved=0, "id": https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flinked.art%2Fexample%2Fobject%2F0&data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VkI8Hlctfgl%2FQ05iGO%2Bykp0o6Fy0xkSFy5KtlkixHjs%3D&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&data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=njMjm2w88Hs5nVun6jVS%2BHb045ZcHlSM%2FCBv61tD7YA%3D&reserved=0, "type": "Language", "_label": "English" } ], "classified_as": [ { "id": https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvocab.getty.edu%2Faat%2F300435416&data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=n8LiBMGjAFpuVS0J%2F2oOKyAppY3X%2FmYlJ%2B61xC497B8%3D&reserved=0, "type": "Type", "_label": "Description", "classified_as": [ { "id": https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvocab.getty.edu%2Faat%2F300418049&data=04%7C01%7C%7Ce1cd38374081455b3e3608d9cefd92fd%7C53f6461e95ad4b08a8da973e49ae9312%7C0%7C0%7C637768411645195492%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=A4Emc9gWvy65ux49%2BCZOYnMQNZeglBUaFDds3eo6oVg%3D&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">имеет язык</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">έχει γλώσσα</rdfs:label> <rdfs:label xml:lang="pt">é da língua </rdfs:label> <rdfs:label xml:lang="zh">使用语言</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>
