var name: 8

var name: s

var name: 5

var name: value

var name: s

var name: s

var name: value

var name: 9

Legal value check in class instances
type: Template
comment: 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.
subclass of: legal value constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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) ) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Optional
    elements:
      object: arg3
      predicate: type
    elements:
      predicate: arg4
    elements: Filter
      expression: eq
        arg1: str
        arg2: str
  where: Filter
    expression: not
      arg1: bound
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class that holds instances with legal values!
  predicate: arg3
  value type: Class
constraint: Argument
  comment: Select property that holds legal values!
  predicate: arg4
  value type: Property
constraint: Argument
  comment: Select class with instances to be tested!
  predicate: arg1
  value type: Class
label template: Instances of class {?arg1} can only contain the same values for property {?arg2} as property {?arg4} in instances of class {?arg3}!

var name: value1

syntax check in all instances: only numbers allowed
type: Template
comment: This query flags all instances with property ?arg1 that have characters other than numbers as literal values.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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)) }
  where:
    predicate: arg1
  where: Filter
    expression: not
      arg1: regex
        arg1: str
        arg2: ^([0-9])*$
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
label template: Syntax rule: only numbers allowed in {?arg1}!

var name: 10

var name: value1

EAN-13 Class
type: Template
comment: This query flags wrong EAN-13 values in instances of a specified class.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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}$") ) ) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Let
    expression: substr
      arg1: str
      arg2: 0
      arg3: 1
  where: Let
    expression: substr
      arg1: str
      arg2: 1
      arg3: 2
  where: Let
    expression: substr
      arg1: str
      arg2: 2
      arg3: 3
  where: Let
    expression: substr
      arg1: str
      arg2: 3
      arg3: 4
  where: Let
    expression: substr
      arg1: str
      arg2: 4
      arg3: 5
  where: Let
    expression: substr
      arg1: str
      arg2: 5
      arg3: 6
  where: Let
    expression: substr
      arg1: str
      arg2: 6
      arg3: 7
  where: Let
    expression: substr
      arg1: str
      arg2: 7
      arg3: 8
  where: Let
    expression: substr
      arg1: str
      arg2: 8
      arg3: 9
  where: Let
    expression: substr
      arg1: str
      arg2: 9
      arg3: 10
  where: Let
    expression: substr
      arg1: str
      arg2: 10
      arg3: 11
  where: Let
    expression: substr
      arg1: str
      arg2: 11
      arg3: 12
  where: Let
    expression: substr
      arg1: str
      arg2: 12
      arg3: 13
  where: Let
    expression: add
      arg1: mul
        arg1: add
        arg2: 3
      arg2: add
        arg1: add
        arg2: int
  where: Let
    expression: substr
      arg1: str
      arg2: sub
        arg1: string-length
        arg2: 1
      arg3: string-length
        arg1: str
  where: Filter
    expression: or
      arg1: and
        arg1: ne
        arg2: ne
      arg2: not
        arg1: regex
constraint: Argument
  comment: Please enter the class holding the instances that shall be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Please enter the property holding the EAN-13!
  predicate: arg2
  value type: Property
label template: Incorrect EAN-13 in {?arg2} of {?arg1} class instances!

var name: b

var name: 1

var name: value2

var name: instance

var name: value1

Legal value check in all instances
type: Template
comment: 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.
subclass of: legal value constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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) ) }
  where:
    predicate: arg1
  where: Optional
    elements:
      object: arg2
      predicate: type
    elements:
      predicate: arg3
    elements: Filter
      expression: eq
        arg1: str
        arg2: str
  where: Filter
    expression: not
      arg1: bound
constraint: Argument
  comment: Select class that holds instances with legal values!
  predicate: arg2
  value type: Class
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Select property that holds legal values!
  predicate: arg3
  value type: Property
label template: Property {?arg1} can only contain the same values as property {?arg3} in instances of class {?arg2}!

var name: 6

