It would need to be a new property shape since it is on the inverse path. The 
one you have right now is for ex:exact_code itself.

If this property always has instances of ex:HwcvConcept as values, then the 
simplest approach is to attach the new property shape to the ex:HwcvConcept 
e.g.,

ex:HwcvConcept
      sh:property ex:HwcvConcept-inv-exact_code.

ex:HwcvConcept-inv-exact_code a sh:PropertyShape;
      sh:path [ sh:inversePath ex:exact_code ] ;
      sh:maxCount 1 .

Alternatively, you could also do a property shape that is not attached to a 
node shape and carries its own target which is what the e-mail suggested.

    ex:UniqueExactCodeShape
      a sh:PropertyShape ;
      sh:targetObjectsOf ex:exact_code ;
      sh:path [ sh:inversePath ex:exact_code ] ;
      sh:maxCount 1 .

> On Feb 3, 2020, at 3:02 PM, [email protected] wrote:
> 
> Holger,
> 
> Thanks for your advice here. I've tried out what you suggested, but I'm 
> having trouble getting the desired results. I'm sure that I am doing 
> something wrong.
> 
> To get more specific about my use case: I want to say that each instance of 
> ex:Code can be the object of ex:exact_code for at most one instance of 
> ex:HwcvConcept, but there should be no restrictions on the number of objects 
> that ex:exact_code may have for any given instance of ex:HwcvConcept.
> 
> Both ex:Code and ex:HwcvConcept are already NodeShapes, and a property shape 
> called ex:HwcvConcept-exact_code has already been defined as well. To which 
> of these shapes would I need to add the constraints you suggest -- or would 
> they need to be added to an entirely new shape?
> 
> I could also add sh:severity and a sh:message to this shape, right?
> 
> thanks,
> Carl
> 
> 
> On Saturday, January 25, 2020 at 3:44:03 PM UTC-8, Holger Knublauch wrote:
> Hi Carl,
> 
> here is a design pattern for this:
> 
>     ex:UniqueValueShape
>       a sh:PropertyShape ;
>       sh:targetObjectsOf ex:property ;
>       sh:path [ sh:inversePath ex:property ] ;
>       sh:maxCount 1 .
> 
> The above applies to all values of ex:property, i.e. the distinct objects of 
> triples that have ex:property as predicate. It reports a violation if for any 
> of those target nodes, when you walk ex:property in the inverse direction, 
> there are more than one value nodes (i.e. the subjects of the inverse 
> triples).
> 
> (Above the property shape itself carries the target statement, but it would 
> of course also work via a NodeShape that has the property shape via 
> sh:property).
> 
> HTH
> Holger
> 
> 
> 
> On 24/01/2020 10:59, [email protected] <> wrote:
>> What if I wanted to create a constraint (in SHACL, perhaps) specifying that 
>> two concepts may not share the same object for a particular property? I 
>> would want a warning to be raised when a user attempts to save a concept 
>> containing the triple
>> 
>> ex:ConceptX ex:property ex:ConceptY
>> 
>> if somewhere else in the vocabulary there already exists the triple
>> 
>> ex:ConceptZ ex:property ex:ConceptY 
>> 
>> It occurs to me that such a rule is already enforced for the skos:prefLabel 
>> property in EDG, but I don't know how this is being done "under the hood." 
>> Can anyone advise how to create a similar constraint? Thanks.
>> -- 
>> 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/7a0925ed-ea55-405a-8e10-9f45677bfdcb%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/7a0925ed-ea55-405a-8e10-9f45677bfdcb%40googlegroups.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/f9c26431-d16f-4893-9d05-17a7f10663b0%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/f9c26431-d16f-4893-9d05-17a7f10663b0%40googlegroups.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/90EB57AF-DC3E-4764-9506-4C02BF76745F%40topquadrant.com.

Reply via email to