Ontology
imports: spin
version info: 0.1.0
comment: Contains constraint checking axioms for a subset of OWL.

found
type: Variable
var name: found

type
type: Variable
var name: type

restriction
type: Variable
var name: restriction

property
type: Variable
var name: property

someValuesFrom
type: Variable
var name: someValuesFrom

max
type: Variable
var name: max

cardinality
type: Variable
var name: cardinality

label
type: Variable
var name: label

class
type: Variable
var name: class

min
type: Variable
var name: min

Min cardinality constraint
type: Template
comment: Checks for any owl:minCardinality restrictions defined in one of the superclasses of the types of ?this and applies them using closed-world semantics.
subclass of: Templates
body: Construct
  where:
    rest: TriplePath
      subject: type
      path: ModPath
        sub path: subClassOf
        mod min: 0
        mod max: -2
      object: class
    rest:
      subject: class
      predicate: type
      object: Restriction
    rest:
      subject: class
      predicate: arg1
      object: min
    rest:
      subject: class
      predicate: onProperty
      object: property
    rest: Let
      variable: cardinality
    rest: Filter
    rest: Let
      variable: label
    first:
      subject: this
      predicate: type
      object: type
  templates:
    predicate: type
    object: ConstraintViolation
  templates:
    predicate: label
    object: label
  templates:
    predicate: violationRoot
    object: this
  templates:
    predicate: violationPath
    object: property
constraint: Argument
  value type: Property
  predicate: arg1
  comment: the system property (owl:minCardinality or owl:cardinality)
label template: MinCardinality constraint (using {?arg1})

range
type: Variable
var name: range

p
type: Variable
var name: p

value
type: Variable
var name: value

Max cardinality constraint
type: Template
comment: Checks for any owl:maxCardinality/owl:cardinality restrictions defined in one of the superclasses of the types of ?this and applies them using closed-world semantics.
subclass of: Templates
body: Construct
  where:
    first:
      subject: this
      predicate: type
      object: type
    rest:
      first: TriplePath
        subject: type
        path: ModPath
        object: class
  templates:
    predicate: type
    object: ConstraintViolation
  templates:
    predicate: label
    object: label
  templates:
    predicate: violationRoot
    object: this
  templates:
    predicate: violationPath
    object: property
constraint: Argument
  value type: Property
  predicate: arg1
  comment: the system property (owl:maxCardinality or owl:cardinality)
label template: MaxCardinality constraint (using {?arg1})

hasValue
type: Variable
var name: hasValue

All values from constraint
type: Template
subclass of: Templates
comment: Checks for any owl:allValuesFrom restrictions and makes sure that all values of that property (or its sub-properties) at ?this have matching range.
label template: AllValuesFrom constraint
body: Construct
  where:
    rest:
      subject: this
      predicate: type
      object: type
    rest: TriplePath
      subject: type
      path: ModPath
        sub path: subClassOf
        mod max: -2
        mod min: 0
      object: restriction
    rest:
      subject: restriction
      predicate: allValuesFrom
      object: range
    rest:
      subject: restriction
      predicate: onProperty
      object: property
    rest:
      subject: restriction
      predicate: type
      object: Restriction
    rest: TriplePath
      subject: p
      path: ModPath
        sub path: subPropertyOf
        mod max: -2
        mod min: 0
      object: property
    rest:
      subject: this
      predicate: p
      object: value
    rest: Filter
    rest: Let
      variable: label
    first: Filter
  templates:
    predicate: type
    object: ConstraintViolation
  templates:
    predicate: label
    object: label
  templates:
    predicate: violationRoot
    object: this

Has value constraint
type: Template
subclass of: Templates
comment: Verifies that the values specified by owl:hasValue are present.
label template: HasValue constraint
body: Construct
  where: Filter
    expression:
      is URI:
        arg1: this
  where:
    subject: this
    predicate: type
    object: type
  where: TriplePath
    subject: type
    path: ModPath
      sub path: subClassOf
      mod max: -2
      mod min: 0
    object: restriction
  where:
    subject: restriction
    predicate: hasValue
    object: hasValue
  where:
    subject: restriction
    predicate: onProperty
    object: property
  where:
    subject: restriction
    predicate: type
    object: Restriction
  where: Let
    variable: label
    expression:
      build string:
        arg1: Instances of {?type} must have {?hasValue} for {?property}
  templates:
    predicate: type
    object: ConstraintViolation
  templates:
    predicate: label
    object: label
  templates:
    predicate: violationRoot
    object: this
  templates:
    predicate: violationPath
    object: property

Some values from constraint
type: Template
label template: SomeValuesFrom constraint
subclass of: Templates
comment: Checks whether the value types mentioned in owl:someValuesFrom restrictions are present.
body: Construct
  where:
    rest:
      subject: this
      predicate: type
      object: type
    rest: TriplePath
      subject: type
      path: ModPath
        sub path: subClassOf
        mod max: -2
        mod min: 0
      object: restriction
    rest:
      subject: restriction
      predicate: someValuesFrom
      object: someValuesFrom
    rest:
      subject: restriction
      predicate: onProperty
      object: property
    rest:
      subject: restriction
      predicate: type
      object: Restriction
    rest: Filter
    rest: Let
      variable: label
    first: Filter
      expression: isURI
        arg1: this
  templates:
    predicate: type
    object: ConstraintViolation
  templates:
    predicate: label
    object: label
  templates:
    predicate: violationRoot
    object: this
  templates:
    predicate: violationPath
    object: property

rest: Filter
  expression:
    gt:
      arg2: max
      arg1: cardinality
rest: Let
  variable: label
  expression:
    build string:
      arg1: Maximum cardinality of {?max} expected for {?property}
first: Let
  variable: cardinality
  expression:
    cardinality:
      arg1: property

arg1: Minimum cardinality of {?min} expected for {?property}

ModPath
sub path: subClassOf
mod min: 0
mod max: -2

arg1: All values from {?property} must be {?range} violated by {?value}

arg1: Instances of {?type} must have at least one value of type {?someValuesFrom} for {?property}