var name: value1

Upper limit check in all instances
type: Template
comment: This query returns all instances that have a value for property ?arg1 above the user defined limit ?arg2. The query tolerates chaotic datatype assignments.
subclass of: value range constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg1 . } WHERE { ?s ?arg1 ?value . FILTER (smf:cast(?value, xsd:decimal) > ?arg2) }
  where:
    predicate: arg1
  where: Filter
    expression: gt
      arg1: cast
        arg2: decimal
      arg2: arg2
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Enter upper limit!
  predicate: arg2
  value type: decimal
label template: Values in {?arg1} must be lower than {?arg2}!

Subject
type: AnnotationProperty

var name: value2

var name: s2

legal value constraints
type: Template
comment: Legal value constraints identify values that are either not explicitly allowed or explicitly illegal.
subclass of: data quality constraint templates
abstract: true

var name: value2

Creator
type: AnnotationProperty

var name: 7

var name: s2

var name: 11

var name: 8

var name: 2

Illegal value check in all instances
type: Template
comment: 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.
subclass of: legal value constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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) }
  where:
    predicate: arg1
  where: Optional
    elements:
      object: arg2
      predicate: type
    elements:
      predicate: arg3
    elements: Filter
      expression: eq
        arg1: str
        arg2: str
  where: Filter
    expression: bound
constraint: Argument
  comment: Select property holding the illegal values!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Select class with instances holding the illegal values!
  predicate: arg2
  value type: Class
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
label template: Property {?arg1} cannot have the same values as property {?arg3} in class {?arg2}!

var name: 12

var name: value

syntax check in all instances: only letters allowed
type: Template
comment: This query flags all instances with property ?arg1 that do not have letters as literal values. The query tolerates language tags.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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)) }
  where:
    predicate: arg1
  where: Filter
    expression: not
      arg1: regex
        arg1: str
        arg2: ^([A-Za-z])*$
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
label template: Syntax rule: only letters allowed in {?arg1}!

var name: s2

syntax constraints
type: Template
comment: Syntax constraints identify values that do not adhere to syntactical rules. {@en}
subclass of: data quality constraint templates
abstract: true

var name: from

var name: a

var name: s

var name: ean

Legal value check in blank node instances of a class
type: Template
comment: 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.
subclass of: legal value constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  templates:
    object: arg3
    predicate: violationPath
  text: 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) ) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where:
    predicate: arg3
  where: Optional
    elements:
      object: arg4
      predicate: type
    elements:
      predicate: arg5
    elements: Filter
      expression: eq
        arg1: str
        arg2: str
  where: Filter
    expression: not
      arg1: bound
constraint: Argument
  comment: Select property to be tested!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Select property that holds blank nodes!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class that holds instances with legal values!
  predicate: arg4
  value type: Class
constraint: Argument
  comment: Select class with instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select property that holds legal values!
  predicate: arg5
  value type: Property
label template: 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}!

var name: s

var name: uniqueValue1

var name: s2

var name: 3

var name: a

var name: 13

arg7
type: Property
comment: The seventh argument of a function call.
sub property of: arg

data quality constraint templates
type: Template
comment: 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.
subclass of: Templates
abstract: true

var name: s

var name: s

var name: s2

value range constraints
type: Template
comment: Value range constraints allow the identification of values that do not obey a certain upper and/or lower limit.
subclass of: data quality constraint templates
abstract: true

var name: value

var name: 4

var name: uniqueValue1

uniqueness constraints
type: Template
comment: Uniqueness constraints identify values that shall be unique, but are redundant within a certain data set.
subclass of: data quality constraint templates
abstract: true

var name: value

Inconsistent value range all
type: Template
comment: 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.
subclass of: value range constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  templates:
    object: arg2
    predicate: violationPath
  text: 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 ) }
  where:
    predicate: arg1
  where:
    predicate: arg2
  where: Filter
    expression: ge
