From f93a441065a611cc32874dde67e53a8295c87baf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 27 May 2018 15:48:25 +0200 Subject: [WIP] Add validation --- test/validate/bad-all-values-from.ttl | 24 ++ test/validate/bad-anyuri.ttl | 13 + test/validate/bad-cardinality-high.ttl | 19 ++ test/validate/bad-cardinality-low.ttl | 17 + test/validate/bad-cardinality.ttl | 19 ++ test/validate/bad-class-type-undefined.ttl | 5 + test/validate/bad-class-type.ttl | 9 + test/validate/bad-datatype-cycle.ttl | 18 + test/validate/bad-datatype-property.ttl | 19 ++ test/validate/bad-deprecated-class.ttl | 12 + test/validate/bad-deprecated-property.ttl | 13 + test/validate/bad-disjoint-with.ttl | 18 + test/validate/bad-domain.ttl | 27 ++ test/validate/bad-functional-property.ttl | 13 + test/validate/bad-inverse-functional-property.ttl | 15 + test/validate/bad-literal-pattern.ttl | 22 ++ test/validate/bad-literal-value-high-exclusive.ttl | 20 ++ test/validate/bad-literal-value-high-inclusive.ttl | 20 ++ test/validate/bad-literal-value-low-exclusive.ttl | 20 ++ test/validate/bad-literal-value-low-inclusive.ttl | 21 ++ test/validate/bad-literal-value.ttl | 7 + test/validate/bad-object-property.ttl | 12 + test/validate/bad-pattern.ttl | 23 ++ test/validate/bad-plain-literal.ttl | 12 + test/validate/bad-predicate-type-undefined.ttl | 5 + test/validate/bad-predicate-type.ttl | 9 + test/validate/bad-range-instance-not-literal.ttl | 19 ++ test/validate/bad-range-instance.ttl | 24 ++ test/validate/bad-range-literal-not-instance.ttl | 16 + test/validate/bad-range-literal.ttl | 27 ++ test/validate/bad-some-values-from.ttl | 19 ++ test/validate/bad-string-literal-value-high.ttl | 21 ++ test/validate/bad-string-literal-value-low.ttl | 21 ++ test/validate/bad-subclass-cycle.ttl | 13 + test/validate/bad-subproperty-cycle.ttl | 14 + test/validate/bad-superclass-restriction.ttl | 22 ++ test/validate/bad-union-of.ttl | 46 +++ test/validate/bad-unknown-datatype.ttl | 7 + test/validate/good-anyuri.ttl | 13 + test/validate/good-cardinality.ttl | 18 + .../validate/good-literal-value-high-inclusive.ttl | 21 ++ test/validate/good-literal-value-low-inclusive.ttl | 21 ++ test/validate/good-owl-thing.ttl | 16 + test/validate/good-pattern.ttl | 22 ++ test/validate/good-rdfs-resource.ttl | 12 + test/validate/good-some-values-from.ttl | 18 + test/validate/good-string-literal-value-low.ttl | 21 ++ test/validate/good-union-of.ttl | 51 +++ test/validate/manifest.ttl | 362 +++++++++++++++++++++ 49 files changed, 1236 insertions(+) create mode 100644 test/validate/bad-all-values-from.ttl create mode 100644 test/validate/bad-anyuri.ttl create mode 100644 test/validate/bad-cardinality-high.ttl create mode 100644 test/validate/bad-cardinality-low.ttl create mode 100644 test/validate/bad-cardinality.ttl create mode 100644 test/validate/bad-class-type-undefined.ttl create mode 100644 test/validate/bad-class-type.ttl create mode 100644 test/validate/bad-datatype-cycle.ttl create mode 100644 test/validate/bad-datatype-property.ttl create mode 100644 test/validate/bad-deprecated-class.ttl create mode 100644 test/validate/bad-deprecated-property.ttl create mode 100644 test/validate/bad-disjoint-with.ttl create mode 100644 test/validate/bad-domain.ttl create mode 100644 test/validate/bad-functional-property.ttl create mode 100644 test/validate/bad-inverse-functional-property.ttl create mode 100644 test/validate/bad-literal-pattern.ttl create mode 100644 test/validate/bad-literal-value-high-exclusive.ttl create mode 100644 test/validate/bad-literal-value-high-inclusive.ttl create mode 100644 test/validate/bad-literal-value-low-exclusive.ttl create mode 100644 test/validate/bad-literal-value-low-inclusive.ttl create mode 100644 test/validate/bad-literal-value.ttl create mode 100644 test/validate/bad-object-property.ttl create mode 100644 test/validate/bad-pattern.ttl create mode 100644 test/validate/bad-plain-literal.ttl create mode 100644 test/validate/bad-predicate-type-undefined.ttl create mode 100644 test/validate/bad-predicate-type.ttl create mode 100644 test/validate/bad-range-instance-not-literal.ttl create mode 100644 test/validate/bad-range-instance.ttl create mode 100644 test/validate/bad-range-literal-not-instance.ttl create mode 100644 test/validate/bad-range-literal.ttl create mode 100644 test/validate/bad-some-values-from.ttl create mode 100644 test/validate/bad-string-literal-value-high.ttl create mode 100644 test/validate/bad-string-literal-value-low.ttl create mode 100644 test/validate/bad-subclass-cycle.ttl create mode 100644 test/validate/bad-subproperty-cycle.ttl create mode 100644 test/validate/bad-superclass-restriction.ttl create mode 100644 test/validate/bad-union-of.ttl create mode 100644 test/validate/bad-unknown-datatype.ttl create mode 100644 test/validate/good-anyuri.ttl create mode 100644 test/validate/good-cardinality.ttl create mode 100644 test/validate/good-literal-value-high-inclusive.ttl create mode 100644 test/validate/good-literal-value-low-inclusive.ttl create mode 100644 test/validate/good-owl-thing.ttl create mode 100644 test/validate/good-pattern.ttl create mode 100644 test/validate/good-rdfs-resource.ttl create mode 100644 test/validate/good-some-values-from.ttl create mode 100644 test/validate/good-string-literal-value-low.ttl create mode 100644 test/validate/good-union-of.ttl create mode 100644 test/validate/manifest.ttl (limited to 'test/validate') diff --git a/test/validate/bad-all-values-from.ttl b/test/validate/bad-all-values-from.ttl new file mode 100644 index 00000000..4d82bf3d --- /dev/null +++ b/test/validate/bad-all-values-from.ttl @@ -0,0 +1,24 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:index + a rdf:Property ; + rdfs:label "index" . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty eg:index ; + owl:allValuesFrom xsd:nonNegativeInteger + ] . + +eg:s + a eg:Thing ; + eg:index 1.2 , + 3 . + diff --git a/test/validate/bad-anyuri.ttl b/test/validate/bad-anyuri.ttl new file mode 100644 index 00000000..ae5e88f0 --- /dev/null +++ b/test/validate/bad-anyuri.ttl @@ -0,0 +1,13 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:uri + a rdf:Property ; + rdfs:label "uri" ; + rdfs:range xsd:anyURI . + +eg:s + eg:uri _:blank . + diff --git a/test/validate/bad-cardinality-high.ttl b/test/validate/bad-cardinality-high.ttl new file mode 100644 index 00000000..2ff8ede3 --- /dev/null +++ b/test/validate/bad-cardinality-high.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:maxCardinality 1 + ] . + +eg:s + a eg:Thing ; + rdf:value 1 , + 2 . + diff --git a/test/validate/bad-cardinality-low.ttl b/test/validate/bad-cardinality-low.ttl new file mode 100644 index 00000000..60bfc9f8 --- /dev/null +++ b/test/validate/bad-cardinality-low.ttl @@ -0,0 +1,17 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:minCardinality 1 + ] . + +eg:s + a eg:Thing . + diff --git a/test/validate/bad-cardinality.ttl b/test/validate/bad-cardinality.ttl new file mode 100644 index 00000000..5300e566 --- /dev/null +++ b/test/validate/bad-cardinality.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:cardinality 3 + ] . + +eg:s + a eg:Thing ; + rdf:value 1 , + 2 . + diff --git a/test/validate/bad-class-type-undefined.ttl b/test/validate/bad-class-type-undefined.ttl new file mode 100644 index 00000000..1e3c5eba --- /dev/null +++ b/test/validate/bad-class-type-undefined.ttl @@ -0,0 +1,5 @@ +@prefix eg: . + +eg:s + a eg:Undefined . + diff --git a/test/validate/bad-class-type.ttl b/test/validate/bad-class-type.ttl new file mode 100644 index 00000000..a0ddf454 --- /dev/null +++ b/test/validate/bad-class-type.ttl @@ -0,0 +1,9 @@ +@prefix eg: . +@prefix rdf: . + +eg:nonClass + a rdf:Bag . + +eg:s + a eg:nonClass . + diff --git a/test/validate/bad-datatype-cycle.ttl b/test/validate/bad-datatype-cycle.ttl new file mode 100644 index 00000000..dd7cf0ce --- /dev/null +++ b/test/validate/bad-datatype-cycle.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdfs: . + +eg:Alpha + a rdfs:Datatype ; + rdfs:label "Alpha" ; + owl:onDatatype eg:Beta . + +eg:Beta + a rdfs:Datatype ; + rdfs:label "Beta" ; + owl:onDatatype eg:Omega . + +eg:Omega + a rdfs:Datatype ; + rdfs:label "Omega" ; + owl:onDatatype eg:Alpha . diff --git a/test/validate/bad-datatype-property.ttl b/test/validate/bad-datatype-property.ttl new file mode 100644 index 00000000..3c2f7a9f --- /dev/null +++ b/test/validate/bad-datatype-property.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:name + a owl:DatatypeProperty ; + rdfs:label "name" . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" . + +eg:s1 + a eg:Thing . + +eg:s2 + eg:name eg:s1 . + diff --git a/test/validate/bad-deprecated-class.ttl b/test/validate/bad-deprecated-class.ttl new file mode 100644 index 00000000..51d76d8f --- /dev/null +++ b/test/validate/bad-deprecated-class.ttl @@ -0,0 +1,12 @@ +@prefix eg: . +@prefix owl: . +@prefix rdfs: . + +eg:Square + a rdfs:Class ; + owl:deprecated true ; + rdfs:label "Square" . + +eg:square + a eg:Square . + diff --git a/test/validate/bad-deprecated-property.ttl b/test/validate/bad-deprecated-property.ttl new file mode 100644 index 00000000..b2bd392c --- /dev/null +++ b/test/validate/bad-deprecated-property.ttl @@ -0,0 +1,13 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:stuff + a rdf:Property ; + owl:deprecated true ; + rdfs:label "stuff" . + +eg:s + eg:stuff eg:o . + diff --git a/test/validate/bad-disjoint-with.ttl b/test/validate/bad-disjoint-with.ttl new file mode 100644 index 00000000..c56937f5 --- /dev/null +++ b/test/validate/bad-disjoint-with.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdfs: . + +eg:Square + a owl:Class ; + rdfs:label "Square" ; + owl:disjointWith eg:Circle . + +eg:Circle + a owl:Class ; + rdfs:label "Circle" ; + owl:disjointWith eg:Square . + +eg:magicShape + a eg:Square , + eg:Circle . + diff --git a/test/validate/bad-domain.ttl b/test/validate/bad-domain.ttl new file mode 100644 index 00000000..52c1849c --- /dev/null +++ b/test/validate/bad-domain.ttl @@ -0,0 +1,27 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:cardinality 1 + ] ; + rdfs:label "Thing" . + +eg:NonThing + a rdfs:Class ; + rdfs:label "NonThing" . + +eg:thingName + a rdf:Property ; + rdfs:label "thing name" ; + rdfs:domain eg:Thing . + +eg:nonthing + a eg:NonThing ; + eg:thingName "nonthing" . + diff --git a/test/validate/bad-functional-property.ttl b/test/validate/bad-functional-property.ttl new file mode 100644 index 00000000..53a73ccd --- /dev/null +++ b/test/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/test/validate/bad-inverse-functional-property.ttl b/test/validate/bad-inverse-functional-property.ttl new file mode 100644 index 00000000..95c0aaea --- /dev/null +++ b/test/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/test/validate/bad-literal-pattern.ttl b/test/validate/bad-literal-pattern.ttl new file mode 100644 index 00000000..fda954ed --- /dev/null +++ b/test/validate/bad-literal-pattern.ttl @@ -0,0 +1,22 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:CapitalLiteral + a rdfs:Datatype ; + rdfs:label "Capital Literal" ; + owl:withRestrictions ( + [ + xsd:pattern "[A-Z][a-z]*" + ] + ) . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:CapitalLiteral . + +eg:s + eg:value "lowercase"^^eg:CapitalLiteral . diff --git a/test/validate/bad-literal-value-high-exclusive.ttl b/test/validate/bad-literal-value-high-exclusive.ttl new file mode 100644 index 00000000..fafc74c8 --- /dev/null +++ b/test/validate/bad-literal-value-high-exclusive.ttl @@ -0,0 +1,20 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-literal-value-high-inclusive.ttl b/test/validate/bad-literal-value-high-inclusive.ttl new file mode 100644 index 00000000..db19f1cd --- /dev/null +++ b/test/validate/bad-literal-value-high-inclusive.ttl @@ -0,0 +1,20 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-literal-value-low-exclusive.ttl b/test/validate/bad-literal-value-low-exclusive.ttl new file mode 100644 index 00000000..082ae9d9 --- /dev/null +++ b/test/validate/bad-literal-value-low-exclusive.ttl @@ -0,0 +1,20 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-literal-value-low-inclusive.ttl b/test/validate/bad-literal-value-low-inclusive.ttl new file mode 100644 index 00000000..c7203c81 --- /dev/null +++ b/test/validate/bad-literal-value-low-inclusive.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-literal-value.ttl b/test/validate/bad-literal-value.ttl new file mode 100644 index 00000000..af6af40e --- /dev/null +++ b/test/validate/bad-literal-value.ttl @@ -0,0 +1,7 @@ +@prefix eg: . +@prefix rdf: . +@prefix xsd: . + +eg:s + rdf:value "98765"^^xsd:byte . + diff --git a/test/validate/bad-object-property.ttl b/test/validate/bad-object-property.ttl new file mode 100644 index 00000000..335db339 --- /dev/null +++ b/test/validate/bad-object-property.ttl @@ -0,0 +1,12 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:child + rdfs:label "child" ; + a owl:ObjectProperty . + +eg:s + eg:child "literal" . + diff --git a/test/validate/bad-pattern.ttl b/test/validate/bad-pattern.ttl new file mode 100644 index 00000000..fef79aeb --- /dev/null +++ b/test/validate/bad-pattern.ttl @@ -0,0 +1,23 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:BrokenLiteral + a rdfs:Datatype ; + rdfs:label "Broken Literal" ; + owl:withRestrictions ( + [ + xsd:pattern "[" + ] + ) . + +# eg:value +# a rdf:Property ; +# rdfs:label "value" ; +# rdfs:range eg:BrokenLiteral . + +eg:s + rdf:value "no match"^^eg:BrokenLiteral . + diff --git a/test/validate/bad-plain-literal.ttl b/test/validate/bad-plain-literal.ttl new file mode 100644 index 00000000..c6f60c2c --- /dev/null +++ b/test/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 "typed"^^rdf:XMLLiteral . + diff --git a/test/validate/bad-predicate-type-undefined.ttl b/test/validate/bad-predicate-type-undefined.ttl new file mode 100644 index 00000000..246594ee --- /dev/null +++ b/test/validate/bad-predicate-type-undefined.ttl @@ -0,0 +1,5 @@ +@prefix eg: . + +eg:s + eg:undefined 0 . + diff --git a/test/validate/bad-predicate-type.ttl b/test/validate/bad-predicate-type.ttl new file mode 100644 index 00000000..84163d64 --- /dev/null +++ b/test/validate/bad-predicate-type.ttl @@ -0,0 +1,9 @@ +@prefix eg: . +@prefix rdf: . + +eg:nonProperty + a rdf:Bag . + +eg:s + eg:nonProperty 0 . + diff --git a/test/validate/bad-range-instance-not-literal.ttl b/test/validate/bad-range-instance-not-literal.ttl new file mode 100644 index 00000000..5132a70f --- /dev/null +++ b/test/validate/bad-range-instance-not-literal.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" . + +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/test/validate/bad-range-instance.ttl b/test/validate/bad-range-instance.ttl new file mode 100644 index 00000000..d0a08a7a --- /dev/null +++ b/test/validate/bad-range-instance.ttl @@ -0,0 +1,24 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:minCardinality 1 + ] . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:Thing . + +eg:nonthing + rdfs:label "not a Thing" . + +eg:s + eg:value eg:nonthing . diff --git a/test/validate/bad-range-literal-not-instance.ttl b/test/validate/bad-range-literal-not-instance.ttl new file mode 100644 index 00000000..039fcea8 --- /dev/null +++ b/test/validate/bad-range-literal-not-instance.ttl @@ -0,0 +1,16 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:Thing . + +eg:s + eg:value "literal" . + diff --git a/test/validate/bad-range-literal.ttl b/test/validate/bad-range-literal.ttl new file mode 100644 index 00000000..d656aa16 --- /dev/null +++ b/test/validate/bad-range-literal.ttl @@ -0,0 +1,27 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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:scaled + a rdf:Property ; + rdfs:label "scaled" ; + rdfs:range eg:Normal . + +eg:s + eg:scaled 2.0 . + + diff --git a/test/validate/bad-some-values-from.ttl b/test/validate/bad-some-values-from.ttl new file mode 100644 index 00000000..9a8ee849 --- /dev/null +++ b/test/validate/bad-some-values-from.ttl @@ -0,0 +1,19 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + 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/test/validate/bad-string-literal-value-high.ttl b/test/validate/bad-string-literal-value-high.ttl new file mode 100644 index 00000000..93e675ef --- /dev/null +++ b/test/validate/bad-string-literal-value-high.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-string-literal-value-low.ttl b/test/validate/bad-string-literal-value-low.ttl new file mode 100644 index 00000000..2b6985f8 --- /dev/null +++ b/test/validate/bad-string-literal-value-low.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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/test/validate/bad-subclass-cycle.ttl b/test/validate/bad-subclass-cycle.ttl new file mode 100644 index 00000000..1e702832 --- /dev/null +++ b/test/validate/bad-subclass-cycle.ttl @@ -0,0 +1,13 @@ +@prefix eg: . +@prefix rdfs: . + +eg:Square + a rdfs:Class ; + rdfs:subClassOf eg:Rectangle ; + rdfs:label "Square" . + +eg:Rectangle + a rdfs:Class ; + rdfs:subClassOf eg:Square ; + rdfs:label "Rectangle" . + diff --git a/test/validate/bad-subproperty-cycle.ttl b/test/validate/bad-subproperty-cycle.ttl new file mode 100644 index 00000000..eb3bbee4 --- /dev/null +++ b/test/validate/bad-subproperty-cycle.ttl @@ -0,0 +1,14 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:stuff + a rdf:Property ; + rdfs:subPropertyOf eg:things ; + rdfs:label "stuff" . + +eg:things + a rdf:Property ; + rdfs:subPropertyOf eg:stuff ; + rdfs:label "things" . + diff --git a/test/validate/bad-superclass-restriction.ttl b/test/validate/bad-superclass-restriction.ttl new file mode 100644 index 00000000..bd820de4 --- /dev/null +++ b/test/validate/bad-superclass-restriction.ttl @@ -0,0 +1,22 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:SuperThing + a rdfs:Class ; + rdfs:label "SuperThing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:minCardinality 1 + ] . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf eg:SuperThing . + +eg:s + a eg:Thing . + diff --git a/test/validate/bad-union-of.ttl b/test/validate/bad-union-of.ttl new file mode 100644 index 00000000..0198ce1d --- /dev/null +++ b/test/validate/bad-union-of.ttl @@ -0,0 +1,46 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:index + a rdf:Property ; + rdfs:label "index" . + +eg:name + a rdf:Property ; + rdfs:label "name" . + +eg:ThingWithIndex + a rdfs:Class ; + rdfs:label "Thing With Index" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty eg:index ; + owl:minCardinality 1 + ] . + +eg:ThingWithName + a rdfs:Class ; + rdfs:label "Thing With Name" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty eg:name ; + owl:minCardinality 1 + ] . + +eg:something + a rdf:Property ; + rdfs:label "something" ; + rdfs:range [ + owl:unionOf ( + eg:ThingWithIndex + eg:ThingWithName + ) + ] . + +eg:s1 + eg:something [ + rdfs:label "s1" + ] . diff --git a/test/validate/bad-unknown-datatype.ttl b/test/validate/bad-unknown-datatype.ttl new file mode 100644 index 00000000..ed879414 --- /dev/null +++ b/test/validate/bad-unknown-datatype.ttl @@ -0,0 +1,7 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:s + rdfs:label "bad datatype"^^rdf:UndefinedLiteral . + diff --git a/test/validate/good-anyuri.ttl b/test/validate/good-anyuri.ttl new file mode 100644 index 00000000..e05f8b71 --- /dev/null +++ b/test/validate/good-anyuri.ttl @@ -0,0 +1,13 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:uri + a rdf:Property ; + rdfs:label "uri" ; + rdfs:range xsd:anyURI . + +eg:s + eg:uri . + diff --git a/test/validate/good-cardinality.ttl b/test/validate/good-cardinality.ttl new file mode 100644 index 00000000..74615fdc --- /dev/null +++ b/test/validate/good-cardinality.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdf:value ; + owl:cardinality 2 + ] . + +eg:s + a eg:Thing ; + rdf:value 1 , + 2 . diff --git a/test/validate/good-literal-value-high-inclusive.ttl b/test/validate/good-literal-value-high-inclusive.ttl new file mode 100644 index 00000000..18cbed0e --- /dev/null +++ b/test/validate/good-literal-value-high-inclusive.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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.0"^^eg:Normal . diff --git a/test/validate/good-literal-value-low-inclusive.ttl b/test/validate/good-literal-value-low-inclusive.ttl new file mode 100644 index 00000000..e6ad334c --- /dev/null +++ b/test/validate/good-literal-value-low-inclusive.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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.0"^^eg:Normal . diff --git a/test/validate/good-owl-thing.ttl b/test/validate/good-owl-thing.ttl new file mode 100644 index 00000000..9c4b570d --- /dev/null +++ b/test/validate/good-owl-thing.ttl @@ -0,0 +1,16 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:someThing + a rdf:Property ; + rdfs:label "some thing" ; + rdfs:range owl:Thing . + +eg:thisThing + rdfs:label "this thing" . + +eg:s + eg:someThing eg:thisThing . + diff --git a/test/validate/good-pattern.ttl b/test/validate/good-pattern.ttl new file mode 100644 index 00000000..740ec22c --- /dev/null +++ b/test/validate/good-pattern.ttl @@ -0,0 +1,22 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:CapitalLiteral + a rdfs:Datatype ; + rdfs:label "Capital Literal" ; + owl:withRestrictions ( + [ + xsd:pattern "[A-Z][a-z]*" + ] + ) . + +eg:value + a rdf:Property ; + rdfs:label "value" ; + rdfs:range eg:CapitalLiteral . + +eg:s + eg:value "Uppercase"^^eg:CapitalLiteral . diff --git a/test/validate/good-rdfs-resource.ttl b/test/validate/good-rdfs-resource.ttl new file mode 100644 index 00000000..26310553 --- /dev/null +++ b/test/validate/good-rdfs-resource.ttl @@ -0,0 +1,12 @@ +@prefix eg: . +@prefix rdf: . +@prefix rdfs: . + +eg:resource + a rdf:Property ; + rdfs:label "resource" ; + rdfs:range rdfs:Resource . + +eg:s + eg:resource . + diff --git a/test/validate/good-some-values-from.ttl b/test/validate/good-some-values-from.ttl new file mode 100644 index 00000000..23f977fd --- /dev/null +++ b/test/validate/good-some-values-from.ttl @@ -0,0 +1,18 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . + +eg:Thing + a rdfs:Class ; + rdfs:label "Thing" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty rdfs:label ; + owl:someValuesFrom rdf:PlainLiteral + ] . + +eg:s + a eg:Thing ; + rdfs:label "not plain"^^rdf:XMLLiteral , + "plain" . diff --git a/test/validate/good-string-literal-value-low.ttl b/test/validate/good-string-literal-value-low.ttl new file mode 100644 index 00000000..7d71856b --- /dev/null +++ b/test/validate/good-string-literal-value-low.ttl @@ -0,0 +1,21 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@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 "Cat"^^eg:betweenBAndD . diff --git a/test/validate/good-union-of.ttl b/test/validate/good-union-of.ttl new file mode 100644 index 00000000..67901f94 --- /dev/null +++ b/test/validate/good-union-of.ttl @@ -0,0 +1,51 @@ +@prefix eg: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xsd: . + +eg:index + a rdf:Property ; + rdfs:label "index" . + +eg:name + a rdf:Property ; + rdfs:label "name" . + +eg:ThingWithIndex + a rdfs:Class ; + rdfs:label "Thing With Index" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty eg:index ; + owl:minCardinality 1 + ] . + +eg:ThingWithName + a rdfs:Class ; + rdfs:label "Thing With Name" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty eg:name ; + owl:minCardinality 1 + ] . + +eg:something + a rdf:Property ; + rdfs:label "something" ; + rdfs:range [ + owl:unionOf ( + eg:ThingWithIndex + eg:ThingWithName + ) + ] . + +eg:s1 + eg:something [ + eg:index 42 + ] . + +eg:s2 + eg:something [ + eg:name "ess" + ] . diff --git a/test/validate/manifest.ttl b/test/validate/manifest.ttl new file mode 100644 index 00000000..c2e9988a --- /dev/null +++ b/test/validate/manifest.ttl @@ -0,0 +1,362 @@ +@prefix checks: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix rdft: . +@prefix serd: . + +rdft:Test + a rdfs:Class ; + rdfs:subClassOf mf:ManifestEntry . + +serd:TestTurtleNegativeValidate + a rdfs:Class ; + rdfs:label "Turtle Negative Validation" ; + rdfs:subClassOf rdft:Test , + [ + a owl:Restriction ; + owl:onProperty serd:triggersCheck ; + owl:minCardinality 1 + ] . + +serd:TestTurtlePositiveValidate + a rdfs:Class ; + rdfs:label "Turtle Positive Validation" ; + rdfs:subClassOf rdft:Test . + +serd:triggersCheck + a rdf:Property ; + rdfs:label "triggers check" ; + rdfs:range serd:ValidatorCheck . + +serd:triggersCheck + a rdf:Property ; + rdfs:label "triggers check" ; + rdfs:range serd:ValidatorCheck . + +<> + a mf:Manifest ; + rdfs:comment "Serd validation test cases" ; + mf:entries ( + <#bad-all-values-from> + <#bad-anyuri> + <#bad-cardinality-high> + <#bad-cardinality-low> + <#bad-cardinality> + <#bad-datatype-cycle> + <#bad-datatype-property> + <#bad-deprecated-class> + <#bad-deprecated-property> + <#bad-domain> + <#bad-functional-property> + <#bad-inverse-functional-property> + <#bad-literal-pattern> + <#bad-literal-value-high-exclusive> + <#bad-literal-value-high-inclusive> + <#bad-literal-value-low-exclusive> + <#bad-literal-value-low-inclusive> + <#bad-literal-value> + <#bad-object-property> + <#bad-pattern> + <#bad-plain-literal> + <#bad-predicate-type-undefined> + <#bad-predicate-type> + <#bad-range-instance-not-literal> + <#bad-range-instance> + <#bad-range-literal-not-instance> + <#bad-range-literal> + <#bad-some-values-from> + <#bad-string-literal-value-high> + <#bad-string-literal-value-low> + <#bad-subclass-cycle> + <#bad-subproperty-cycle> + <#bad-superclass-restriction> + <#bad-union-of> + <#bad-unknown-datatype> + <#good-anyuri> + <#good-cardinality> + <#good-literal-value-high-inclusive> + <#good-literal-value-low-inclusive> + <#good-owl-thing> + <#good-pattern> + <#good-rdfs-resource> + <#good-some-values-from> + <#good-string-literal-value-low> + <#good-union-of> + ) . + +<#bad-all-values-from> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:allValuesFrom , + checks:instanceType ; + serd:triggersCheck checks:literalPattern ; + serd:triggersCheck checks:literalRestriction ; + mf:name "bad-all-values-from" ; + mf:action . + +<#bad-anyuri> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:anyUri , + checks:propertyRange ; + mf:name "bad-anyuri" ; + mf:action . + +<#bad-cardinality-low> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:cardinalityMin , + checks:instanceType ; + mf:name "bad-cardinality-low" ; + mf:action . + +<#bad-cardinality-high> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:cardinalityMax , + checks:instanceType ; + mf:name "bad-cardinality-high" ; + mf:action . + +<#bad-cardinality> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:cardinalityEqual , + checks:instanceType ; + mf:name "bad-cardinality" ; + mf:action . + +<#bad-datatype-cycle> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:datatypeCycle ; + mf:name "bad-datatype-cycle" ; + mf:action . + +<#bad-datatype-property> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:datatypeProperty ; + mf:name "bad-datatype-property" ; + mf:action . + +<#bad-deprecated-class> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:deprecatedClass ; + mf:name "bad-deprecated-class" ; + mf:action . + +<#bad-deprecated-property> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:deprecatedProperty ; + mf:name "bad-deprecated-property" ; + mf:action . + +<#bad-domain> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:cardinalityEqual , + checks:propertyDomain ; + mf:name "bad-domain" ; + mf:action . + +<#bad-functional-property> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:functionalProperty ; + mf:name "bad-functional-property" ; + mf:action . + +<#bad-inverse-functional-property> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:inverseFunctionalProperty ; + mf:name "bad-inverse-functional-property" ; + mf:action . + +<#bad-literal-pattern> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalPattern ; + mf:name "bad-literal-pattern" ; + mf:action . + +<#bad-literal-value-low-inclusive> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMinInclusive ; + mf:name "bad-literal-value-low-inclusive" ; + mf:action . + +<#bad-literal-value-high-inclusive> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMaxInclusive ; + mf:name "bad-literal-value-high-inclusive" ; + mf:action . + +<#bad-literal-value-low-exclusive> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMinExclusive ; + mf:name "bad-literal-value-low-exclusive" ; + mf:action . + +<#bad-literal-value-high-exclusive> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMaxExclusive ; + mf:name "bad-literal-value-high-exclusive" ; + mf:action . + +<#bad-literal-value> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalValue ; + mf:name "bad-literal-value" ; + mf:action . + +<#bad-string-literal-value-low> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMinExclusive ; + mf:name "bad-string-literal-value-low" ; + mf:action . + +<#bad-string-literal-value-high> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMaxExclusive ; + mf:name "bad-string-literal-value-high" ; + mf:action . + +<#bad-subclass-cycle> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:classCycle ; + mf:name "bad-subclass-cycle" ; + mf:action . + +<#bad-subproperty-cycle> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:propertyCycle ; + mf:name "bad-subproperty-cycle" ; + mf:action . + +<#bad-superclass-restriction> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:instanceType , + checks:cardinalityMin ; + mf:name "bad-superclass-restriction" ; + mf:action . + +<#bad-object-property> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:objectProperty ; + mf:name "bad-object-property" ; + mf:action . + +<#bad-pattern> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalPattern ; + mf:name "bad-pattern" ; + mf:action . + +<#bad-plain-literal> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:plainLiteralDatatype , + checks:propertyRange ; + mf:name "bad-plain-literal" ; + mf:action . + +<#bad-range-instance-not-literal> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:instanceLiteral , + checks:propertyRange ; + mf:name "bad-range-instance-not-literal" ; + mf:action . + +<#bad-range-instance> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:cardinalityMin , + checks:propertyRange ; + mf:name "bad-range-instance" ; + mf:action . + +<#bad-range-literal-not-instance> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalInstance , + checks:propertyRange ; + mf:name "bad-range-literal-not-instance" ; + mf:action . + +<#bad-range-literal> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:literalMaxInclusive , + checks:propertyRange ; + mf:name "bad-range-literal" ; + mf:action . + +<#bad-some-values-from> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:someValuesFrom , + checks:instanceType ; + mf:name "bad-some-values-from" ; + mf:action . + +<#bad-union-of> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:propertyRange ; + mf:name "bad-union-of" ; + mf:action . + +<#bad-unknown-datatype> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:datatypeType ; + mf:name "bad-unknown-datatype" ; + mf:action . + +<#bad-predicate-type-undefined> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:predicateType ; + mf:name "bad-predicate-type-undefined" ; + mf:action . + +<#bad-predicate-type> + a serd:TestTurtleNegativeValidate ; + serd:triggersCheck checks:predicateType ; + mf:name "bad-predicate-type" ; + mf:action . + +<#good-anyuri> + a serd:TestTurtlePositiveValidate ; + mf:name "good-anyuri" ; + mf:action . + +<#good-cardinality> + a serd:TestTurtlePositiveValidate ; + mf:name "good-cardinality" ; + mf:action . + +<#good-literal-value-low-inclusive> + a serd:TestTurtlePositiveValidate ; + mf:name "good-literal-value-low-inclusive" ; + mf:action . + +<#good-literal-value-high-inclusive> + a serd:TestTurtlePositiveValidate ; + mf:name "good-literal-value-high-inclusive" ; + mf:action . + +<#good-some-values-from> + a serd:TestTurtlePositiveValidate ; + mf:name "good-some-values-from" ; + mf:action . + +<#good-owl-thing> + a serd:TestTurtlePositiveValidate ; + mf:name "good-owl-thing" ; + mf:action . + +<#good-pattern> + a serd:TestTurtlePositiveValidate ; + mf:name "good-pattern" ; + mf:action . + +<#good-rdfs-resource> + a serd:TestTurtlePositiveValidate ; + mf:name "good-rdfs-resource" ; + mf:action . + +<#good-string-literal-value-low> + a serd:TestTurtlePositiveValidate ; + mf:name "good-string-literal-value-low" ; + mf:action . + +<#good-union-of> + a serd:TestTurtlePositiveValidate ; + mf:name "good-union-of" ; + mf:action . -- cgit v1.2.1