I forgot one detail, which is that I have a subClassOf hierarchy under Device, and the instances of any of those subClasses do not seem to validate against the Connectable shape. Does sh:node traverse the subClassOf hierarchy of the sh:targetClass values?
Steve On Wed, Jun 23, 2021 at 11:47 AM Irene Polikoff <[email protected]> wrote: > What behaviour did you expect? > > Since Connectable is just a shape and does not have any instances, then > you can’t use it in sh:class. This constraint says that the value must be > an instance of Connectable, which will always be wrong. > > When you say sh:node s223:Connectable, it means that values should > validate against the constraints defined for Connectable. For this scenario > targets associated with Connectable are ignored since the constraint is > already targeting - all values of s223:connectedFrom that belong to members > of SomeOtherClass will be validated against the shape. > > All instances of Device, DomainSpace and Sensor will also be validated > against the Connectable shape - because of the target statements. > > https://www.w3.org/TR/shacl/#NodeConstraintComponent > > https://www.w3.org/TR/shacl/#focusNodes > > On Jun 23, 2021, at 1:19 PM, Steve Ray <[email protected]> wrote: > > The discussion you have been having regarding sh:targetClass reminds me of > a problem I am having, as follows. > > I'm defining an abstract "mixin" shape, Connectable, that has various > properties used by a number of target classes. I do not want to allow > instantiation of Connectable, so I defined it only as a NodeShape, but not > an owl:Class. (I cannot use the dash:abstract property without stepping > outside strict SHACL). Then, I need other classes to have the equivalent of > a sh:class constraint on properties that point to instances of all those > target classes. I assume I cannot use sh:class as in the example below, > since Connectable is not a class. I tried sh:node, since the documentation > implies that's what I need, but I'm not getting the expected behavior. > > Am I misunderstanding the use of sh:node? > > s223:Connectable > a sh:NodeShape ; > ...various properties > sh:targetClass s223:Device ; > sh:targetClass s223:DomainSpace ; > sh:targetClass s223:Sensor ; > . > > s223:Device > a owl:Class ; > a sh:NodeShape ; > ... > . > > # Presumed invalid case > s223:SomeOtherClass > a owl:Class ; > a sh:NodeShape ; > sh:property [ > sh:path s223:connectsFrom ; > sh:class s223:Connectable ; > ... > > #Expected valid case > s223:SomeOtherClass > a owl:Class ; > a sh:NodeShape ; > sh:property [ > sh:path s223:connectsFrom ; > sh:node s223:Connectable ; > ... > > > Steve > > > > -- > 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/CAGUep86aRz_enWzvhfMkT5pW0SvNA3XYdbdB%2BAsSXP%3DfEFAusQ%40mail.gmail.com > <https://groups.google.com/d/msgid/topbraid-users/CAGUep86aRz_enWzvhfMkT5pW0SvNA3XYdbdB%2BAsSXP%3DfEFAusQ%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/3A11B544-71EA-48BD-B068-0BA71EBD5E1D%40topquadrant.com > <https://groups.google.com/d/msgid/topbraid-users/3A11B544-71EA-48BD-B068-0BA71EBD5E1D%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]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep86S_teBHHHDmhb13U1sQ4ctx197%3D2LLb60p8BtwiRK69A%40mail.gmail.com.