constraint: Argument
  comment: Please enter the datatype property that shall hold the lower value!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Please enter the datatype property that shall hold the greater value!
  predicate: arg2
  value type: Property
label template: Value in {?arg1} cannot be greater than value of {?arg2}!

var name: value

var name: value1

syntax check in all instances: only letters and dots allowed
type: Template
comment: This query flags all instances with property ?arg1 that have characters other than letters or dots in literal values. The query tolerates language tags.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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)) }
  where:
    predicate: arg1
  where: Filter
    expression: not
      arg1: regex
        arg1: str
        arg2: ^([A-Za-z\. ])*$
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
label template: Syntax rule: only letters and dots allowed in {?arg1}!

Mandatory property check in instances of a class
type: Template
comment: This query returns all instances of class ?arg1 where property ?arg2 is missing. It explicitly tolerates empty literal values in property ?arg2.
subclass of: missing element constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg2 . } WHERE { ?s a ?arg1 . NOT EXISTS { ?s ?arg2 ?value . } }
  where:
    object: arg1
    predicate: type
  where: NotExists
    elements:
      object:
        var name: value
      predicate: arg2
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class that contains instances to be tested!
  predicate: arg1
  value type: Class
label template: Property {?arg2} is mandatory but may contain empty literals for instances of class {?arg1}!

Title
type: AnnotationProperty

mandatory literal value check in instances of a class
type: Template
comment: 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.
subclass of: missing element constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg2 . } WHERE { ?s a ?arg1 . ?s ?arg2 ""^^xsd:string . }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class to be tested!
  predicate: arg1
  value type: Class
label template: Mandatory literals in {?arg2} of class {?arg1}!

Functional dependency check in blank node instances of a class with trusted reference
type: Template
comment: 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.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg3
    predicate: violationPath
  templates:
    object: arg4
    predicate: violationPath
  text: 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 . } }
  where:
    object: arg1
    predicate: type
  where: Optional
    elements:
      predicate: arg2
    elements: Optional
      elements:
        predicate: arg3
    elements: Optional
      elements:
        predicate: arg4
  where: NotExists
    elements:
      object: arg5
      predicate: type
    elements:
      predicate:
        var name: arg6
    elements:
      predicate:
        var name: arg7
constraint: Argument
  comment: Select property that holds blank nodes!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select first property of trusted reference that holds legal values for property 1!
  predicate: arg6
  value type: Property
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Select class that holds instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select second property of trusted reference that holds legal values for property 2!
  predicate: arg7
  value type: Property
constraint: Argument
  comment: Select class of trusted reference that holds instances with legal value combinations!
  predicate: arg5
  value type: Class
constraint: Argument
  comment: Select property 2 of functional dependency!
  predicate: arg4
  value type: Property
label template: 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}!

var name: instance

var name: s2

var name: s

var name: value

var name: 9

var name: s

var name: s2

Upper limit check in all instances of a class
type: Template
comment: 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.
subclass of: value range constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Filter
    expression: gt
      arg1: cast
        arg2: decimal
      arg2: arg3
constraint: Argument
  comment: Select class that contains instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Enter upper limit!
  predicate: arg3
  value type: decimal
label template: Values in {?arg2} for instances of class {?arg1} must be lower than {?arg3}!

