Closed tpluscode closed 3 years ago
@prefix sh: <http://www.w3.org/ns/shacl#> . @prefix schema: <http://schema.org/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.com/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix dash: <http://datashapes.org/dash#> . ex:PersonShape a sh:Shape ; sh:targetClass schema:Person ; rdfs:label "Person" ; sh:xone ( [ rdfs:label "Full name" ; sh:property [ sh:name "Full name" ; sh:path ex:fullName ; # sh:minCount 1 ; sh:maxCount 1 ; ] ] [ rdfs:label "First & last name" ; sh:property [ sh:name "First name"; sh:path ex:firstName ; # sh:minCount 1 ; sh:maxCount 1 ; ] , [ sh:name "Last name" ; sh:path ex:lastName ; # sh:minCount 1 ; sh:maxCount 1 ; ] ] ) ; .
{ "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "xsd": "http://www.w3.org/2001/XMLSchema#", "schema": "http://schema.org/", "foaf": "http://xmlns.com/foaf/0.1/", "vcard": "http://www.w3.org/2006/vcard/ns#" }, "@id": "http://example.com/John_Doe", "@type": "schema:Person", "http://example.com/fullName": "John Doe" }
The data should be valid.
A violation is reported by sh:XoneConstraintComponent. It goes away when sh:minCount is uncommented
sh:XoneConstraintComponent
sh:minCount
See this reply by @HolgerKnublauch and this exact example in Shaperone playground
Oh wait, maybe this is correct after all. 🤦
This is exactly what Holger wrote
Having no sh:minCount means that both branches will always be satisfied
which is exactly the Xone violation
Can I close this?
shapes graph
data graph
expected behaviour
The data should be valid.
actual behaviour
A violation is reported by
sh:XoneConstraintComponent
. It goes away whensh:minCount
is uncommentedother
See this reply by @HolgerKnublauch and this exact example in Shaperone playground