It’s far simpler to make an abstract superclass of the two classes of interest. Everything mentioned works out-of-the-box and avoid Source Code SHACL editing, etc.
Cheers, David > On 1 Aug 2022, at 16:21, Tim Smith <[email protected]> wrote: > > Hi, > > I have three classes: > > Consumer Unit > Inner Pack > Case. > > I need a property constraint on Case, using the property ex:contains (an > Object Property), to say: > > Case ex:contains one or more (Consumer Unit OR Inner Pack) instances. > > Following the example found at sh:or > <https://www.w3.org/TR/shacl/#OrConstraintComponent>, I created the following: > > ex:Case > a owl:Class ; > a sh:NodeShape ; > rdfs:label "Case" ; > rdfs:subClassOf owl:Thing ; > sh:property ex:Case-contains ; > . > ex:Case-contains > a sh:PropertyShape ; > sh:path ex:contains ; > sh:group ex:ExamplePropertyGroup ; > sh:minCount 1 ; > sh:name "contains" ; > sh:or ( > [ > sh:class ex:InnerPack ; > ] > [ > sh:class ex:ConsumerUnit ; > ] > ) ; > . > > When creating an instance of Case, I thought I would see only instances of > InnerPack or ConsumerUnit in the auto-complete. However, I am seeing > everything - instances and classes, etc. If I select something other than > InnerPack or ConsumerUnit, I will see a SHACL constraint violation indicating > the selection is not a valid shape so it is reading the constraint. > > In addition, there is no "+" sign for the creation of new instances - should > there be? It would be helpful. Navigating back to Inner Pack to create a > new instance is a lot of clicks, especially if Inner Pack needs to be in a > different asset collection as happens frequently when using the EDG > ontologies. > > And finally, placing the class, Case, on an EDG Diagram and using the "Expand > Associations" option, Level 1 or Level 2, does not display anything. If I > expand the sh:property relationship manually, I will see the property shape > but the sh:or(sh:class) statements are ignored. > > What is the expected behavior? What do I need to do to limit the instances > the user sees to the evaluation of the sh:or? It is also important that the > sh:or relationship and target classes are visible on an EDG Diagram otherwise > a user cannot see the ontology graphically. > > Attached is a zip export of the example ontology and data graph that depicts > the above. I'm using EDG 7.3. > > Thank you in advance for your input, > > Tim > > > -- > 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/b6dcb60e-4f3a-4296-99f9-2a0bacd14120n%40googlegroups.com > > <https://groups.google.com/d/msgid/topbraid-users/b6dcb60e-4f3a-4296-99f9-2a0bacd14120n%40googlegroups.com?utm_medium=email&utm_source=footer>. > <sh_or_shape_test.zip> 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/EB1B9C97-631F-4F0B-8840-90B75E83635E%40topquadrant.com.