EAN-13 All
type: Template
comment: This query flags wrong EAN-13 values.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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}$") ) ) }
  where:
    predicate: arg1
  where: Let
    expression: substr
      arg1: str
      arg2: 0
      arg3: 1
  where: Let
    expression: substr
      arg1: str
      arg2: 1
      arg3: 2
  where: Let
    expression: substr
      arg1: str
      arg2: 2
      arg3: 3
  where: Let
    expression: substr
      arg1: str
      arg2: 3
      arg3: 4
  where: Let
    expression: substr
      arg1: str
      arg2: 4
      arg3: 5
  where: Let
    expression: substr
      arg1: str
      arg2: 5
      arg3: 6
  where: Let
    expression: substr
      arg1: str
      arg2: 6
      arg3: 7
  where: Let
    expression: substr
      arg1: str
      arg2: 7
      arg3: 8
  where: Let
    expression: substr
      arg1: str
      arg2: 8
      arg3: 9
  where: Let
    expression: substr
      arg1: str
      arg2: 9
      arg3: 10
  where: Let
    expression: substr
      arg1: str
      arg2: 10
      arg3: 11
  where: Let
    expression: substr
      arg1: str
      arg2: 11
      arg3: 12
  where: Let
    expression: substr
      arg1: str
      arg2: 12
      arg3: 13
  where: Let
    expression: add
      arg1: mul
        arg1: add
        arg2: 3
      arg2: add
        arg1: add
        arg2: int
  where: Let
    expression: substr
      arg1: str
      arg2: sub
        arg1: string-length
        arg2: 1
      arg3: string-length
        arg1: str
  where: Filter
    expression: or
      arg1: and
        arg1: ne
        arg2: ne
      arg2: not
        arg1: regex
constraint: Argument
  comment: Please enter the property holding the EAN-13!
  predicate: arg1
  value type: Property
label template: Incorrect EAN-13 in {?arg1}!

Functional dependency check in all instances with trusted reference
type: Template
comment: 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.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  templates:
    object: arg2
    predicate: violationPath
  text: 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 . } }
  where: Optional
    elements:
      predicate: arg1
    elements: Optional
      elements:
        predicate: arg2
  where: NotExists
    elements:
      object: arg3
      predicate: type
    elements:
      predicate: arg4
    elements:
      predicate: arg5
constraint: Argument
  comment: Select first property of trusted reference that holds legal values for property 1!
  predicate: arg4
  value type: Property
constraint: Argument
  comment: Select second property of trusted reference that holds legal values for property 2!
  predicate: arg5
  value type: Property
constraint: Argument
  comment: Select property 2 of functional dependency!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Select class of trusted reference that holds instances with legal value combinations!
  predicate: arg3
  value type: Class
label template: 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!

var name: s

var name: 10

var name: value

Lower limit check in all instances
type: Template
comment: This query returns all instances that have a value for property ?arg1 below the user defined limit ?arg2. The query tolerates chaotic datatype assignments.
subclass of: value range constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg1 . } WHERE { ?s ?arg1 ?value . FILTER (smf:cast(?value, xsd:decimal) < ?arg2) }
  where:
    predicate: arg1
  where: Filter
    expression: lt
      arg1: cast
        arg2: decimal
      arg2: arg2
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Enter lower limit!
  predicate: arg2
  value type: decimal
label template: Values in {?arg1} must be greater than {?arg2}!

exclusive functional dependency check in all instances
type: Template
comment: 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.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg3
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg3 . } WHERE { ?s ?arg1 ?arg2 . FILTER (!spl:hasValue(?s, ?arg3, ?arg4)) }
  where:
    object: arg2
    predicate: arg1
  where: Filter
    expression: not
      arg1: hasValue
        arg2: arg3
        arg3: arg4
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg1
  value type: Property
constraint: Argument
  comment: Select property 2 of functional dependency!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Enter functionally dependent value 1 of property 1!
  predicate: arg2
  value type: string
constraint: Argument
  comment: Enter functionally dependent value 2 of property 2!
  predicate: arg4
  value type: string
label template: Value "{?arg2}" of {?arg1} must only have value "{?arg4}" in {?arg3} in all instances!

Illegal value check in class instances
type: Template
comment: 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.
subclass of: legal value constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Optional
    elements:
      object: arg3
      predicate: type
    elements:
      predicate: arg4
    elements: Filter
      expression: eq
        arg1: str
        arg2: str
  where: Filter
    expression: bound
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class that holds instances with illegal values!
  predicate: arg3
  value type: Class
