- From: Irene Polikoff <irene@topquadrant.com>
- Date: Fri, 16 Jul 2021 19:39:55 -0400
- To: Joy lix <joylix4112@outlook.com>
- Cc: public-shacl@w3.org
- Message-Id: <87CA1C5C-F23F-43C7-A3E9-503FAFD6E96C@topquadrant.com>
Sorry was too quick to respond and made a couple of typos in the first option. Use the following: > :TallPerson a owl:Class, sh:NodeShape; > sh:property [sh:path :hasHeight; > sh:datatype xsd:integer; > sh:minInclusive 185;] > ... > . Or :TallPerson a owl:Class, sh:NodeShape; sh:property :TallPerson-height; ... . Together With > :TallPerson-height a sh:PropertyShape; > sh:path :hasHeight; > sh:datatype xsd:integer; > sh:minInclusive 185; > . Or just the property shape with target > :TallPerson-height a sh:PropertyShape; Sh:target :TallPerson > sh:path :hasHeight; > sh:datatype xsd:integer; > sh:minInclusive 185; > . > On Jul 16, 2021, at 1:56 PM, Irene Polikoff <irene@topquadrant.com> wrote: > > You do not need to use sh:if for this example. > > Simply do: > > :ShortPerson a owl:Class, sh:NodeShape; > sh:path :hasHeight; > sh:datatype xsd:integer; > sh:maxInclusive 155 ; > . > > :MediumPerson a owl:Class, sh:NodeShape; > sh:path :hasHeight; > sh:minExclusive 155; > sh:datatype xsd:integer; > sh:maxExclusive 185; > . > > :TallPerson a owl:Class, sh:NodeShape; > sh:path :hasHeight; > sh:datatype xsd:integer; > sh:minInclusive 185; > . > > This will give you a violation message for Bob. > > You can also make these property shapes within the node shape if you need to make some statements about other properties of these class members e.g. > > :TallPerson a owl:Class, sh:NodeShape; > sh:property [sh:path :hasHeight; > sh:datatype xsd:integer; > sh:minInclusive 185;] > ... > . > >> On Jul 16, 2021, at 3:28 AM, Joy lix <joylix4112@outlook.com> wrote: >> >> Dear all: >> >> I'm not very clear about the use of sh:if, The examples given in the SHACL-AF specification are relatively simple so I don't understand them very well. >> Consider the following example: >> >> if someone.height>180 then >> someone is tallPerson >> else if someone.height>155 then >> someone is mediumPerson >> else >> someone is shortPerson >> >> How do I present it use sh:if in a shacl shape file? >> Can the SHACL validation engine give an violation message for the following data files? >> :bob a :Person ; >> :hasHeight 185 ; >> a :shortPerson . >> Because Bob, by definition, should be a tallPerson. >> >> Thank you for your help! >> >> Kind regards, >> Joylix >
Received on Friday, 16 July 2021 23:40:12 UTC