How to define discrete property shape constraints for inherited properties?

46 views
Skip to first unread message

Andrew Arnold

unread,
Aug 25, 2023, 2:45:22 PM8/25/23
to TopBraid Suite Users
Hello Holger,

I have a  Location class with Site, Facility, Level, and Room sub-classes. 

The Location class defines the Location relation properties 'has_part' and the inverse 'part_of';  however the constraints on these relations are different for each sub-class.  For example:

A Facility can have a Facility or a Level as a part, but not a Room 
A Level can have a Room as a part, but not a Site or Facility

Can I define and bind a property shape to each sub-class that permits me to specify the constraints for each one discretely or do I need to define the properties redundantly for each sub-class ?

Thanks, Andrew

   
dpr:Location
  a owl:Class ;
  a sh:NodeShape ;
  rdfs:label "Location" ;
  rdfs:subClassOf dpr:AECO ;
  sh:property dpr:Location-hasPart ;
  sh:property dpr:Location-hasPart-inverse ;
.


Holger Knublauch

unread,
Aug 26, 2023, 5:27:51 AM8/26/23
to topbrai...@googlegroups.com
Hi Andrew,

it is perfectly fine to have multiple property shapes for the same sh:path (property). So at the root class you could have

ex:Location
    a dash:ShapeClass ;
    rdfs:subClassOf owl:Thing ;
    sh:property ex:Location-has_part ;
.
ex:Location-has_part
    a sh:PropertyShape ;
    sh:path ex:has_part ;
    sh:name "has part" ;
.

and then define the sh:class in the subclasses

ex:Level
    a dash:ShapeClass ;
    rdfs:subClassOf ex:Location ;
    sh:property ex:Level-has_part ;
.
ex:Level-has_part
    a sh:PropertyShape ;
    sh:path ex:has_part ;
    sh:class ex:Room ;
.

I would move all general constraints into the superclass but anything specific remains in the subclasses only.

HTH
Holger


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
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/50d24bad-03b4-4a21-991c-9033b8a9190dn%40googlegroups.com.

Andrew Arnold

unread,
Aug 28, 2023, 8:20:51 PM8/28/23
to TopBraid Suite Users
Hello Holger, I'm sorry to keep pestering you with this; however I tried your suggestion without adding class constraints yet and I'm getting the result that the added Facility hasPart property shape does not update in the property set UI panel, it still shows the path for Location-hasPart and the system  throws the violation that the path value can have only one value.  When I try to delete the Location path value for the Facility class from the problems/issues UI, it appears to delete the Facility path no matter which value I try to delete...  The attached UI images show the issue...

If you could help me identify the problem, I'd greatly appreciate it.

Andrew
Facility 'has part' property following changes.png
Problem Pane Preview.png
Location 'has part' property before changes.png

Holger Knublauch

unread,
Aug 29, 2023, 2:38:53 AM8/29/23
to topbrai...@googlegroups.com
Could you send me the file that you have so that I can take a look?

Holger


To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/7f860495-c7e1-45f4-a76b-f9f27777e759n%40googlegroups.com.
<Facility 'has part' property following changes.png><Problem Pane Preview.png><Location 'has part' property before changes.png>

Reply all
Reply to author
Forward
0 new messages