Holger’s solution assumes that your starting point is OWL - you have OWL axioms 
and are trying to detect contradictions to it using SHACL.

My solution does not assume this. 

I have to go back to the question as to why make this constraint at all? This 
style of modeling is specific to OWL (for reasons related to how tableau 
reasoners operate) and is absent from any other modeling language I could think 
of e.g., XML Schema, JSON Schema, UML, EntityRelationships, etc.

One reason this is uncommon outside of OWL is because if you have different 
objects, their characteristics (properties and property values) will be 
different. And any possible issue are likely to be caught as a result of it - 
through other property shapes. For example, if you say that people must have 
father and a mother and organizations must have ‘year established’ and you have 
a resource that is both a person and an organization, you will get a violation 
one way or another. Another reason is that these kind of errors in data are 
pretty unusual. Data will come from some sources that typically have different 
data structures and identity for the different type of objects.

What are you trying to accomplish? It may be that in your data, you want each 
resource to have only one rdf:type statement. You can do it with sh:maxCount on 
rdf:type. You may want to say that if a resource is a member of class X 
transitively, it can’t be a member of any class that is not a subclass of X. 
This would allow multiple types, but all resolving to the same parent class.

If you do want, for some reason, to stay with the disjoint idea, then you have 
the solution I described where you would need for each class explicitly specify 
disjoint classes. If you want something more terse ala owl:AllDisjointClasses 
where you can say that a list of classes is all disjoint, then Holger’s 
solution. It is generic in that it can work with any ontology but it relies on 
having some statements that identify the list of disjoint classes. Holger used 
OWL vocabulary for these statements. You could invent your own vocabulary and 
modify the query accordingly.

