I want to implement a constraint "Each SKOS Concept must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme". I have 2 problems:
shaclc doesn't have xone so I have to use OR (|)
as far as I can see:
nodeOr resolves only to nodeValue (nodeParam=iriOrLiteralOrArray)
propertyOr resolves to propertyAtom and then nodeShapeBody but by that time you've already made one path...
The best I can come up with is this:
shape nomShape:concept {
skos:topConceptOf|skos:broader hasValue=nom:|@nomShape:parentConcept
message="Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme"
[1..1].
}
The first | is an alternative prop path, and the second | is propertyOr.
So this says "Each concept must have topConceptOf or broader, and the value must be either the nom: scheme, or satisfy nomShape:parentConcept", and is correctly translated to this SHACL:
sh:property [ sh:maxCount 1 ;
sh:message "Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme" ;
sh:minCount 1 ;
sh:or ( [ sh:hasValue nom: ]
[ sh:node nomShape:parentConcept ]
) ;
sh:path [ sh:alternativePath ( skos:topConceptOf skos:broader ) ]
] ;
But it doesn't preclude the mixed-up variants skos:broader nom: or skos:topConceptOf <parentConcept>.
What I want is shaclc grammar that can produce this shacl:
sh:message "Concepts must either have skos:topConcept pointing to the nom: scheme, or have a parent that's in the same scheme" ;
sh:or (
[sh:property [sh:path skos:topConceptOf; sh:maxCount 1; sh:minCount 1; sh:hasValue nom: ]]
[sh:property [sh:path skos:broader; sh:maxCount 1; sh:minCount 1; sh:node nomShape:parentConcept]]);
SHACLC support has been deleted from this TopBraid SHACL API because Jena already supports it. I suggest you create a new ticket on https://github.com/w3c/shacl/issues
I want to implement a constraint "Each SKOS Concept must either have skos:topConcept pointing to the
nom:
scheme, or have a parent that's in the same scheme". I have 2 problems:xone
so I have to use OR (|
)nodeValue
(nodeParam=iriOrLiteralOrArray
)propertyAtom
and thennodeShapeBody
but by that time you've already made onepath
...The best I can come up with is this:
The first
|
is an alternative prop path, and the second|
ispropertyOr
. So this says "Each concept must have topConceptOf or broader, and the value must be either the nom: scheme, or satisfy nomShape:parentConcept", and is correctly translated to this SHACL:But it doesn't preclude the mixed-up variants
skos:broader nom:
orskos:topConceptOf <parentConcept>
.What I want is shaclc grammar that can produce this shacl:
@HolgerKnublauch Can you help?