The purpose of the SWRL Spatial initiative of 52°North is two-fold:
- to provide the community with OWL ontologies based on OGC Simple Features and the definitions of SWRL built-ins supporting spatial analysis and more
- have a library for download implementing the built-in, and test cases showing how to make use of the built-ins in different scenarios.
Note that this initiative is a completely voluntary effort. We have endorsed Google Wave for ongoing discussions and planning of future work, if you want to participate, contact me in wave (pajoma a t googlewave.com) or via mail if you need an invite (pajoma a t uni-muenster.de)
SWRL, the Semantic Web Rule Language, extends the Web Ontology Language (OWL) with rules. It provides a abstract syntax for Horn-like rules, which can be easily combined with existing knowledge bases. SWRL has the status of a W3C recommendation, its specification is available from here
. Rules expressed in SWRL contain an antecedent (body) with conjunctions and the implied consequent (head) after the arrow ⇒. They can be read as "if-then" statements. The rule "A(?x) ∧ B(?x) ⇒ C(?x)" can accordingly be read as "if x is A and x is B then x is also C ". Further examples (taken from the spec and the Protege Wiki
Person(?p) ^ hasSibling(?p,?s) ^ Man(?s) -> hasBrother(?p,?s)
Parent(?x,?y) ^ hasBrother(?y,?z) -> uncle(?x,?z)
Person(?p) ^ (hasCar = true)(?p) -> Driver(?p)
feat:Feature(?feat) ^ River(?river) ^ annot:represents(?feat, ?river) -> RiverFeature(?feat)
The third example illustrates how to use OWL class expressions, see here
for documentation. The last example makes use of the domain reference, which is establishes a link to a shared vocabulary. In this case, the rule states that, if the feature has a semantic annotation to the concept "River", we can reclassify it as river.
SWRL supports built-ins, which is (according to this source
): "a predicate that takes one or more arguments and evaluates to true if the arguments satisfy the predicate. For example, an equal built-in can be defined to accept two arguments and return true if the arguments are the same. A number of core built-ins for common mathematical and string operations are contained in the SWRL Built-in Submission. ". The following two rules would be examples:
River(?river) ^ Depth(?depth) ^ feat:hasAttribute(?feat, ?attr) ^ annot:represents(?feat, ?river) ^ annot:represents(?attr, ?depth) ^ swrlb:greaterThan(?depth, 5) -> (isNavigable = true) (?feat)
Person(?p) ^ hasName(?p,?n) ^ swrlb:startsWith(?n, "Bob") -> sqwrl:select(?n)
The second example uses a built-in from the Semantic Query-Enhanced Web Rule Language, which can be used to query knowledge bases in OWL.
What is SWRL Spatial?
SWRL adds its own set of built-ins which support topological tests and simple geospatial analysis for ontologies populated with features. The following simple example illustrates how we can make use of the buffer operation to select features which are within a certain region of a river.
River(?river) ^ annot:represents(?feat,?river) ^ feat:hasGeometry(?feat,?geom) ^ swrls:buffer(?feat, ?buffer_result, 500) ^ Feature(?otherfeat) ^ swrls:within(?otherfeat,?buffer_result) -> sqwrl:select(?otherfeat)