> On Mar 11, 2020, at 12:55 PM, 'Bohms, H.M. (Michel)' via TopBraid Suite Users 
> <[email protected]> wrote:
> 
> One more issue
>  
> Normally I would use RDFS+SHACL without owl
>  
> Now I have to keep however owl:AllDisjointClasses and its instances because 
> it is the targetclass.
>  
> Guess there no way around this?
>  
> Or could I attach the shacl shape to the available classes somehow:
>  
> smls:PhysicalObject a rdfs:Class .
> smls:InformationObject a rdfs:Class .
> smls:Activity a rdfs:Class .
> Etc.
>  
> Or does this actually go into the direction of Irene’s solution?
>  
>  
>  
> Dr. ir. H.M. (Michel) Böhms
> Senior Data Scientist
> 
> T +31888663107
> M +31630381220
> E [email protected] <mailto:[email protected]>    
> Location 
> <https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707>
> 
>  
> <image001.gif> <http://www.tno.nl/>
> This message may contain information that is not intended for you. If you are 
> not the addressee or if this message was sent to you by mistake, you are 
> requested to inform the sender and delete the message. TNO accepts no 
> liability for the content of this e-mail, for the manner in which you use it 
> and for damage of any kind resulting from the risks inherent to the 
> electronic transmission of messages.
>  
>  
>  
>  
> Van: [email protected] <mailto:[email protected]> 
> <[email protected] <mailto:[email protected]>> 
> Namens Holger Knublauch
> Verzonden: Wednesday, March 11, 2020 11:35 AM
> Aan: [email protected] <mailto:[email protected]>
> Onderwerp: Re: [topbraid-users] shacl-rep?
>  
>  
> 
> On 11/03/2020 8:05 pm, 'Bohms, H.M. (Michel)' via TopBraid Suite Users wrote:
>  
> Looks nice
> But
>  
> Wrt
> owl:AllDifferent
>  
> did you mean?:
>  
> owl:AllDisjointClasses
> Ah yes of course...
> 
> Holger
> 
>  
> 
>  
>  
>  
>  
> Dr. ir. H.M. (Michel) Böhms
> Senior Data Scientist
> 
> 
> T +31888663107
> M +31630381220
> E [email protected] <mailto:[email protected]>    
> Location 
> <https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707>
> 
>  
> <image001.gif> <http://www.tno.nl/>
> This message may contain information that is not intended for you. If you are 
> not the addressee or if this message was sent to you by mistake, you are 
> requested to inform the sender and delete the message. TNO accepts no 
> liability for the content of this e-mail, for the manner in which you use it 
> and for damage of any kind resulting from the risks inherent to the 
> electronic transmission of messages.
>  
>  
>  
>  
> Van: [email protected] <mailto:[email protected]> 
> <[email protected]> <mailto:[email protected]> 
> Namens Holger Knublauch
> Verzonden: Tuesday, March 10, 2020 11:11 PM
> Aan: [email protected] <mailto:[email protected]>
> Onderwerp: Re: [topbraid-users] shacl-rep?
>  
> Hi Michel,
> 
> I am attaching a solution that should work for the general case. It defines a 
> NodeShape that has owl:AllDifferent as its target class, and then does 
> pairwise comparison of all mentioned classes, and then reports instances that 
> have multiple of those types:
> 
> <image002.png>
> 
> on 
> 
> alldifferent:AllDifferent1
>   rdf:type owl:AllDifferent ;
>   rdfs:label "All different1" ;
>   owl:members (
>       schema:Person
>       schema:Product
>       schema:Event
>     ) .
> 
> and sample instance
> 
> alldifferent:CarPerson
>   rdf:type schema:Person ;
>   rdf:type schema:Vehicle ;
>   rdfs:label "Car Person" .
> 
> The main shape is
> 
> 
> alldifferent:AllDifferentShape
>   rdf:type sh:NodeShape ;
>   rdfs:label "All different shape" ;
>   sh:sparql [
>       sh:message "{?class1} and {?class2} cannot share instances but {?value} 
> has types {?type1} and {?type2}" ;
>       sh:prefixes <http://example.org/alldifferent> 
> <http://example.org/alldifferent> ;
>       sh:select """SELECT $this ?class1 ?class2 (?instance AS ?value) ?type1 
> ?type2
> WHERE {
>     {
>         $this owl:members ?membersList .
>         # Go through all combinations
>         ?members rdf:rest*/rdf:first ?class1 .
>         ?members rdf:rest*/rdf:first ?class2 .
>         FILTER (?class1 != ?class2) .
>         FILTER (str(?class1) < str(?class2)) # Avoid duplicates in both 
> directions
>     }
>     ?type1 rdfs:subClassOf* ?class1 .
>     ?instance a ?type1 .
>     ?instance a ?type2 .
>     ?type2 rdfs:subClassOf* ?class2 .
> }""" ;
>     ] ;
>   sh:targetClass owl:AllDifferent ;
> .
> 
> This solution simply reuses the OWL vocabulary, so you don't need to change 
> your model. Any similar solution would need to introduce another vocabulary, 
> so for those who don't want to reuse owl:AllDifferent here, just make up your 
> own instance vocabulary.
> 
> HTH
> 
> Holger
> 
>  
> 
> On 10/03/2020 18:44, 'Bohms, H.M. (Michel)' via TopBraid Suite Users wrote:
> Hi Holger
>  
> Would this become a global PropertyShape then?
>  
> For the smls upper ontology itself it holds but in general not for the 
> userdefined ontologies importing smls.
> (which will have subclasses for say PhysicalObject that are non-disjunst).
>  
> Thx Michel
>  
>  
>  
> Dr. ir. H.M. (Michel) Böhms
> Senior Data Scientist
> 
> 
> 
> T +31888663107
> M +31630381220
> E [email protected] <mailto:[email protected]>    
> Location 
> <https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707>
> 
>  
> <image001.gif> <http://www.tno.nl/>
> This message may contain information that is not intended for you. If you are 
> not the addressee or if this message was sent to you by mistake, you are 
> requested to inform the sender and delete the message. TNO accepts no 
> liability for the content of this e-mail, for the manner in which you use it 
> and for damage of any kind resulting from the risks inherent to the 
> electronic transmission of messages.
>  
>  
>  
>  
> Van: [email protected] <mailto:[email protected]> 
> <[email protected]> <mailto:[email protected]> 
> Namens Holger Knublauch
> Verzonden: Monday, March 9, 2020 11:36 PM
> Aan: [email protected] <mailto:[email protected]>
> Onderwerp: Re: [topbraid-users] shacl-rep?
>  
> Can any of them have multiple types at all? If not, just set sh:maxCount 1 at 
> rdf:type.
> 
> As Irene indicated the scenario wasn't deemed important enough by the SHACL 
> WG to include a built-in constraint type into the core language. However, it 
> would be possible to define a custom constraint component in SHACL-SPARQL.
> 
> Holger
> 
>  
> 
> On 10/03/2020 04:55, 'Bohms, H.M. (Michel)' via TopBraid Suite Users wrote:
> Is there a shacl counterpart for:
> [
>   a owl:AllDisjointClasses ;
>   owl:members (
>       smls:PhysicalObject
>       smls:InformationObject
>       smls:State
>       smls:Event
>       smls:TemporalRegion
>       smls:SpatialRegion
>       smls:Activity
>     ) ;
> ].
>  
> Thx Michel
>  
>  
>  
>  
>  
> Dr. ir. H.M. (Michel) Böhms
> Senior Data Scientist
> 
> 
> 
> 
> T +31888663107
> M +31630381220
> E [email protected] <mailto:[email protected]>    
> Location 
> <https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707>
> 
>  
> <image001.gif> <http://www.tno.nl/>
> This message may contain information that is not intended for you. If you are 
> not the addressee or if this message was sent to you by mistake, you are 
> requested to inform the sender and delete the message. TNO accepts no 
> liability for the content of this e-mail, for the manner in which you use it 
> and for damage of any kind resulting from the risks inherent to the 
> electronic transmission of messages.
>  
>  
>  
>  
> -- 
> 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/32830e3367084dfbabe6fc80390c3962%40tno.nl
>  
> <https://groups.google.com/d/msgid/topbraid-users/32830e3367084dfbabe6fc80390c3962%40tno.nl?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/05a8285a-0491-0057-63e9-42fd4c1f245b%40topquadrant.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/05a8285a-0491-0057-63e9-42fd4c1f245b%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/70f21a2c16a847a88361cf890bacc73e%40tno.nl
>  
> <https://groups.google.com/d/msgid/topbraid-users/70f21a2c16a847a88361cf890bacc73e%40tno.nl?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/75d31960-9bb6-129b-cdbf-1a40701118a4%40topquadrant.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/75d31960-9bb6-129b-cdbf-1a40701118a4%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/f7b248a9676d413caa56a13dfa37d219%40tno.nl
>  
> <https://groups.google.com/d/msgid/topbraid-users/f7b248a9676d413caa56a13dfa37d219%40tno.nl?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/deba74f0-7d8c-5ed6-99a4-99419291d5e5%40topquadrant.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/deba74f0-7d8c-5ed6-99a4-99419291d5e5%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/3321adc8b15e4cc391acdc3c0b23afa8%40tno.nl
>  
> <https://groups.google.com/d/msgid/topbraid-users/3321adc8b15e4cc391acdc3c0b23afa8%40tno.nl?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/15F69A4B-777D-4172-B9BB-0B72D17492F9%40topquadrant.com.

Reply via email to