Hi Holger, I had not tried sh:qualifiedValueShape. After adding three sh:property statements for the st:owns property, it worked mostly as expected. I added a fourth property shape to ensure that st:owns has only instances of the three classes as the object. Otherwise, once the three qualifiedValueShapes were satisfied, I could add anything using st:owns without a violation.
Now I've hit another wrinkle, I need the validation of
st:Entertainment_Holding_Company to be recursive, meaning that all values
upon which st:Entertainment_Holding_Company is dependent must also be
valid, even if they are two, three, or more hops away in the graph. I.e.
The graph pattern I'm defining is not just a single instance and its
nearest neighbors. Thus, it's not sufficient to say:
sh:qualifiedValueShape [
sh:class st:Streaming_Company ;
] ;
I need to be able to trigger the validation of the st:Streaming_Company
instance such that if that instance is invalid, the
st:Entertainment_Holding_Company instance is also flagged as invalid. In
other contexts, I have been able to use sh:node in place of sh:class in
order to get this recursive validation behavior.
sh:qualifiedValueShape [
sh:node st:Streaming_Company ;
] ;
However, in this case, using TBC/ME 7.02, changing one of the three
property shapes to sh:node generates violations for the other two property
shapes. Changing all three generates a violation for all three qualified
property shapes. Example below. Is this the expected behavior? Is it
possible to get recursive validation to enable validation of "large" graph
patterns? This is a key capability to being able to evaluate SysML models
for completeness and accuracy. Example RDF file attached (with sh:node in
the property shapes).
Thanks for your input,
Tim
[image: image.png]
On Fri, Jul 2, 2021 at 6:59 PM Holger Knublauch <[email protected]>
wrote:
> Hi Tim,
>
> have you tried
> https://www.w3.org/TR/shacl/#QualifiedValueShapeConstraintComponent with
> min count and max count 1 and sh:class? You need three property shapes on
> the same property.
>
> Holger
>
>
> On 3/07/2021 7:51 am, Tim Smith wrote:
>
> Hi,
>
> I have a need to model this constraint in SHACL:
>
> *An Entertainment Holding Company must own one and only one instance of
> EACH of the following classes: Movie Company, Racing Company, and Streaming
> Company in order to be a valid instance of Entertainment Holding Company.*
>
> This is an example of a valid instance:
>
> [image: image.png]
> Any more or less than 3 st:owns triples or more or less than 1 instance of
> the three classes listed above should be a violation.
>
> I have tried numerous ways to model this behavior without success. SHACL
> seems to iterate through each object of the st:owns property where I'm
> making a statement about the set of st:owns objects. I encounter this type
> of problem frequently so I'm hoping there is a pattern I can apply as a
> generic solution. Something like sh:and but where sh:and would look across
> all objects of sh:path.
>
> Am I missing something simple? The one solution that I know works is the
> one that I cannot use - creating a new property and property shape for each
> class e.g. st:ownsMovieCompany. If this is the only solution, then I can
> never use a "generic" property like "owns", "category", etc.... This will
> result in a property explosion and would rapidly become unworkable
> in industry-sized models.
>
> Thanks 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/CAF0WbnKXEb%2BArirQXCq9w5ZH-Y7b%3DX7apZge%2BU_UxCnFVznxPw%40mail.gmail.com
> <https://groups.google.com/d/msgid/topbraid-users/CAF0WbnKXEb%2BArirQXCq9w5ZH-Y7b%3DX7apZge%2BU_UxCnFVznxPw%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/bd4c0653-340d-f188-bf20-95582b4656f6%40topquadrant.com
> <https://groups.google.com/d/msgid/topbraid-users/bd4c0653-340d-f188-bf20-95582b4656f6%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/CAF0Wbn%2ByHvjQgEMmshwqNgG4Bt-Fn1_0SfTJJhDmPUSDyJQD1Q%40mail.gmail.com.
SHACL_test.shapes.ttl
Description: Binary data
