2011-03-28
Semantic Data Quality Management
V 1.1 Release 2011-03-28
Christian Fuerber, Martin Hepp, and Markus Wischnewski
The Data Quality Constraints Library
The Data Quality Constraints Library
This RDF document contains a library of data quality constraints represented as SPARQL query templates based on the SPARQL Inferencing Framework (SPIN). The data quality constraint templates are especially useful for the identification of data quality problems during data entry and for periodic quality checks during data usage.
arg7
The seventh argument of a function call.
The sixth argument of a function call.
arg6
Creator
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?this .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
{
?this a ?arg1 .
?this ?arg2 "" .
}
UNION
{
?this a ?arg1 .
NOT EXISTS {
?this ?arg2 ?value .
}
}
}
value
Property {?arg2} is mandatory and must not contain empty literals for instances of class {?arg1}!
This query returns all instances of class ?arg1 where the literal for ?arg2 is empty or the whole property ?arg2 is missing.
Mandatory literal value and property check in instances of a class
Select property to be tested!
Select class that contains intances to be tested!
true
data quality constraint templates
Constraint templates are generalized SPARQL query templates based on the SPARQL Inferencing Framework (SPIN). The query templates represent generic data quality rules that may be used to identify data quality problems, i.e. violations of previously defined constraints.
true
Missing element constraints identify elements in the data set that are missing but required.
missing element constraints
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (!regex(str(?value), "^[0-9]{5}$"^^xsd:string))
}
s
value
^[0-9]{5}$
Syntax rule: {?arg1} must contain 5-digit numeric value in all instances!
Select the property that contains the US zip codes!
This query flags all instances that do not have a five digit numeric value for property ?arg1.
syntax check in all instances: 5 digit numeric values
true
Syntax constraints identify values that do not adhere to syntactical rules. {@en}
syntax constraints
Property {?arg1} cannot have the same values as property {?arg3} in class {?arg2}!
true
legal value constraints
Legal value constraints identify values that are either not explicitly allowed or explicitly illegal.
Select property to be tested!
Select class with instances holding the illegal values!
Select property holding the illegal values!
Illegal value check in all instances
This query flags all instances with property ?arg1 that have values which are contained in property ?arg3 of instances of class ?arg2. The query tolerates chaotic assignments of language tags.
s
value
s2
value1
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?s .
_:c0 spin:violationPath ?arg1 .}
WHERE
{ ?s ?arg1 ?value
OPTIONAL
{ ?s2 rdf:type ?arg2 .
?s2 ?arg3 ?value1
FILTER ( str(?value1) = str(?value) )
}
FILTER bound(?value1)
}
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?a .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?a ?arg1 ?uniqueValue1 .
?b ?arg1 ?uniqueValue2 .
FILTER ((str(?uniqueValue1) = str(?uniqueValue2)) && (?a != ?b))
}
a
uniqueValue1
uniqueValue2
b
true
Uniqueness constraints identify values that shall be unique, but are redundant within a certain data set.
uniqueness constraints
Uniqueness check for all values in a property
This query returns all instances where the value for property ?arg1 is not unique in the tested data set. The query tolerates chaotic language tag assignments.
Values in {?arg1} must be unique!
Select property to be tested!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
?s a ?arg1 .
?s ?arg2 ?value .
FILTER (smf:cast(?value, xsd:decimal) > ?arg3)
}
s
value
Enter upper limit!
Values in {?arg2} for instances of class {?arg1} must be lower than {?arg3}!
This query returns all instances of class ?arg1 that have a value for property ?arg2 above the user defined limit ?arg3. The query tolerates chaotic datatype assignments.
Select property to be tested!
Select class that contains instances to be tested!
Upper limit check in all instances of a class
true
value range constraints
Value range constraints allow the identification of values that do not obey a certain upper and/or lower limit.
Select property 1 of functional dependency!
Value combinations of properties {?arg1} and {?arg2} must always be identical with value combinations of properties {?arg4} and {?arg5} in class {?arg3} for all instances!
Select second property of trusted reference that holds legal values for property 2!
Select class of trusted reference that holds instances with legal value combinations!
Select property 2 of functional dependency!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
OPTIONAL {
?s ?arg1 ?value1 .
OPTIONAL {
?s ?arg2 ?value2 .
}
}
NOT EXISTS {
?s2 a ?arg3 .
?s2 ?arg4 ?value1 .
?s2 ?arg5 ?value2 .
}
}
s
value1
value2
s2
Select first property of trusted reference that holds legal values for property 1!
This query flags instances with properties ?arg1 and ?arg2 that do not have a corresponding value combination in instances of the trusted reference in class ?arg3. The semantics of property ?arg1 should be equal with property ?arg4, and the semantics of property ?arg2 should be equal with ?arg5. The query tolerates homonymous values, i.e. the same value may be assigned to different dependent values by using different instances in the trusted reference. Value combinations that cannot be found in the trusted reference will also be flagged as incorrect. The query will also test the existence of a single value in the trusted reference when one property of the tested data is missing.
Functional dependency check in all instances with trusted reference
true
Functional dependencies are dependencies between the values of two or more different properties. Functional dependency constraints check the abidance of functional dependencies.
functional dependency constraints
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg3 .
_:b0 spin:violationPath ?arg4 .
}
WHERE {
?s a ?arg1 .
OPTIONAL {
?s ?arg2 ?node .
OPTIONAL {
?node ?arg3 ?value1 .
}
OPTIONAL {
?s ?arg4 ?value2 .
}
}
NOT EXISTS {
?s2 a ?arg5 .
?s2 ?arg6 ?value1 .
?s2 ?arg7 ?value2 .
}
}
s
node
value1
value2
s2
arg6
arg7
Select class of trusted reference that holds instances with legal value combinations!
Select property 1 of functional dependency!
Select first property of trusted reference that holds legal values for property 1!
Value combinations of properties {?arg3} and {?arg4} must always be identical with value combinations of properties {?arg6} and {?arg7} of class {?arg5} for all instances of class {?arg1}!
This query is designed to test (blank node) instances of the property-and-node element (rdf:parseType="Resource") ?arg2 that are part of the instances of class ?arg 1. The query flags instances of property ?arg2 with properties ?arg3 and ?arg4 that do not have the exact value combination in instances of the trusted reference in class ?arg5. The semantics of property ?arg3 should be equal with property ?arg6, and the semantics of property ?arg4 should be equal with ?arg7. The query tolerates homonymous values, i.e. the same value may be assigned to different dependent values. Value combinations that cannot be found in the trusted reference will also be flagged. The query will also test the existence of a single value in the trusted reference when one property of the tested data is missing.
Functional dependency check in blank node instances of a class with trusted reference
Select property 2 of functional dependency!
Select second property of trusted reference that holds legal values for property 2!
Select class that holds instances to be tested!
Select property that holds blank nodes!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg3 .
}
WHERE {
?s ?arg1 ?arg2 .
FILTER (!spl:hasValue(?s, ?arg3, ""^^xsd:string))
}
s
When {?arg1} has value {?arg2}, then {?arg3} has to be empty!
Select property 1 of functional dependency!
Enter functionally dependent value 1 of property 1!
Select property that must contain empty literal!
This query returns all instances with value ?arg2 for property ?arg1 that do not have an empty literal string for property ?arg3.
Instances of class {?arg1} can only contain the same values for property {?arg2} as property {?arg4} in instances of class {?arg3}!
This query flags all instances of class ?arg1 with property ?arg2 that have values which are not contained in property ?arg4 of instances of class ?arg3. The query tolerates chaotic assignments of language tags.
s
value
s2
value1
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?s .
_:c0 spin:violationPath ?arg2 .}
WHERE
{ ?s rdf:type ?arg1 .
?s ?arg2 ?value
OPTIONAL
{ ?s2 rdf:type ?arg3 .
?s2 ?arg4 ?value1
FILTER ( str(?value1) = str(?value) )
}
FILTER ( ! bound(?value1) )
}
Legal value check in class instances
Select class that holds instances with legal values!
Select class with instances to be tested!
Select property to be tested!
Select property that holds legal values!
Incorrect EAN-13 in {?arg2} of {?arg1} class instances!
EAN-13 Class
Please enter the property holding the EAN-13!
Please enter the class holding the instances that shall be tested!
This query flags wrong EAN-13 values in instances of a specified class.
instance
ean
1
0
1
2
1
2
3
2
3
4
3
4
5
4
5
6
5
6
7
6
7
8
7
8
9
8
9
10
9
10
11
10
11
12
11
12
13
12
13
value
3
check
1
0
10
^[0-9]{13}$
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?instance .
_:c0 spin:violationPath ?arg2 .}
WHERE
{ ?instance rdf:type ?arg1 .
?instance ?arg2 ?ean
LET (?1 := afn:substr(str(?ean), 0, 1))
LET (?2 := afn:substr(str(?ean), 1, 2))
LET (?3 := afn:substr(str(?ean), 2, 3))
LET (?4 := afn:substr(str(?ean), 3, 4))
LET (?5 := afn:substr(str(?ean), 4, 5))
LET (?6 := afn:substr(str(?ean), 5, 6))
LET (?7 := afn:substr(str(?ean), 6, 7))
LET (?8 := afn:substr(str(?ean), 7, 8))
LET (?9 := afn:substr(str(?ean), 8, 9))
LET (?10 := afn:substr(str(?ean), 9, 10))
LET (?11 := afn:substr(str(?ean), 10, 11))
LET (?12 := afn:substr(str(?ean), 11, 12))
LET (?13 := afn:substr(str(?ean), 12, 13))
LET (?value := ( ( ( ( ( ( ( xsd:int(?2) + xsd:int(?4) ) + xsd:int(?6) ) + xsd:int(?8) ) + xsd:int(?10) ) + xsd:int(?12) ) * 3 ) + ( ( ( ( ( xsd:int(?1) + xsd:int(?3) ) + xsd:int(?5) ) + xsd:int(?7) ) + xsd:int(?9) ) + xsd:int(?11) ) ))
LET (?check := afn:substr(str(?value), ( fn:string-length(str(?value)) - 1 ), fn:string-length(str(?value))))
FILTER ( ( ( ( xsd:int(?check) + xsd:int(?13) ) != 0 ) && ( ( xsd:int(?check) + xsd:int(?13) ) != 10 ) ) || ( ! regex(str(?ean), "^[0-9]{13}$") ) )
}
Title
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
?s a ?arg1 .
?s ?arg2 ?value .
FILTER (smf:cast(?value, xsd:decimal) < ?arg3)
}
s
value
Values in {?arg2} for instances of class {?arg1} must be greater than {?arg3}!
Select property to be tested!
Enter lower limit! {@en}
Select class that contains instances to be tested!
Lower limit check in all instances of a class
This query returns all instances of class ?arg1 that have a value for property ?arg2 below the user defined limit ?arg3. The query tolerates chaotic datatype assignments.
Subject
Select property that holds illegal values!
s
value
s2
value1
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?s .
_:c0 spin:violationPath ?arg2 .
}
WHERE
{ ?s rdf:type ?arg1 .
?s ?arg2 ?value
OPTIONAL
{ ?s2 rdf:type ?arg3 .
?s2 ?arg4 ?value1
FILTER ( str(?value1) = str(?value) )
}
FILTER bound(?value1)
}
Illegal value check in class instances
Select class with instances to be tested!
Select property to be tested!
Select class that holds instances with illegal values!
This query flags all instances of class ?arg1 with property ?arg2 that have values which are contained in property ?arg4 of instances of class ?arg3. The query tolerates chaotic assignments of language tags.
Instances of class {?arg1} cannot have the same values for property {?arg2} as property {?arg4} in class {?arg3}!
Select property that holds legal values!
This query flags all instances with property ?arg1 that have values which are not contained in property ?arg3 of instances of class ?arg2. The query tolerates chaotic assignments of language tags.
Legal value check in all instances
Property {?arg1} can only contain the same values as property {?arg3} in instances of class {?arg2}!
Select property to be tested!
Select class that holds instances with legal values!
s
value
s2
value1
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?s .
_:c0 spin:violationPath ?arg1 .}
WHERE
{ ?s ?arg1 ?value
OPTIONAL
{ ?s2 rdf:type ?arg2 .
?s2 ?arg3 ?value1
FILTER ( str(?value1) = str(?value) )
}
FILTER ( ! bound(?value1) )
}
This query flags all instances with inconsistant value ranges. Among others it is suitable for value ranges with datatypes xsd:integer, xsd:int, xsd:float, xsd:date, and xsd:dateTime. The literals must be typed.
Please enter the datatype property that shall hold the greater value!
Please enter the datatype property that shall hold the lower value!
Value in {?arg1} cannot be greater than value of {?arg2}!
Inconsistent value range all
instance
from
through
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?instance .
_:c0 spin:violationPath ?arg1 .
_:c0 spin:violationPath ?arg2 .}
WHERE
{ ?instance ?arg1 ?from .
?instance ?arg2 ?through
FILTER ( ?from >= ?through )
}
Date
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (smf:cast(?value, xsd:decimal) < ?arg2)
}
s
value
This query returns all instances that have a value for property ?arg1 below the user defined limit ?arg2. The query tolerates chaotic datatype assignments.
Enter lower limit!
Select property to be tested!
Values in {?arg1} must be greater than {?arg2}!
Lower limit check in all instances
Enter functionally dependent value 1 of property 1!
Select property 2 of functional dependency!
Enter functionally dependent value 2 of property 2!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg3 .
}
WHERE {
?s ?arg1 ?arg2 .
FILTER (!spl:hasValue(?s, ?arg3, ?arg4))
}
s
exclusive functional dependency check in all instances
This query flags instances with property ?arg1 and value ?arg2 that do not have value ?arg4 with property ?arg3. It is only suitable for value dependencies with one to one cardinality. The query does not tolerate homonyms and is not restricted to a specific class.
Select property 1 of functional dependency!
Value "{?arg2}" of {?arg1} must only have value "{?arg4}" in {?arg3} in all instances!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (!regex(str(?value), "^([A-Za-z])*$"^^xsd:string))
}
s
value
^([A-Za-z])*$
Select property to be tested!
Syntax rule: only letters allowed in {?arg1}!
This query flags all instances with property ?arg1 that do not have letters as literal values. The query tolerates language tags.
syntax check in all instances: only letters allowed
This query flags instances of class ?arg 1 with properties ?arg2 and ?arg3 that do not have the exact value combination in instances of the trusted reference in class ?arg4. The semantics of property ?arg2 should be equal with property ?arg5, and the semantics of property ?arg3 should be equal with ?arg6. The query tolerates homonymous values, i.e. the same value may be assigned to different dependent values. Value combinations that cannot be found in the trusted reference will also be flagged. The query will also test the existence of a single value in the trusted reference when one property of the tested data is missing.
Select second property of trusted reference that holds legal values for property 2!
Select class of trusted reference that holds instances with legal value combinations!
Select class that holds instances to be tested!
Value combinations of properties {?arg2} and {?arg3} must always be identical with value combinations of properties {?arg5} and {?arg6} of class {?arg4} for all instances of class {?arg1}!
Functional dependency check in class instances with trusted reference
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg2 .
_:b0 spin:violationPath ?arg3 .
}
WHERE {
?s a ?arg1 .
OPTIONAL {
?s ?arg2 ?value1 .
OPTIONAL {
?s ?arg3 ?value2 .
}
}
NOT EXISTS {
?s2 a ?arg4 .
?s2 ?arg5 ?value1 .
?s2 ?arg6 ?value2 .
}
}
s
value1
value2
s2
arg6
Select property 2 of functional dependency!
Select property 1 of functional dependency!
Select first property of trusted reference that holds legal values for property 1!
This query flags all instances of property-and-node element ?arg2 (rdf:parseType="Resource") with property ?arg3 in class ?arg1 that have values which are not contained in property ?arg5 of instances of class ?arg3. The query tolerates chaotic assignments of language tags.
Select property that holds legal values!
Select property that holds blank nodes!
Select class with instances to be tested!
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?s .
_:c0 spin:violationPath ?arg2 .
_:c0 spin:violationPath ?arg3 .}
WHERE
{ ?s rdf:type ?arg1 .
?s ?arg2 ?node .
?node ?arg3 ?value
OPTIONAL
{ ?s2 rdf:type ?arg4 .
?s2 ?arg5 ?value1
FILTER ( str(?value) = str(?value1) )
}
FILTER ( ! bound(?value1) )
}
s
node
value
s2
value1
Legal value check in blank node instances of a class
Select class that holds instances with legal values!
Select property to be tested!
Instances of property-and-node element {?arg2} in class {?arg1} can only contain the same values for property {?arg3} as property {?arg5} in instances of class {?arg4}!
A legal document giving official permission to do something with the resource.
License
Incorrect EAN-13 in {?arg1}!
This query flags wrong EAN-13 values.
Please enter the property holding the EAN-13!
EAN-13 All
instance
ean
1
0
1
2
1
2
3
2
3
4
3
4
5
4
5
6
5
6
7
6
7
8
7
8
9
8
9
10
9
10
11
10
11
12
11
12
13
12
13
value
3
check
1
0
10
^[0-9]{13}$
CONSTRUCT
{ _:c0 rdf:type spin:ConstraintViolation .
_:c0 spin:violationRoot ?instance .
_:c0 spin:violationPath ?arg1 .}
WHERE
{ ?instance ?arg1 ?ean
LET (?1 := afn:substr(str(?ean), 0, 1))
LET (?2 := afn:substr(str(?ean), 1, 2))
LET (?3 := afn:substr(str(?ean), 2, 3))
LET (?4 := afn:substr(str(?ean), 3, 4))
LET (?5 := afn:substr(str(?ean), 4, 5))
LET (?6 := afn:substr(str(?ean), 5, 6))
LET (?7 := afn:substr(str(?ean), 6, 7))
LET (?8 := afn:substr(str(?ean), 7, 8))
LET (?9 := afn:substr(str(?ean), 8, 9))
LET (?10 := afn:substr(str(?ean), 9, 10))
LET (?11 := afn:substr(str(?ean), 10, 11))
LET (?12 := afn:substr(str(?ean), 11, 12))
LET (?13 := afn:substr(str(?ean), 12, 13))
LET (?value := ( ( ( ( ( ( ( xsd:int(?2) + xsd:int(?4) ) + xsd:int(?6) ) + xsd:int(?8) ) + xsd:int(?10) ) + xsd:int(?12) ) * 3 ) + ( ( ( ( ( xsd:int(?1) + xsd:int(?3) ) + xsd:int(?5) ) + xsd:int(?7) ) + xsd:int(?9) ) + xsd:int(?11) ) ))
LET (?check := afn:substr(str(?value), ( fn:string-length(str(?value)) - 1 ), fn:string-length(str(?value))))
FILTER ( ( ( ( xsd:int(?check) + xsd:int(?13) ) != 0 ) && ( ( xsd:int(?check) + xsd:int(?13) ) != 10 ) ) || ( ! regex(str(?ean), "^[0-9]{13}$") ) )
}
mandatory literal value check in instances of a class
Select class to be tested!
Mandatory literals in {?arg2} of class {?arg1}!
Select property to be tested!
This query returns all instances of class ?arg1 where the literal for ?arg2 is empty. It does not return instances where the whole property ?arg2 is missing.
s
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
?s a ?arg1 .
?s ?arg2 ""^^xsd:string .
}
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (!regex(str(?value), "^([0-9])*$"^^xsd:string))
}
s
value
^([0-9])*$
This query flags all instances with property ?arg1 that have characters other than numbers as literal values.
Select property to be tested!
Syntax rule: only numbers allowed in {?arg1}!
syntax check in all instances: only numbers allowed
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?a .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
?a a ?arg1 .
?a ?arg2 ?uniqueValue1 .
?b a ?arg1 .
?b ?arg2 ?uniqueValue2 .
FILTER ((str(?uniqueValue1) = str(?uniqueValue2)) && (?a != ?b))
}
a
uniqueValue1
b
uniqueValue2
Uniqueness check for all values in instances of a class
Select property to be tested! {@en}
{?arg2} in {?arg1} must be unique!
This query returns all instances of class ?arg1 where the value for property ?arg2 is not unique in the tested data set. The query tolerates chaotic language tag assignments.
Select class that contains instances to be tested!
Select property 2 of functional dependency!
Select class that holds instances to be tested!
Enter functionally dependent value 1 of property 1!
Value "{?arg3}" of {?arg2} must only have value "{?arg5}" in {?arg4} in instances of class {?arg1}!
Enter functionally dependent value 2 of property 2!
This query flags instances of class ?arg1 with property ?arg2 and value ?arg3 that do not have value ?arg5 with property ?arg4. It is only suitable for value dependencies with one to one cardinality. The query does not tolerate homonyms. Not defined dependencies will not be flagged.
exclusive functional dependency check in class instances
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?this .
_:b0 spin:violationPath ?arg4 .
}
WHERE {
?this a ?arg1 .
?this ?arg2 ?arg3 .
FILTER (!spl:hasValue(?this, ?arg4, ?arg5))
}
Select property 1 of functional dependency!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (smf:cast(?value, xsd:decimal) > ?arg2)
}
s
value
Upper limit check in all instances
Enter upper limit!
Select property to be tested!
Values in {?arg1} must be lower than {?arg2}!
This query returns all instances that have a value for property ?arg1 above the user defined limit ?arg2. The query tolerates chaotic datatype assignments.
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg1 .
}
WHERE {
?s ?arg1 ?value .
FILTER (!regex(str(?value), "^([A-Za-z\\. ])*$"^^xsd:string))
}
s
value
^([A-Za-z\. ])*$
syntax check in all instances: only letters and dots allowed
This query flags all instances with property ?arg1 that have characters other than letters or dots in literal values. The query tolerates language tags.
Syntax rule: only letters and dots allowed in {?arg1}!
Select property to be tested!
CONSTRUCT {
_:b0 a spin:ConstraintViolation .
_:b0 spin:violationRoot ?s .
_:b0 spin:violationPath ?arg2 .
}
WHERE {
?s a ?arg1 .
NOT EXISTS {
?s ?arg2 ?value .
}
}
s
value
Property {?arg2} is mandatory but may contain empty literals for instances of class {?arg1}!
Select class that contains instances to be tested!
Mandatory property check in instances of a class
Select property to be tested!
This query returns all instances of class ?arg1 where property ?arg2 is missing. It explicitly tolerates empty literal values in property ?arg2.