# Saved by TopBraid on Sun Jan 18 10:51:25 PST 2009 # baseURI: http://topbraid.org/examples/spinsquare # imports: http://spinrdf.org/spin @prefix sp: . @prefix spin: . @prefix xsd: . @prefix spl: . @prefix rdfs: . @prefix rdf: . @prefix owl: . @prefix : . a owl:Ontology ; owl:imports ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string . :InvalidSquare a :Square ; rdfs:label "Invalid square"^^xsd:string ; :height 8 ; :width 9 . :Rectangle a rdfs:Class ; rdfs:label "Rectangle"^^xsd:string ; spin:constraint [ a spl:Attribute ; rdfs:comment "The height of a Rectangle."^^xsd:string ; spl:maxCount 1 ; spl:minCount 1 ; spl:predicate :height ; spl:valueType xsd:integer ] ; spin:constraint [ a spl:Attribute ; rdfs:comment "The width of a Rectangle."^^xsd:string ; spl:maxCount 1 ; spl:minCount 1 ; spl:predicate :width ; spl:valueType xsd:integer ] ; spin:constraint [ a spl:Attribute ; rdfs:comment "The area of a Rectangle, defined as the product of width x height."^^xsd:string ; spl:maxCount 1 ; spl:predicate :area ; spl:valueType xsd:integer ] ; spin:rule [ a sp:Construct ; rdfs:comment "Computes area := width * height"^^xsd:string ; sp:templates ([ sp:object _:b1 ; sp:predicate :area ; sp:subject spin:_this ]) ; sp:where ([ sp:object _:b2 ; sp:predicate :width ; sp:subject spin:_this ] [ sp:object _:b3 ; sp:predicate :height ; sp:subject spin:_this ] [ a sp:Let ; sp:expression [ a sp:mul ; sp:arg1 _:b2 ; sp:arg2 _:b3 ] ; sp:variable _:b1 ]) ] . :Square a rdfs:Class ; rdfs:label "Square"^^xsd:string ; rdfs:subClassOf :Rectangle ; spin:constraint [ a sp:Ask ; rdfs:comment """Width and height of a Square must be equal"""^^xsd:string ; sp:where ([ sp:object _:b4 ; sp:predicate :width ; sp:subject spin:_this ] [ sp:object _:b5 ; sp:predicate :height ; sp:subject spin:_this ] [ a sp:Filter ; sp:expression [ a sp:ne ; sp:arg1 _:b4 ; sp:arg2 _:b5 ] ]) ] . :TestRectangle a :Rectangle ; rdfs:label "Test rectangle"^^xsd:string ; :height 6 ; :width 7 . :area a rdf:Property ; rdfs:label "area"^^xsd:string . :height a rdf:Property ; rdfs:label "height"^^xsd:string . :width a rdf:Property ; rdfs:label "width"^^xsd:string . _:b5 sp:varName "height"^^xsd:string . _:b4 sp:varName "width"^^xsd:string . _:b3 sp:varName "height"^^xsd:string . _:b2 sp:varName "width"^^xsd:string . _:b1 sp:varName "area"^^xsd:string .