constraint: Argument
  comment: Select property that holds illegal values!
  predicate: arg4
  value type: Property
constraint: Argument
  comment: Select class with instances to be tested!
  predicate: arg1
  value type: Class
label template: Instances of class {?arg1} cannot have the same values for property {?arg2} as property {?arg4} in class {?arg3}!

var name: b

FunctionalDependentEmptyValueAll
type: Template
comment: This query returns all instances with value ?arg2 for property ?arg1 that do not have an empty literal string for property ?arg3.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg3
    predicate: violationPath
  text: CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?s . _:b0 spin:violationPath ?arg3 . } WHERE { ?s ?arg1 ?arg2 . FILTER (!spl:hasValue(?s, ?arg3, ""^^xsd:string)) }
  where:
    object: arg2
    predicate: arg1
  where: Filter
    expression: not
      arg1: hasValue
        arg2: arg3
constraint: Argument
  comment: Select property that must contain empty literal!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Enter functionally dependent value 1 of property 1!
  predicate: arg2
  value type: string
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg1
  value type: Property
label template: When {?arg1} has value {?arg2}, then {?arg3} has to be empty!

var name: 1

var name: 11

var name: value1

var name: s

Lower limit check in all instances of a class
type: Template
comment: 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.
subclass of: value range constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Filter
    expression: lt
      arg1: cast
        arg2: decimal
      arg2: arg3
constraint: Argument
  comment: Select class that contains instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Enter lower limit! {@en}
  predicate: arg3
  value type: decimal
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
label template: Values in {?arg2} for instances of class {?arg1} must be greater than {?arg3}!

var name: 5

var name: s

functional dependency constraints
type: Template
comment: Functional dependencies are dependencies between the values of two or more different properties. Functional dependency constraints check the abidance of functional dependencies.
subclass of: data quality constraint templates
abstract: true

var name: 2

var name: 12

var name: s

var name: value

var name: uniqueValue2

var name: node

var name: value

var name: 6

var name: check

var name: through

var name: s

var name: value1

var name: value

var name: value1

var name: value

The Data Quality Constraints Library
type: Ontology
comment: 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.
creator: Christian Fuerber, Martin Hepp, and Markus Wischnewski
date: 2011-03-28
subject: Semantic Data Quality Management
License: lgpl.html
imports: spin
version info: V 1.1 Release 2011-03-28

var name: 7

Uniqueness check for all values in a property
type: Template
comment: 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.
subclass of: uniqueness constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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)) }
  where:
    predicate: arg1
  where:
    predicate: arg1
  where: Filter
    expression: and
      arg1: eq
        arg1: str
        arg2: str
      arg2: ne
constraint: Argument
  comment: Select property to be tested!
  predicate: arg1
  value type: Property
label template: Values in {?arg1} must be unique!

missing element constraints
type: Template
comment: Missing element constraints identify elements in the data set that are missing but required.
subclass of: data quality constraint templates
abstract: true

var name: value

Date
type: AnnotationProperty

var name: s

var name: s

var name: s

arg6
type: Property
comment: The sixth argument of a function call.
sub property of: arg

var name: s2

var name: s

var name: uniqueValue2

var name: check

var name: value

Functional dependency check in class instances with trusted reference
type: Template
comment: 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.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  templates:
    object: arg3
    predicate: violationPath
  text: 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 . } }
  where:
    object: arg1
    predicate: type
  where: Optional
    elements:
      predicate: arg2
    elements: Optional
      elements:
        predicate: arg3
  where: NotExists
    elements:
      object: arg4
      predicate: type
    elements:
      predicate: arg5
    elements:
      predicate:
        var name: arg6
constraint: Argument
  comment: Select class that holds instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select property 2 of functional dependency!
  predicate: arg3
  value type: Property
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select second property of trusted reference that holds legal values for property 2!
  predicate: arg6
  value type: Property
