Add new optional constraints for Consent/Birthdate existence and RDF type uniqueness
constraints:sphnBirthDate_Existence a sh:NodeShape ;
sh:property [ sh:message "At least one instance of sphn:BirthDate is required" ;
sh:minCount 1 ;
sh:path [ sh:inversePath rdf:type ] ] ;
sh:targetNode sphn:BirthDate .
constraints:sphnConsent_Existence a sh:NodeShape ;
sh:property [ sh:message "At least one instance of sphn:Consent is required" ;
sh:minCount 1 ;
sh:path [ sh:inversePath rdf:type ] ] ;
sh:targetNode sphn:Consent .
constraints:sphnAccessDevice_UniqueRDFType a sh:NodeShape ;
sh:property [ sh:maxCount 1 ;
sh:message "sphn:AccessDevice instance is defined with multiple types" ;
sh:minCount 1 ;
sh:path rdf:type ] ;
sh:targetClass sphn:AccessDevice .
constraints:sphnMedicalDevice_UniqueRDFType a sh:NodeShape ;
sh:property [ sh:maxCount 1 ;
sh:message "sphn:MedicalDevice instance is defined with multiple types" ;
sh:minCount 1 ;
sh:path rdf:type ] ;
sh:target [ a sh:SPARQLTarget ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-schema/sphn#>
SELECT ?this
WHERE {
?this rdf:type sphn:MedicalDevice .
MINUS {
?this rdf:type sphn:MedicalDevice .
?this rdf:type ?other_type .
FILTER (?other_type != sphn:MedicalDevice )
?this rdfs:subClassOf+ sphn:MedicalDevice .
}
}""" ] .
...
Example of SHACL file with all options activated:
Edited by Nicola Stoira