Yes, Martin’s example had a malformed SHACL shape.
As per the spec, the value of sh:class must be a URI. In the below example, the
value is a blank node.
> sh:class [
> a owl:Class ;
> owl:unionOf (
> unnamed:Thing_1
> unnamed:Thing_2
> ) ;
> ] ;
The behavior of the SHACL engine is not defined if a shape is malformed.
You should not be using OWL Manchester syntax to specify values for SHACL
constraints, targets, etc.
SHACL has sh:or constraint component.
The correct SHACL expression would be:
sh:or (
[
sh:class unnamed:Thing_1 ;
]
[
sh:class unnamed:Thing_1 ;
]
) ;
Creating a parent class for the three subclasses also works and is simpler.
> On Nov 15, 2019, at 5:38 AM, Martin Jergler <[email protected]> wrote:
>
> Hi David,
>
> thanks a lot for the quick response.
> You are right, a superclass works and actually fits what we want to achieve.
> Thumbs up!
>
> Thanks again and best regards
> Martin
>
> Am Fr., 15. Nov. 2019 um 10:08 Uhr schrieb dprice <[email protected]
> <mailto:[email protected]>>:
> Hi Martin,
>
> My reading of the SHACL spec is that the union is not legal SHACL. See
> https://www.w3.org/TR/shacl/#constraints-section
> <https://www.w3.org/TR/shacl/#constraints-section> where I see: sh:class or
> sh:datatype : rdfs:Resource
>
> I made a small example and find that what you tried to do sort of works.
> Composer actually tells me that the property shape union is invalid, as I
> thought per SHACL spec section 2. Shapes and Constraints linked above, but it
> does still tell me the instance min/max was invalid.
>
> Here’s the validation report:
>
> <Screen Shot 2019-11-15 at 09.00.34.png>
>
>
> Here’s the example tested with 6.3 Beta:
>
> # baseURI: http://example.org/unnamed <http://example.org/unnamed>
> # imports: http://datashapes.org/dash <http://datashapes.org/dash>
> # prefix: unnamed
>
> @prefix dash: <http://datashapes.org/dash# <http://datashapes.org/dash#>> .
> @prefix owl: <http://www.w3.org/2002/07/owl#
> <http://www.w3.org/2002/07/owl#>> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#>> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#
> <http://www.w3.org/2000/01/rdf-schema#>> .
> @prefix sh: <http://www.w3.org/ns/shacl# <http://www.w3.org/ns/shacl#>> .
> @prefix unnamed: <http://example.org/unnamed# <http://example.org/unnamed#>> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#
> <http://www.w3.org/2001/XMLSchema#>> .
>
> <http://example.org/unnamed <http://example.org/unnamed>>
> a owl:Ontology ;
> owl:imports <http://datashapes.org/dash <http://datashapes.org/dash>> ;
> owl:versionInfo "Created with TopBraid Composer" ;
> .
> unnamed:PropertyShape_1
> a sh:PropertyShape ;
> sh:path unnamed:Property_1 ;
> sh:class [
> a owl:Class ;
> owl:unionOf (
> unnamed:Thing_1
> unnamed:Thing_2
> ) ;
> ] ;
> sh:maxCount 3 ;
> sh:minCount 3 ;
> .
> unnamed:Property_1
> a rdf:Property ;
> rdfs:domain unnamed:Thing_3 ;
> .
> unnamed:Thing_1
> a owl:Class ;
> a sh:NodeShape ;
> rdfs:subClassOf owl:Thing ;
> .
> unnamed:Thing_1_1
> a unnamed:Thing_1 ;
> .
> unnamed:Thing_2
> a owl:Class ;
> a sh:NodeShape ;
> rdfs:subClassOf owl:Thing ;
> .
> unnamed:Thing_3
> a owl:Class ;
> a sh:NodeShape ;
> rdfs:subClassOf owl:Thing ;
> sh:property unnamed:PropertyShape_1 ;
> .
> unnamed:Thing_3_1
> a unnamed:Thing_3 ;
> unnamed:Property_1 unnamed:Thing_1_1 ;
> .
>
>
> WRT a solution - One approach is to make a superclass of the three classes in
> the union.
>
> Cheers,
> David
>
>> On 15 Nov 2019, at 08:38, Martin Jergler <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hi,
>>
>> with TopBraid Composer I created a property constraint with a sh:class
>> definition which comprises a union of classes (see figure below).
>> However, when I want to validate my instance data against the defined shape
>> using the shacl.ValidationUtil it results in a error because the shacl file
>> is serialized using blank nodes.
>> It seems to me that the ValidationUtil cannot cope with blank nodes in the
>> SHACL model.
>>
>> Does anybody know of a solution to this problem?
>>
>>
>> <Unbenannt.PNG> <>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Thanks a lot
>> Martin
>>
>> --
>> 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 [email protected]
>> <mailto:[email protected]>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/topbraid-users/49930160-0796-41af-89e5-0d41e43b3937%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/topbraid-users/49930160-0796-41af-89e5-0d41e43b3937%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> <Unbenannt.PNG>
>
> UK +44 (0) 7788 561308
> US +1 (336) 283-0808
>
>
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/B04EE232-CB47-43B2-8CF4-AACE2A5AC8E9%40topquadrant.com
>
> <https://groups.google.com/d/msgid/topbraid-users/B04EE232-CB47-43B2-8CF4-AACE2A5AC8E9%40topquadrant.com?utm_medium=email&utm_source=footer>.
>
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/CAA%3DCivzrxn7btpPo1mxxmnN26Qk5RZsCq4eZ2CnMvS3mO3MOiw%40mail.gmail.com
>
> <https://groups.google.com/d/msgid/topbraid-users/CAA%3DCivzrxn7btpPo1mxxmnN26Qk5RZsCq4eZ2CnMvS3mO3MOiw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/DBE6274C-A595-4CED-806B-8F59C6D38C24%40topquadrant.com.