constraint: Argument
  comment: Select class of trusted reference that holds instances with legal value combinations!
  predicate: arg4
  value type: Class
constraint: Argument
  comment: Select first property of trusted reference that holds legal values for property 1!
  predicate: arg5
  value type: Property
label template: 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}!

License
type: AnnotationProperty
comment: A legal document giving official permission to do something with the resource.

Mandatory literal value and property check in instances of a class
type: Template
comment: This query returns all instances of class ?arg1 where the literal for ?arg2 is empty or the whole property ?arg2 is missing.
subclass of: missing element constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    object: this
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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 . } } }
  where: Union
    elements:
      object: arg1
      predicate: type
      subject: this
    elements:
      predicate: arg2
      subject: this
    elements:
      object: arg1
      predicate: type
      subject: this
    elements: NotExists
      elements:
        predicate: arg2
        subject: this
constraint: Argument
  comment: Select class that contains intances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select property to be tested!
  predicate: arg2
  value type: Property
label template: Property {?arg2} is mandatory and must not contain empty literals for instances of class {?arg1}!

syntax check in all instances: 5 digit numeric values
type: Template
comment: This query flags all instances that do not have a five digit numeric value for property ?arg1.
subclass of: syntax constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg1
    predicate: violationPath
  text: 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)) }
  where:
    predicate: arg1
  where: Filter
    expression: not
      arg1: regex
        arg1: str
        arg2: ^[0-9]{5}$
constraint: Argument
  comment: Select the property that contains the US zip codes!
  predicate: arg1
  value type: Property
label template: Syntax rule: {?arg1} must contain 5-digit numeric value in all instances!

var name: 3

var name: 13

var name: s

var name: ean

Uniqueness check for all values in instances of a class
type: Template
comment: 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.
subclass of: uniqueness constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    predicate: violationRoot
  templates:
    object: arg2
    predicate: violationPath
  text: 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)) }
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where:
    object: arg1
    predicate: type
  where:
    predicate: arg2
  where: Filter
    expression: and
      arg1: eq
        arg1: str
        arg2: str
      arg2: ne
constraint: Argument
  comment: Select class that contains instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Select property to be tested! {@en}
  predicate: arg2
  value type: Property
label template: {?arg2} in {?arg1} must be unique!

var name: instance

exclusive functional dependency check in class instances
type: Template
comment: 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.
subclass of: functional dependency constraints
body: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    object: this
    predicate: violationRoot
  templates:
    object: arg4
    predicate: violationPath
  text: 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)) }
  where:
    object: arg1
    predicate: type
    subject: this
  where:
    object: arg3
    predicate: arg2
    subject: this
  where: Filter
    expression: not
      arg1: hasValue
        arg1: this
        arg2: arg4
        arg3: arg5
constraint: Argument
  comment: Enter functionally dependent value 2 of property 2!
  predicate: arg5
  value type: string
constraint: Argument
  comment: Select property 2 of functional dependency!
  predicate: arg4
  value type: Property
constraint: Argument
  comment: Select property 1 of functional dependency!
  predicate: arg2
  value type: Property
constraint: Argument
  comment: Select class that holds instances to be tested!
  predicate: arg1
  value type: Class
constraint: Argument
  comment: Enter functionally dependent value 1 of property 1!
  predicate: arg3
  value type: string
label template: Value "{?arg3}" of {?arg2} must only have value "{?arg5}" in {?arg4} in instances of class {?arg1}!

var name: 4

var name: value

var name: node

var name: s

ne
arg1: add
  arg1: int
  arg2: int
arg2: 0

ne
arg1: add
  arg1: int
  arg2: int
arg2: 10

regex
arg1: str
arg2: ^[0-9]{13}$

ne
arg1: add
  arg1: int
  arg2: int
arg2: 0

ne
arg1: add
  arg1: int
  arg2: int
arg2: 10

regex
arg1: str
arg2: ^[0-9]{13}$

var name: value