- From: Irene Polikoff <irene@topquadrant.com>
- Date: Fri, 16 Jul 2021 13:56:24 -0400
- To: Joy lix <joylix4112@outlook.com>
- Cc: "public-shacl@w3.org" <public-shacl@w3.org>
- Message-Id: <CCF9CA55-FAFC-45C8-936A-FE5BD2BFE90F@topquadrant.com>
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 17:56:39 UTC