Validate the instances of subclasses in the property shape

28 views
Skip to first unread message

Kai Liu

unread,
Apr 8, 2022, 11:16:35 AM4/8/22
to TopBraid Suite Users
Assume that we have the following shapes:
==========================
ex:Person
  a owl:Thing ;
  a sh:NodeShape ;
  sh:property ex:Person-hasFriend  ;
.
ex:Person-hasFriend
  a sh:PropertyShape ;
  sh:path ex:hasFriend ;
  sh:class ex:Person ;
.
ex:NicePerson
  a sh:NodeShape ;
  rdfs:subClassOf ex:Person ;
.
==========================
and the following instance data:
==========================
ex:Alice a ex:NicePerson .
ex:Peter a ex:NicePerson .
ex:Peter ex:hasFriend ex:Alice .
==========================

The validation for the above instance data will fail, because ex:Alice is explicitly a ex:NicePerson instead of a ex:Person. However, ex:Alice is indeed implicitly a ex:Person (RDFS inference). Is there a solution to define a superclass in a property shape in order to validate the instances of its subclasses? The reason why I am asking is that we currently have to list all of the subclasses with "sh:or" in a property shape, in order to pass the validation, which is very tedious.

Thanks.

Best regards, Kai







David Price

unread,
Apr 8, 2022, 11:55:20 AM4/8/22
to topbrai...@googlegroups.com
I’m not sure what exactly is happening in your case and did not test anything, but SHACL and the TB SHACL engine understands class hierarchies just fine.

Perhaps you simply need to also declare the classes as being owl:Class?  Not all NodeShapes are also owl:Class, but in your case it appears they are.

Cheers,
David

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ee7b968b-8a35-4484-b591-59027adde585n%40googlegroups.com.


Kai Liu

unread,
Apr 8, 2022, 12:19:27 PM4/8/22
to TopBraid Suite Users
Hi David,

thanks for your reply. I double-checked the case. Oh, indeed I made a mistake on my side. :-( 

Yes, you are right. The validation of the above graph is fine. 

Best regards, Kai
Reply all
Reply to author
Forward
0 new messages