fekaputra / shacl-plugin

SHACL4Protege - SHACL constraint validation plugin for Protégé
https://semantic-systems.org
MIT License
34 stars 8 forks source link

Validating imported triplets #35

Closed b3h0ld3r closed 2 years ago

b3h0ld3r commented 2 years ago

Hi!

I am trying to validate an owl ontolgy (default), that imports an other owl ontology (kavoc). At some point I have the following property shape:

sh:property [
    sh:path kavoc:typeOfDefinition ;
    sh:class kavoc:PsiDefinitionType;
    sh:minCount 1 ;
    sh:maxCount 1 ;
] ;

Now, the instances of the class kavoc:PsiDefinitionType are also defined in the kavoc ontology, and the SHACL engine drops me a validation error: "Value must be an instance of kavoc:PsiDefinitionType". If I move the instances to the default ontology, it works no problem.

The SHACL specification says: "The data graph is expected to include all the ontology axioms related to the data...", so I suppose the SHACL engine ignores any imported triplets. Is this the expected behavior?

Is there any way to include the imported ontology in the validation process?

Thank you in advance!

Regards,

Attila

fekaputra commented 2 years ago

Hi Attila,

I have to admit that I am not sure whether or not such a behaviour is expected or not (especially on the A-Box part from the imported ontology). To be safe, I'll suggest to manually (or programmatically) merged the imported ontology into the data graph before conducting validation.

To get a precise answer, however, probably the best option for you is to ask the shacl mailing list (https://lists.w3.org/Archives/Public/public-shacl/) - I will also be interested on the answer to it :)

Fajar

b3h0ld3r commented 2 years ago

Thank you, I'll do that.

b3h0ld3r commented 2 years ago

Hi Fajar!

I did as you suggested, and got a reply. According to the answer, the SHACL validation algorithm should take the triplets into account that become accessible by the owl:imports links.

https://lists.w3.org/Archives/Public/public-shacl/2021Oct/0001.html

I suppose it requires coding to modify the SHACL plugin, so my best bet is to do as you suggested, and merge the ontologies.

Thank you again!

Regards,

Attila