Ontology
version info: Created with TopBraid Composer
imports: spin

Roof
type: Class
subclass of: Thing
constraint: Construct
  templates:
    object: ConstraintViolation
    predicate: type
  templates:
    object: this
    predicate: violationRoot
  templates:
    object:
      var name: predicate
    predicate: violationPath
  templates:
    object: Insert message here
    predicate: label
  where: nil

House
type: Class
subclass of: Restriction
  on class: Roof
  cardinality: 1
  on property: hasPart directly
rule: Construct
  templates:
    predicate: totalCost
    subject: this
  where: Let
    expression:
      sum function:
        arg1: this
subclass of: Thing
subclass of: Restriction
  on class: Wall
  cardinality: 4
  on property: hasPart directly

var name: totalCost

Wall
type: Class
subclass of: Restriction
  on class: WallSegment
  max cardinality: 2
  on property: hasPart directly
subclass of: Thing

sumFunction
type: Class
body: Select
  result variables: Sum
    as:
      var name: totalCost
  where:
    predicate: hasPart transitive
    subject: arg1
  where:
    predicate: cost
  where: Optional
    elements:
      object: arg1
      predicate: hasPart directly
  where: Filter
constraint: Argument
  value type: House
  predicate: arg1
subclass of: Functions
subclass of: Thing

var name: cost

var name: Part

arg1
var name: anotherPart

Wall4
type: Wall
cost: 300

Wall3
type: Wall
cost: 300

Wall2
type: Wall
cost: 300

Wall1
type: Wall
cost: 300
has part directly: WallSegment2
has part directly: WallSegment1

Wall7
type: Wall
cost: 350

Wall8
type: Wall
cost: 350

Wall5
type: Wall
cost: 350
has part directly: WallSegment4
has part directly: WallSegment3

WallSegment4
type: WallSegment
cost: 190

WallSegment3
type: WallSegment
cost: 180

Wall6
type: Wall
cost: 350