From e320bb53e58314fb2f04d514fc68202efcb52f3e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 14 Oct 2018 22:18:17 +0200 Subject: Add validation test suite --- tests/validate/bad-all-values-from.ttl | 18 +++ tests/validate/bad-cardinality-high.ttl | 18 +++ tests/validate/bad-cardinality-low.ttl | 16 ++ tests/validate/bad-cardinality.ttl | 18 +++ tests/validate/bad-datatype-property.ttl | 18 +++ tests/validate/bad-domain.ttl | 19 +++ tests/validate/bad-functional-property.ttl | 13 ++ tests/validate/bad-inverse-functional-property.ttl | 15 ++ tests/validate/bad-literal-pattern.ttl | 7 + .../validate/bad-literal-value-high-exclusive.ttl | 18 +++ .../validate/bad-literal-value-high-inclusive.ttl | 18 +++ tests/validate/bad-literal-value-low-exclusive.ttl | 18 +++ tests/validate/bad-literal-value-low-inclusive.ttl | 19 +++ tests/validate/bad-object-property.ttl | 12 ++ tests/validate/bad-pattern.ttl | 21 +++ tests/validate/bad-plain-literal.ttl | 12 ++ tests/validate/bad-range-instance-not-literal.ttl | 18 +++ tests/validate/bad-range-instance.ttl | 21 +++ tests/validate/bad-range-literal-not-instance.ttl | 15 ++ tests/validate/bad-range-literal.ttl | 25 ++++ tests/validate/bad-some-values-from.ttl | 18 +++ tests/validate/bad-string-literal-value-high.ttl | 19 +++ tests/validate/bad-string-literal-value-low.ttl | 19 +++ tests/validate/bad-unknown-datatype.ttl | 6 + tests/validate/bad-unknown-property.ttl | 6 + tests/validate/manifest.ttl | 165 +++++++++++++++++++++ 26 files changed, 572 insertions(+) create mode 100644 tests/validate/bad-all-values-from.ttl create mode 100644 tests/validate/bad-cardinality-high.ttl create mode 100644 tests/validate/bad-cardinality-low.ttl create mode 100644 tests/validate/bad-cardinality.ttl create mode 100644 tests/validate/bad-datatype-property.ttl create mode 100644 tests/validate/bad-domain.ttl create mode 100644 tests/validate/bad-functional-property.ttl create mode 100644 tests/validate/bad-inverse-functional-property.ttl create mode 100644 tests/validate/bad-literal-pattern.ttl create mode 100644 tests/validate/bad-literal-value-high-exclusive.ttl create mode 100644 tests/validate/bad-literal-value-high-inclusive.ttl create mode 100644 tests/validate/bad-literal-value-low-exclusive.ttl create mode 100644 tests/validate/bad-literal-value-low-inclusive.ttl create mode 100644 tests/validate/bad-object-property.ttl create mode 100644 tests/validate/bad-pattern.ttl create mode 100644 tests/validate/bad-plain-literal.ttl create mode 100644 tests/validate/bad-range-instance-not-literal.ttl create mode 100644 tests/validate/bad-range-instance.ttl create mode 100644 tests/validate/bad-range-literal-not-instance.ttl create mode 100644 tests/validate/bad-range-literal.ttl create mode 100644 tests/validate/bad-some-values-from.ttl create mode 100644 tests/validate/bad-string-literal-value-high.ttl create mode 100644 tests/validate/bad-string-literal-value-low.ttl create mode 100644 tests/validate/bad-unknown-datatype.ttl create mode 100644 tests/validate/bad-unknown-property.ttl create mode 100644 tests/validate/manifest.ttl (limited to 'tests/validate') diff --git a/tests/validate/bad-all-values-from.ttl b/tests/validate/bad-all-values-from.ttl new file mode 100644 index 00000000..e8243423 --- /dev/null +++ b/tests/validate/bad-all-values-from.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdfs:label ; + owl:allValuesFrom rdf:PlainLiteral + ] . + +eg:s + a eg:Thing ; + rdfs:label "plain" , + "not plain"^^rdf:XMLLiteral . + diff --git a/tests/validate/bad-cardinality-high.ttl b/tests/validate/bad-cardinality-high.ttl new file mode 100644 index 00000000..7e1605c3 --- /dev/null +++ b/tests/validate/bad-cardinality-high.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:maxCardinality 1 + ] . + +eg:s + a eg:Thing ; + rdf:value 1 , + 2 . + diff --git a/tests/validate/bad-cardinality-low.ttl b/tests/validate/bad-cardinality-low.ttl new file mode 100644 index 00000000..93dd0051 --- /dev/null +++ b/tests/validate/bad-cardinality-low.ttl @@ -0,0 +1,16 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:minCardinality 1 + ] . + +eg:s + a eg:Thing . + diff --git a/tests/validate/bad-cardinality.ttl b/tests/validate/bad-cardinality.ttl new file mode 100644 index 00000000..481fe456 --- /dev/null +++ b/tests/validate/bad-cardinality.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:cardinality 3 + ] . + +eg:s + a eg:Thing ; + rdf:value 1 , + 2 . + diff --git a/tests/validate/bad-datatype-property.ttl b/tests/validate/bad-datatype-property.ttl new file mode 100644 index 00000000..a3e993f3 --- /dev/null +++ b/tests/validate/bad-datatype-property.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:value + rdfs:label "value" ; + a owl:DatatypeProperty . + +eg:Thing + a rdfs:Class . + +eg:s1 + a eg:Thing . + +eg:s2 + eg:value eg:s1 . + diff --git a/tests/validate/bad-domain.ttl b/tests/validate/bad-domain.ttl new file mode 100644 index 00000000..d36b5652 --- /dev/null +++ b/tests/validate/bad-domain.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class . + +eg:NonThing + a rdfs:Class . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:domain eg:Thing . + +eg:nonthing + a eg:NonThing ; + eg:value 42 . + diff --git a/tests/validate/bad-functional-property.ttl b/tests/validate/bad-functional-property.ttl new file mode 100644 index 00000000..53a73ccd --- /dev/null +++ b/tests/validate/bad-functional-property.ttl @@ -0,0 +1,13 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:identity + rdfs:label "identity" ; + a owl:FunctionalProperty . + +eg:s + eg:identity "me" , + "you" . + diff --git a/tests/validate/bad-inverse-functional-property.ttl b/tests/validate/bad-inverse-functional-property.ttl new file mode 100644 index 00000000..95c0aaea --- /dev/null +++ b/tests/validate/bad-inverse-functional-property.ttl @@ -0,0 +1,15 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:identity + rdfs:label "identity" ; + a owl:InverseFunctionalProperty . + +eg:s1 + eg:identity "me" . + +eg:s2 + eg:identity "me" . + diff --git a/tests/validate/bad-literal-pattern.ttl b/tests/validate/bad-literal-pattern.ttl new file mode 100644 index 00000000..40f9eec0 --- /dev/null +++ b/tests/validate/bad-literal-pattern.ttl @@ -0,0 +1,7 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:s + rdf:value "no"^^xsd:boolean . + diff --git a/tests/validate/bad-literal-value-high-exclusive.ttl b/tests/validate/bad-literal-value-high-exclusive.ttl new file mode 100644 index 00000000..9e2bfe47 --- /dev/null +++ b/tests/validate/bad-literal-value-high-exclusive.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:Normal + a rdfs:Datatype ; + rdfs:label "normal" ; + owl:onDatatype xsd:double ; + owl:withRestrictions ( + [ + xsd:maxExclusive 1.0 + ] [ + xsd:minExclusive 0.0 + ] + ) . + +eg:s + rdf:value "1.0"^^eg:Normal . diff --git a/tests/validate/bad-literal-value-high-inclusive.ttl b/tests/validate/bad-literal-value-high-inclusive.ttl new file mode 100644 index 00000000..b58793ec --- /dev/null +++ b/tests/validate/bad-literal-value-high-inclusive.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:Normal + a rdfs:Datatype ; + rdfs:label "normal" ; + owl:onDatatype xsd:double ; + owl:withRestrictions ( + [ + xsd:maxInclusive 1.0 + ] [ + xsd:minInclusive 0.0 + ] + ) . + +eg:s + rdf:value "1.1"^^eg:Normal . diff --git a/tests/validate/bad-literal-value-low-exclusive.ttl b/tests/validate/bad-literal-value-low-exclusive.ttl new file mode 100644 index 00000000..fdcaf94a --- /dev/null +++ b/tests/validate/bad-literal-value-low-exclusive.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:Normal + a rdfs:Datatype ; + rdfs:label "normal" ; + owl:onDatatype xsd:double ; + owl:withRestrictions ( + [ + xsd:maxExclusive 1.0 + ] [ + xsd:minExclusive 0.0 + ] + ) . + +eg:s + rdf:value "0.0"^^eg:Normal . diff --git a/tests/validate/bad-literal-value-low-inclusive.ttl b/tests/validate/bad-literal-value-low-inclusive.ttl new file mode 100644 index 00000000..c88123dd --- /dev/null +++ b/tests/validate/bad-literal-value-low-inclusive.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:Normal + a rdfs:Datatype ; + rdfs:label "normal" ; + owl:onDatatype xsd:double ; + owl:withRestrictions ( + [ + xsd:maxInclusive 1.0 + ] [ + xsd:minInclusive 0.0 + ] + ) . + +eg:s + rdf:value "-0.1"^^eg:Normal . + diff --git a/tests/validate/bad-object-property.ttl b/tests/validate/bad-object-property.ttl new file mode 100644 index 00000000..b4a31f9d --- /dev/null +++ b/tests/validate/bad-object-property.ttl @@ -0,0 +1,12 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:value + rdfs:label "value" ; + a owl:ObjectProperty . + +eg:s + eg:value "literal" . + diff --git a/tests/validate/bad-pattern.ttl b/tests/validate/bad-pattern.ttl new file mode 100644 index 00000000..1c367bd2 --- /dev/null +++ b/tests/validate/bad-pattern.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:BrokenLiteral + a rdfs:Datatype ; + rdfs:label "broken literal" ; + owl:withRestrictions ( + [ + xsd:pattern "[" + ] + ) . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:BinaryLiteral . + +eg:s + eg:value "no match"^^eg:BrokenLiteral . + diff --git a/tests/validate/bad-plain-literal.ttl b/tests/validate/bad-plain-literal.ttl new file mode 100644 index 00000000..116faac0 --- /dev/null +++ b/tests/validate/bad-plain-literal.ttl @@ -0,0 +1,12 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range rdf:PlainLiteral . + +eg:s + eg:value "literal"^^rdf:XMLLiteral . + diff --git a/tests/validate/bad-range-instance-not-literal.ttl b/tests/validate/bad-range-instance-not-literal.ttl new file mode 100644 index 00000000..ea7803f6 --- /dev/null +++ b/tests/validate/bad-range-instance-not-literal.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range rdfs:Literal . + +eg:thing + a eg:Thing . + +eg:s + eg:value eg:thing . + diff --git a/tests/validate/bad-range-instance.ttl b/tests/validate/bad-range-instance.ttl new file mode 100644 index 00000000..a04a5476 --- /dev/null +++ b/tests/validate/bad-range-instance.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class . + +eg:NonThing + a rdfs:Class . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:Thing . + +eg:nonthing + a eg:NonThing . + +eg:s + eg:value eg:nonthing . + diff --git a/tests/validate/bad-range-literal-not-instance.ttl b/tests/validate/bad-range-literal-not-instance.ttl new file mode 100644 index 00000000..f46de8ce --- /dev/null +++ b/tests/validate/bad-range-literal-not-instance.ttl @@ -0,0 +1,15 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:Thing . + +eg:s + eg:value "literal" . + diff --git a/tests/validate/bad-range-literal.ttl b/tests/validate/bad-range-literal.ttl new file mode 100644 index 00000000..cbeb4074 --- /dev/null +++ b/tests/validate/bad-range-literal.ttl @@ -0,0 +1,25 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Normal + a rdfs:Datatype ; + rdfs:label "normal" ; + owl:onDatatype xsd:double ; + owl:withRestrictions ( + [ + xsd:maxExclusive 1.0 + ] [ + xsd:minExclusive 0.0 + ] + ) . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:Normal . + +eg:s + eg:value 2.0 . + + diff --git a/tests/validate/bad-some-values-from.ttl b/tests/validate/bad-some-values-from.ttl new file mode 100644 index 00000000..259bfb88 --- /dev/null +++ b/tests/validate/bad-some-values-from.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdfs:label ; + owl:someValuesFrom rdf:PlainLiteral + ] . + +eg:s + a eg:Thing ; + rdfs:label "not plain"^^rdf:XMLLiteral . + + diff --git a/tests/validate/bad-string-literal-value-high.ttl b/tests/validate/bad-string-literal-value-high.ttl new file mode 100644 index 00000000..7119e30a --- /dev/null +++ b/tests/validate/bad-string-literal-value-high.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:startsWithC + a rdfs:Datatype ; + rdfs:label "starts with C" ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( + [ + xsd:maxExclusive "D" + ] [ + xsd:minInclusive "B" + ] + ) . + +eg:s + rdf:value "Door"^^eg:startsWithC . + diff --git a/tests/validate/bad-string-literal-value-low.ttl b/tests/validate/bad-string-literal-value-low.ttl new file mode 100644 index 00000000..93c2f17e --- /dev/null +++ b/tests/validate/bad-string-literal-value-low.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:betweenBAndD + a rdfs:Datatype ; + rdfs:label "between B and D" ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( + [ + xsd:maxInclusive "D" + ] [ + xsd:minExclusive "B" + ] + ) . + +eg:s + rdf:value "Aardvark"^^eg:betweenBAndD . + diff --git a/tests/validate/bad-unknown-datatype.ttl b/tests/validate/bad-unknown-datatype.ttl new file mode 100644 index 00000000..be2fc132 --- /dev/null +++ b/tests/validate/bad-unknown-datatype.ttl @@ -0,0 +1,6 @@ +@prefix eg: . +@prefix rdfs: . + +eg:s + rdfs:label "bad datatype"^^rdf:UndefinedLiteral . + diff --git a/tests/validate/bad-unknown-property.ttl b/tests/validate/bad-unknown-property.ttl new file mode 100644 index 00000000..0db1e85c --- /dev/null +++ b/tests/validate/bad-unknown-property.ttl @@ -0,0 +1,6 @@ +@prefix eg: . +@prefix rdfs: . + +eg:s + eg:undefined 0 . + diff --git a/tests/validate/manifest.ttl b/tests/validate/manifest.ttl new file mode 100644 index 00000000..46d7574b --- /dev/null +++ b/tests/validate/manifest.ttl @@ -0,0 +1,165 @@ +@prefix mf: . +@prefix rdf: . +@prefix rdfs: . +@prefix rdft: . +@prefix serd: . + +serd:TestTurtleNegativeValidate + a rdfs:Class ; + rdfs:subClassOf rdft:Test . + +<> + rdf:type mf:Manifest ; + rdfs:comment "Serd validation test cases" ; + mf:entries ( + <#bad-all-values-from> + <#bad-cardinality-high> + <#bad-cardinality-low> + <#bad-cardinality> + <#bad-datatype-property> + <#bad-domain> + <#bad-functional-property> + <#bad-inverse-functional-property> + <#bad-literal-pattern> + <#bad-literal-value-high-inclusive> + <#bad-literal-value-low-inclusive> + <#bad-literal-value-high-exclusive> + <#bad-literal-value-low-exclusive> + <#bad-string-literal-value-high> + <#bad-string-literal-value-low> + <#bad-object-property> + <#bad-pattern> + <#bad-plain-literal> + <#bad-range-instance-not-literal> + <#bad-range-instance> + <#bad-range-literal-not-instance> + <#bad-range-literal> + <#bad-some-values-from> + <#bad-unknown-datatype> + <#bad-unknown-property> + ) . + +<#bad-all-values-from> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-all-values-from" ; + mf:action . + +<#bad-cardinality-low> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-cardinality-low" ; + mf:action . + +<#bad-cardinality-high> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-cardinality-high" ; + mf:action . + +<#bad-cardinality> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-cardinality" ; + mf:action . + +<#bad-datatype-property> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-datatype-property" ; + mf:action . + +<#bad-domain> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-domain" ; + mf:action . + +<#bad-functional-property> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-functional-property" ; + mf:action . + +<#bad-inverse-functional-property> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-inverse-functional-property" ; + mf:action . + +<#bad-literal-pattern> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-literal-pattern" ; + mf:action . + +<#bad-literal-value-low-inclusive> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-literal-value-low-inclusive" ; + mf:action . + +<#bad-literal-value-high-inclusive> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-literal-value-high-inclusive" ; + mf:action . + +<#bad-literal-value-low-exclusive> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-literal-value-low-exclusive" ; + mf:action . + +<#bad-literal-value-high-exclusive> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-literal-value-high-exclusive" ; + mf:action . + +<#bad-string-literal-value-low> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-string-literal-value-low" ; + mf:action . + +<#bad-string-literal-value-high> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-string-literal-value-high" ; + mf:action . + +<#bad-object-property> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-object-property" ; + mf:action . + +<#bad-pattern> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-pattern" ; + mf:action . + +<#bad-plain-literal> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-plain-literal" ; + mf:action . + +<#bad-range-instance-not-literal> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-range-instance-not-literal" ; + mf:action . + +<#bad-range-instance> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-range-instance" ; + mf:action . + +<#bad-range-literal-not-instance> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-range-literal-not-instance" ; + mf:action . + +<#bad-range-literal> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-range-literal" ; + mf:action . + +<#bad-some-values-from> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-some-values-from" ; + mf:action . + +<#bad-unknown-datatype> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-unknown-datatype" ; + mf:action . + +<#bad-unknown-property> + rdf:type serd:TestTurtleNegativeValidate ; + mf:name "bad-unknown-property" ; + mf:action . -- cgit v1.2.1