On 10/12/2020 13:03, Florian Kleedorfer wrote:
Hi,
I am not aware of anything in the SHACL specs discouraging cycles in
shapes, but the jena SHACL parser warns about it:
10.12.20 13:53:11.460 [main] WARN SHACL - Cycle detected : node
<https://example.com/test/PersonShape>
for this minimal example:
@prefix ex: <https://example.com/test/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
ex:PersonShape
a sh:NodeShape;
sh:targetClass ex:Person ;
sh:property [ sh:path ex:mother ;
sh:node ex:PersonShape ] .
ex:alice a ex:Person .
ex:bob a ex:Person ;
ex:mother ex:alice .
Is that intended behaviour?
There are two ways to get to the same data objects.
Via the sh:targetClass and also via the path from another ex:PersonShape
-- you'll get two violations.
Did you mean:
sh:property [ sh:path ex:mother ;
sh:class ex:PersonShape ] .
^^^^^^^^
because pointing (sh:node) to the shape is also picking up the target.
You'll still get validation of ex:mother-ex:mother-ex:mother because the
target will trigger on each person.
You can sh:node to a common shape but if that is for reuse of common
patterns, then don't give that shape a target.
Andy
(See also discussion about cycles on the [email protected]
mailing list)
Does that mean we should try to get rid of
any cycles?
Or, alternatively, could we lower the loglevel on this one?
Cheers,
Florian