diff --git a/tests/examples/dictionary_PASS_validation.ttl b/tests/examples/dictionary_PASS_validation.ttl index b00c4ad5..f563abc0 100644 --- a/tests/examples/dictionary_PASS_validation.ttl +++ b/tests/examples/dictionary_PASS_validation.ttl @@ -8,95 +8,39 @@ [] a sh:ValidationReport ; sh:conforms "true"^^xsd:boolean ; - sh:result - [ - a sh:ValidationResult ; - sh:focusNode ; - sh:resultMessage "A key in a dictionary can appear no more than once." ; - sh:resultSeverity sh:Warning ; - sh:sourceConstraint [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { + sh:result [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + FILTER NOT EXISTS { $this - types:entry/types:key ?value ; + a types:ImproperDictionary ; . } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; - sh:sourceShape [ - a sh:NodeShape ; - rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:severity sh:Warning ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { - $this - types:entry/types:key ?value ; - . - } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:targetClass types:Dictionary ; - ] ; - sh:value "x" ; - ] , - [ - a sh:ValidationResult ; - sh:focusNode ; - sh:resultMessage "A key in a dictionary can appear no more than once." ; - sh:resultSeverity sh:Warning ; - sh:sourceConstraint [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { - $this - types:entry/types:key ?value ; - . - } - GROUP BY ?value - HAVING (COUNT(?value) > 1) - """ ; - ] ; - sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; - sh:sourceShape [ - a sh:NodeShape ; - rdfs:comment "This anonymous shape is attached to types:Dictionary with rdfs:seeAlso in order to associate a warning-severity SPARQL-based shape, that will only be necessary as an independent shape until UCO 2.0.0."@en ; - sh:severity sh:Warning ; - sh:sparql [ - a sh:SPARQLConstraint ; - sh:message "A key in a dictionary can appear no more than once."@en ; - sh:select """ - PREFIX types: - SELECT $this ?value - WHERE { + FILTER NOT EXISTS { $this - types:entry/types:key ?value ; + a types:ProperDictionary ; . } - GROUP BY ?value - HAVING (COUNT(?value) > 1) + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) """ ; - ] ; - sh:targetClass types:Dictionary ; - ] ; - sh:value "x" ; - ] - ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:Dictionary-keyUniqueness-shape ; + sh:value "x" ; + ] ; . diff --git a/tests/examples/dictionary_XFAIL_validation.ttl b/tests/examples/dictionary_XFAIL_validation.ttl new file mode 100644 index 00000000..f15a7580 --- /dev/null +++ b/tests/examples/dictionary_XFAIL_validation.ttl @@ -0,0 +1,141 @@ +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix types: . +@prefix xsd: . + +[] + a sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property." ; + sh:resultSeverity sh:Warning ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a dictionary should appear no more than once. The value literal does. Please consider using the types:ImproperDictionary class and types:repeatsKey property."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + FILTER NOT EXISTS { + $this + a types:ImproperDictionary ; + . + } + FILTER NOT EXISTS { + $this + a types:ProperDictionary ; + . + } + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:Dictionary-keyUniqueness-shape ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "types:ImproperDictionary and types:ProperDictionary are disjoint classes."@en ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:NotConstraintComponent ; + sh:sourceShape types:ImproperDictionary-disjointWith-ProperDictionary-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a proper dictionary can appear no more than once." ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a proper dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:ProperDictionary ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "A key in a proper dictionary can appear no more than once." ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraint [ + a sh:SPARQLConstraint ; + sh:message "A key in a proper dictionary can appear no more than once."@en ; + sh:select """ + PREFIX types: + SELECT $this ?value + WHERE { + $this + types:entry/types:key ?value ; + . + } + GROUP BY ?value + HAVING (COUNT(?value) > 1) + """ ; + ] ; + sh:sourceConstraintComponent sh:SPARQLConstraintComponent ; + sh:sourceShape types:ProperDictionary ; + sh:value "x" ; + ] , + [ + a sh:ValidationResult ; + sh:focusNode ; + sh:resultMessage "Value does not have class types:ImproperDictionary" ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape types:repeatsKey-subjects-shape ; + sh:value ; + ] + ; + . +