Update rules
QC rules updated. We now have one rule per violation.
- Code meaning change of unversioned code: checking the existence of
sphn:hasMeaningChangeInHistorization
. If it's there we report it's value as?value
- Versioned code has been valid before: checking
?type sphn:hasMeaningValidityInCurrent ?validity .
and filtering byFILTER(?validity = false)
. Assumption here is that if this is set to false, we are not considering the 2023 code (latest versioned code). - Versioned code which is old but still valid: we extract the following properties:
?type sphn:hasMeaningValidityInCurrent ?validity .
andOPTIONAL {?type sphn:isCurrent ?isCurrent . }
and then we filter for validity true and either the isCurrent is not bound or it is not true:FILTER(?validity = true && (!BOUND(?isCurrent) || ?isCurrent != true))
Full constraints:
constraints:OldVersionedCodeHasBeenValid a sh:NodeShape ;
sh:severity sh:Info ;
sh:sparql [ a sh:SPARQLConstraint ;
sh:message "The versioned code is not valid anymore due to code meaning change." ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
SELECT ?this (rdf:type as ?path) (?type as ?value)
WHERE {
?this rdf:type ?type .
}""" ] ;
sh:target [ a sh:SPARQLTarget ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?this
WHERE {
?this rdf:type ?type .
?type sphn:hasMeaningValidityInCurrent ?validity .
FILTER(?validity = false)
}""" ] .
constraints:OldVersionedCodeStillValid a sh:NodeShape ;
sh:severity sh:Info ;
sh:sparql [ a sh:SPARQLConstraint ;
sh:message "The versioned code is old but still valid" ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
SELECT ?this (rdf:type as ?path) (?type as ?value)
WHERE {
?this rdf:type ?type .
}""" ] ;
sh:target [ a sh:SPARQLTarget ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?this
WHERE {
?this rdf:type ?type .
?type sphn:hasMeaningValidityInCurrent ?validity .
OPTIONAL {?type sphn:isCurrent ?isCurrent . }
FILTER(?validity = true && (!BOUND(?isCurrent) || ?isCurrent != true))
}""" ] .
constraints:UnversionedCodeHasMeaningChange a sh:NodeShape ;
sh:severity sh:Warning ;
sh:sparql [ a sh:SPARQLConstraint ;
sh:message "The unversioned code you are using has changed its meaning during the time. Please consider using a versioned code." ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
SELECT ?this (rdf:type as ?path) (STR(?codeChange) as ?value)
WHERE {
?this rdf:type ?type .
?type sphn:hasMeaningChangeInHistorization ?codeChange .
}""" ] ;
sh:target [ a sh:SPARQLTarget ;
sh:select """PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sphn: <https://biomedit.ch/rdf/sphn-ontology/sphn#>
SELECT ?this
WHERE {
?this rdf:type ?type .
?type sphn:hasMeaningChangeInHistorization ?codeChange .
}""" ] .
Edited by Nicola Stoira