SWRL: A Semantic Web Rule Language
Combining OWL and RuleML

Version 0.6 of 30 April 2004

This version:
http://www.daml.org/2004/04/swrl/
Latest version:
http://www.daml.org/rules/proposal/
Previous version:
http://www.daml.org/2003/11/swrl/
Authors:
Ian Horrocks, Department of Computer Science, University of Manchester
Peter F. Patel-Schneider, Bell Labs Research, Lucent Technologies
Harold Boley, National Research Council of Canada
Said Tabet, Macgregor, Inc.
Benjamin Grosof, Sloan School of Management, MIT
Mike Dean, BBN Technologies


Abstract

This document contains a proposal for a Semantic Web Rule Language (SWRL) based on a combination of the OWL DL and OWL Lite sublanguages of the OWL Web Ontology Language with the Unary/Binary Datalog RuleML sublanguages of the Rule Markup Language. SWRL includes a high-level abstract syntax for Horn-like rules in both the OWL DL and OWL Lite sublanguages of OWL. A model-theoretic semantics is given to provide the formal meaning for OWL ontologies including rules written in this abstract syntax. An XML syntax based on RuleML and the OWL XML Presentation Syntax as well as an RDF concrete syntax based on the OWL RDF/XML exchange syntax are also given, along with several examples.

Status of this document

This document was approved by the Joint Committee on 27 April 2004.

Comments on this document are invited. Discussion should take place on www-rdf-rules@w3.org. A repository of issues is being maintained here.


Table of contents


1. Introduction

This document contains a proposal for a Semantic Web Rule Language (SWRL) based on a combination of the OWL DL and OWL Lite sublanguages of the OWL Web Ontology Language with the Unary/Binary Datalog RuleML sublanguages of the Rule Markup Language. The proposal extends the set of OWL axioms to include Horn-like rules. It thus enables Horn-like rules to be combined with an OWL knowledge base. A high-level abstract syntax is provided that extends the OWL abstract syntax described in the OWL Semantics and Abstract Syntax document [OWL S&AS]. An extension of the OWL model-theoretic semantics is also given to provide a formal meaning for OWL ontologies including rules written in this abstract syntax.

The proposed rules are of the form of an implication between an antecedent (body) and consequent (head). The intended meaning can be read as: whenever the conditions specified in the antecedent hold, then the conditions specified in the consequent must also hold.

Both the antecedent (body) and consequent (head) consist of zero or more atoms. An empty antecedent is treated as trivially true (i.e. satisfied by every interpretation), so the consequent must also be satisfied by every interpretation; an empty consequent is treated as trivially false (i.e., not satisfied by any interpretation), so the antecedent must also not be satisfied by any interpretation. Multiple atoms are treated as a conjunction. Note that rules with conjunctive consequents could easily be transformed (via the Lloyd-Topor transformations [Lloyd87]) into multiple rules each with an atomic consequent.

Atoms in these rules can be of the form C(x), P(x,y), sameAs(x,y) or differentFrom(x,y), where C is an OWL description, P is an OWL property, and x,y are either variables, OWL individuals or OWL data values. It is easy to see that OWL DL becomes undecidable when extended in this way as rules can be used to simulate role value maps [Schmidt-Schauß89].

An XML syntax is also given for these rules based on RuleML and the OWL XML presentation syntax. Furthermore, an RDF concrete syntax based on the OWL RDF/XML exchange syntax is presented. The rule syntaxes are illustrated with several running examples. Finally, we give usage suggestions and cautions.


2. Abstract Syntax

The syntax for SWRL in this section abstracts from any exchange syntax for OWL and thus facilitates access to and evaluation of the language. This syntax extends the abstract syntax of OWL described in the OWL Semantcs and Abstract Syntax document [OWL S&AS]. Even this abstract syntax is not particularly readable for rules. Examples will thus often be given in an informal syntax. This informal syntax will neither be given an exact syntax nor a mapping to any of the fully-specified syntaxes for SWRL.

The abstract syntax is specified here by means of a version of Extended BNF, very similar to the EBNF notation used for XML [XML]. Terminals are quoted; non-terminals are bold and not quoted. Alternatives are either separated by vertical bars (|) or are given in different productions. Components that can occur at most once are enclosed in square brackets ([…]); components that can occur any number of times (including zero) are enclosed in braces ({…}). Whitespace is ignored in the productions here.

Names in the abstract syntax are RDF URI references [RDF Concepts]. These names may be abbreviated into qualified names, using one of the following namespace names:

Namespace nameNamespace
rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfshttp://www.w3.org/2000/01/rdf-schema#
xsdhttp://www.w3.org/2001/XMLSchema#
owlhttp://www.w3.org/2002/07/owl#

The meaning of each construct in the abstract syntax is informally described when it is introduced. The formal meaning of these constructs is given in Section 3 via an extension of the OWL DL model-theoretic semantics [OWL S&AS].

2.1. Rules

An OWL ontology in the abstract syntax contains a sequence of axioms and facts. Axioms may be of various kinds, e.g., subClass axioms and equivalentClass axioms. It is proposed to extend this with rule axioms.

axiom ::= rule 

A rule axiom consists of an antecedent (body) and a consequent (head), each of which consists of a (posibly empty) set of atoms. A rule axiom can also be assigned a URI reference, which could serve to identify the rule.

rule ::= 'Implies(' [ URIreference ] { annotation } antecedent consequent ')'
antecedent ::= 'Antecedent(' { atom } ')'
consequent ::= 'Consequent(' { atom } ')'

Informally, a rule may be read as meaning that if the antecedent holds (is "true"), then the consequent must also hold. An empty antecedent is treated as trivially holding (true), and an empty consequent is treated as trivially not holding (false). Rules with an empty antecedent can thus be used to provide unconditional facts; however such unconditional facts are better stated in OWL itself, i.e., without the use of the rule construct. Non-empty antecedents and consequents hold iff all of their constituent atoms hold, i.e., they are treated as conjunctions of their atoms. As mentioned above, rules with conjunctive consequents could easily transformed (via the Lloyd-Topor transformations [Lloyd87]) into multiple rules each with an atomic consequent.

atom ::= description '(' i-object ')'
	 | dataRange '(' d-object ')'
	 | individualvaluedPropertyID '(' i-object i-object ')'
	 | datavaluedPropertyID '(' i-object d-object ')'
	 | sameAs '(' i-object i-object ')'
	 | differentFrom '(' i-object i-object ')'
	 | builtIn '(' builtinID { d-object } ')'
builtinID ::= URIreference

Atoms can be of the form C(x), P(x,y), sameAs(x,y) differentFrom(x,y), or builtIn(r,x,...) where C is an OWL description or data range, P is an OWL property, r is a built-in relation, x and y are either variables, OWL individuals or OWL data values, as appropriate. In the context of OWL Lite, descriptions in atoms of the form C(x) may be restricted to class names.

Informally, an atom C(x) holds if x is an instance of the class description or data range C, an atom P(x,y) holds if x is related to y by property P, an atom sameAs(x,y) holds if x is interpreted as the same object as y, an atom differentFrom(x,y) holds if x and y are interpreted as different objects, and builtIn(r,x,...) holds if the built-in relation r (see Sections 3 and 8) holds on the interpretations of the arguments. Note that the sameAs and differentFrom two forms can be seen as "syntactic sugar": they are convenient, but do not increase the expressive power of the language (i.e., such (in)equalities can already be expressed using the combined power of OWL and rules without explicit (in)equality atoms).

i-object ::= i-variable | individualID
d-object ::= d-variable | dataLiteral

Atoms may refer to individuals, data literals, individual variables or data variables. Variables are treated as universally quantified, with their scope limited to a given rule. As usual, only variables that occur in the antecedent of a rule may occur in the consequent (a condition usually referred to as "safety"). This safety condition does not, in fact, restrict the expressive power of the language (because existentials can already be captured using OWL someValuesFrom restrictions).

i-variable ::= 'I-variable(' URIreference ')'
d-variable ::= 'D-variable(' URIreference ')'

2.2. Human Readable Syntax

While the abstract EBNF syntax is consistent with the OWL specification, and is useful for defining XML and RDF serialisations, it is rather verbose and not particularly easy to read. In the following we will, therefore, often use a relatively informal "human readable" form similar to that used in many published works on rules.

In this syntax, a rule has the form:

antecedentconsequent

where both antecedent and consequent are conjunctions of atoms written a1 ∧ ... ∧ an. Variables are indicated using the standard convention of prefixing them with a question mark (e.g., ?x). Using this syntax, a rule asserting that the composition of parent and brother properties implies the uncle property would be written:

parent(?x,?y) ∧ brother(?y,?z) ⇒ uncle(?x,?z)

In this syntax, built-in relations that are functional can be written in functional notation, i.e., op:numeric-add(?x,3,?z) can be written instead as

?x = op:numeric-add(3,?z)

3. Direct Model-Theoretic Semantics

The model-theoretic semantics for SWRL is a straightforward extension of the semantics for OWL given in the OWL Semantics and Abstract Syntax document [OWL S&AS]. The basic idea is that we define bindings, extensions of OWL interpretations that also map variables to elements of the domain. A rule is satisfied by an interpretation iff every binding that satisfies the antecedent also satisfies the consequent. The semantic conditions relating to axioms and ontologies are unchanged, e.g., an interpretation satisfies an ontology iff it satisfies every axiom (including rules) and fact in the ontology.

3.1. Interpreting Rules

From the OWL Semantics and Abstract Syntax document we recall that, given a datatype map D, an abstract OWL interpretation is a tuple of the form

I = <R, EC, ER, L, S, LV>

where R is a set of resources, LV ⊆ R is a set of literal values, EC is a mapping from classes and datatypes to subsets of R and LV respectively, ER is a mapping from properties to binary relations on R, L is a mapping from typed literals to elements of LV, and S is a mapping from individual names to elements of EC(owl:Thing). To handle the built-in relations, we augment the datatype map to map the built-in relations to tuples over the appropriate sets. That is, op:numeric-add is mapped into the triples of numeric values that correctly interpret numeric addition.

Note that allowing the datatype map to vary allows different implementations of SWRL to implement different built-in relations. It is suggested that if a SWRL implementation implements a particular datatype, then it implement the built-ins for that datatype from Section 8.

Given an abstract OWL interpretation Ι, a binding B(Ι) is an abstract OWL interpretation that extends Ι such that S maps i-variables to elements of EC(owl:Thing) and L maps d-variables to elements of LV respectively. An atom is satisfied by an interpretation Ι under the conditions given in the Interpretation Conditions Table, where C is an OWL DL description, D is an OWL DL data range, P is an OWL DL individualvalued property, Q is an OWL DL datavalued property, f is a built-in relation, x,y are variables or OWL individuals, and z is a variable or an OWL data value.

Interpretation Conditions Table
AtomCondition on Interpretation
C(x) S(x) ∈ EC(C)
D(z) S(z) ∈ EC(D)
P(x,y) <S(x),S(y)> ∈ ER(P)
Q(x,z) <S(x),L(z)> ∈ ER(Q)
sameAs(x,y) S(x) = S(y)
differentFrom(x,y) S(x) ≠ S(y)
builtIn(r,z1,...,zn) <S(z1),...,S(zn)> ∈ D(f)

Note that this interpretation of the built-in relations is very permissive. It is not necessary for a built-in relation to have a fixed arity, nor is it an error to use a built-in relation with a fixed arity with the wrong number of arguments. For example builtIn(op:numeric-add ?x 5) is simply unsatisfiable, and not a syntax error.

A binding B(Ι) satisfies an antecedent A iff A is empty or B(Ι) satisfies every atom in A. A binding B(Ι) satisfies a consequent C iff C is not empty and B(Ι) satisfies every atom in C. A rule is satisfied by an interpretation Ι iff for every binding B such that B(Ι) satisfies the antecedent, B(Ι) also satisfies the consequent.

Note that rule annotations have no semantic consequences and neither do the URI references associated with rules. This is different from the situation for OWL itself, where annotations do not have semantic consequences.

The semantic conditions relating to axioms and ontologies are unchanged. In particular, an interpretation satisfies an ontology iff it satisfies every axiom (including rules) and fact in the ontology; an ontology is consistent iff it is satisfied by at least one interpretation; an ontology O2 is entailed by an ontology O1 iff every interpretation that satisfies O1 also satisfies O2.


4. Example Rules

Example 4.1-1

A simple use of these rules would be to assert that the combination of the hasParent and hasBrother properties implies the hasUncle property. Informally, this rule could be written as:

hasParent(?x1,?x2) ∧ hasBrother(?x2,?x3) ⇒ hasUncle(?x1,?x3) 

In the abstract syntax the rule would be written like:

Implies(Antecedent(hasParent(I-variable(x1) I-variable(x2))
		   hasBrother(I-variable(x2) I-variable(x3)))
	Consequent(hasUncle(I-variable(x1) I-variable(x3))))

From this rule, if John has Mary as a parent and Mary has Bill as a brother then John has Bill as an uncle.

Example 4.1-2

An even simpler rule would be to assert that Students are Persons, as in Student(?x1) ⇒ Person(?x1).

Implies(Antecedent(Student(I-variable(x1)))
	Consequent(Person(I-variable(x1))))

However, this kind of use for rules in OWL just duplicates the OWL subclass facility. It is logically equivalent to write instead

Class(Student partial Person)

or

SubClassOf(Student Person)

which would make the information directly available to an OWL reasoner.

Example 4.1-3

A very common use for rules is to move property values from one individual to a related individual, as in the following example that expresses the fact that the style of an art object is the same as the style of the creator.

Artist(?x) & artistStyle(?x,?y) & Style(?y) & creator(?z,?x) ⇒ style/period(?z,?y)
Implies(Antecedent(Artist(I-variable(x)) 
		   artistStyle(I-variable(x) I-variable(y))
		   Style(I-variable(y))
		   creator(I-variable(z) I-variable(x)))
	Consequent(style/period(I-variable(z) I-variable(y))))
Example 4.1-4

It is useful to include OWL descriptions in rules, instead of using named classes. The above rule could be augmented with a separate rule to provide information about exclusivity of style (assuming that style is not always exclusive).

Artist(?x) & (≤1 artistStyle)(?x) & creator(?z,?x) ⇒ (≤1 style/period)(?z)
Implies(Antecedent(Artist(I-variable(x)) 
		   (restriction(artistStyle maxCardinality(1)))(I-variable(x))
		   Style(I-variable(y))
		   creator(I-variable(z) I-variable(x)))
	Consequent((restriction(style/period maxCardinality(1)))(I-variable(z))))

5. XML Concrete Syntax

The XML Concrete Syntax is a combination of the OWL Web Ontology Language XML Presentation Syntax [OWL XML] with the RuleML XML syntax [RuleML]. This has several advantages:

An XML Schema for the SWRL XML Concrete Syntax is swrlx.xsd. swrlx.xsd currently references a local copy of the XML Schema for the OWL XML Presentation Syntax modified to allow external references to several of its elements and attributes and to define owlx:datarange, which appears to be a missing piece of the OWL XML Presentation Syntax.

The SWRL XML Concrete Syntax uses the namespaces http://www.w3.org/2003/11/swrlx, http://www.w3.org/2003/11/ruleml, http://www.w3.org/2003/05/owl-xml (owlx), and http://www.w3.org/2001/XMLSchema (xsd).

The Ontology root element of the OWL XML Presentation Syntax is extended to include "imp" (implication rule) and "var" (variable declaration) axioms as found under the rulebase root of RuleML.

element Ontology
<swrlx:Ontology
  swrlx:name = xsd:anyURI 
>
  Content: (owlx:VersionInfo | owlx:PriorVersion | owlx:BackwardCompatibleWith | 
            owlx:IncompatibleWith | owlx:Imports | owlx:Annotation | 
            owlx:Class[axiom] | owlx:EnumeratedClass(D,F) | 
            owlx:SubClassOf(D,F) | owlx:EquivalentClasses | owlx:DisjointClasses(D,F) | 
            owlx:DatatypeProperty | owlx:ObjectProperty | 
            owlx:SubPropertyOf | owlx:EquivalentProperties | 
            owlx:Individual[axiom] | owlx:SameIndividual | owlx:DifferentIndividuals |
            ruleml:imp[axiom] | ruleml:var[axiom])* 
</swrlx:Ontology>
Attribute: swrlx:name - refers to a name of this ontology, which is the base URI of this element.
Note: This is the root element of OWL documents in the XML presentation syntax, while rdf:RDF is used as the document root for OWL in RDF/XML.

We then simply need to add the relevant syntax for variables and rules.

Variable (var) axioms are statements about variables, indicating that the given string is to be used as a variable.

element ruleml:var[axiom]
<ruleml:var>xsd:string</ruleml:var>
Parents: swrlx:Ontology

A var axiom simply defines the existence of a variable. This is taken from the RuleML namespace. For example:

Example 5-1
<ruleml:var>x1</ruleml:var> 

Rule axioms (imp elements) are similar to SubClassOf axioms. They are taken from the RuleML namespace. A rule axiom can be read as a logical implication between the antecedent (_body) and consequent (_head). Like SubClassOf axioms, rules may include annotations. A rule axiom may optionally be named.

element ruleml:imp[axiom]
<ruleml:imp>
  Content: ( _rlab?, owlx:Annotation*, _body, _head )
</ruleml:imp>
Parents: swrlx:Ontology
Note: This element allows one to say that every binding that satisfies the _body of the rule must also satisfy the _head of the rule.

A rule axiom may optionally be named using a URI.

element ruleml:_rlab
<ruleml:_rlab
  ruleml:href = xsd:anyURI (required)
>
  Content: ( )
</ruleml:_rlab>
Parents: ruleml:imp

Both _body and _head are lists of atoms and are read as the conjunction of the component atoms.

element ruleml:_body
<ruleml:_body>
  Content: ( swrlx:atom* )
</ruleml:_body>
Parents: ruleml:imp
element ruleml:_head
<ruleml:_head>
  Content: ( swrlx:atom* )
</ruleml:_head>
Parents: ruleml:imp

Atoms can be formed from unary predicates (classes), binary predicates (properties), equalities or inequalities.

Model group swrlx:atom
  Content: (swrlx:classAtom | swrlx:datarangeAtom | 
            swrlx:individualPropertyAtom | swrlx:datavaluedPropertyAtom | 
            swrlx:sameIndividualAtom | swrlx:differentIndividualsAtom |
            swrlx:builtinAtom)
Parents: ruleml:_body, ruleml:_head

Class atoms consist of a description and either an individual name or a variable name.

element swrlx:classAtom
<swrlx:classAtom>
  Content: ( owlx:description, swrlx:iObject )
</swrlx:classAtom>
Parents: swrlx:atom

The description in a class atom may be a class name, or may be a complex description using boolean combinations, restrictions, etc. For example:

Example 5-2
<swrlx:classAtom> 
  <owlx:Class owlx:name="Person" />
  <ruleml:var>x1</ruleml:var>
</swrlx:classAtom> 

<swrlx:classAtom> 
  <owlx:IntersectionOf>
    <owlx:Class owlx:name="Person" />
    <owlx:ObjectRestriction owlx:property="hasParent"> 
      <owlx:someValuesFrom owlx:class="Physician" />
    </owlx:ObjectRestriction> 
  </owlx:IntersectionOf>
  <ruleml:var>x2</ruleml:var>
</swrlx:classAtom> 

Datarange atoms consist of a data range and either a literal or a variable name.

element swrlx:datarangeAtom
<swrlx:datarangeAtom>
  Content: ( owlx:datarange, swrlx:dObject )
</swrlx:datarangeAtom>
Parents: swrlx:atom

The description in a datarange atom may be a datatype ID, or may be a set of literals. For example:

Example 5-3
<swrlx:datarangeAtom> 
  <owlx:Datatype owlx:name="&xsd;int" />
  <ruleml:var>x1</ruleml:var>
</swrlx:datarangeAtom> 

<swrlx:datarangeAtom> 
  <owlx:OneOf>
    <owlx:DataValue owlx:datatype="&xsd;int">5</owlx:DataValue>
    <owlx:DataValue owlx:datatype="&xsd;int">10</owlx:DataValue>
  </owlx:OneOf>
  <ruleml:var>x2</ruleml:var>
</swrlx:datarangeAtom> 

Property atoms consist of a property name and two elements that can be individual names, variable names or data values.

element swrlx:individualPropertyAtom
<swrlx:individualPropertyAtom
  swrlx:property = xsd:anyURI {required} 
>
  Content: ( swrlx:iObject, swrlx:iObject )
</swrlx:individualPropertyAtom>
Attribute: swrlx:property - a reference to an individual property name
Parents: swrlx:atom
element swrlx:datavaluedPropertyAtom
<swrlx:datavaluedPropertyAtom
  swrlx:property = xsd:anyURI {required} 
>
  Content: ( swrlx:iObject, swrlx:dObject )
</swrlx:datavaluedPropertyAtom>
Attribute: swrlx:property - a reference to an datavalued property name
Parents: swrlx:atom

As OWL does not support complex property descriptions, a property atom takes only a property name. For example:

Example 5-4
<swrlx:individualPropertyAtom  swrlx:property="hasParent"> 
  <ruleml:var>x1</ruleml:var>
  <owlx:Individual owlx:name="John" />
</swrlx:individualPropertyAtom> 

<swrlx:datavaluedPropertyAtom  swrlx:property="grade"> 
  <ruleml:var>x1</ruleml:var>
  <owlx:DataValue owlx:datatype="&xsd;int">4</owlx:DataValue>
</swrlx:datavaluedPropertyAtom> 

Same (different) individual atoms assert equality (inequality) between sets of individual and variable names.

element swrlx:sameIndividualAtom
<swrlx:sameIndividualAtom>
  Content: ( swrlx:iObject* )
</swrlx:sameIndividualAtom>
Parents: swrlx:atom
element swrlx:differentIndividualsAtom
<swrlx:differentIndividualsAtom>
  Content: ( swrlx:iObject* )
</swrlx:differentIndividualsAtom>
Parents: swrlx:atom

Note that (in)equalities can be asserted between arbitrary combinations of variable names and individual names. For example:

Example 5-5
<swrlx:sameIndividualAtom> 
  <ruleml:var>x1</ruleml:var>
  <ruleml:var>x2</ruleml:var>
  <owlx:Individual owlx:name="Clinton" />
  <owlx:Individual owlx:name="Bill_Clinton" />
</swrlx:sameIndividualAtom> 

Builtin atoms provide an interface to the built-ins.

element swrlx:builtinAtom
<swrlx:builtinAtom
  swrlx:builtin = xsd:anyURI {required} 
>
  Content: ( swrlx:dObject* )
</swrlx:builtinAtom>
Attribute: swrlx:builtin - a reference to a built-in defined in Section 8
Parents: swrlx:atom
Model group swrlx:iObject
  Content: ( owlx:Individual[ID] | ruleml:var[ID] )
Parents: swrlx:classAtom, swrlx:individualPropertyAtom, swrlx:sameIndividualAtom, swrlx:differentIndividualsAtom
Model group swrlx:dObject
  Content: ( owlx:DataValue | ruleml:var[ID] )
Parents: swrlx:datavaluedPropertyAtom
element ruleml:var[ID]
<ruleml:var>xsd:string</ruleml:var>
Parents: swrlx:iObject, swrlx:dObject
Note: This element is used for solely referring to a variable ID, and does not actually define any variable, unlike a var axiom.

5.1. Rule Examples

We can use SWRL to assert that the combination of the hasParent and hasBrother properties implies the hasUncle property:

Example 5.1-1
<ruleml:imp> 
  <ruleml:_rlab ruleml:href="#example1"/>
  <ruleml:_body> 
    <swrlx:individualPropertyAtom  swrlx:property="hasParent"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x2</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="hasBrother"> 
      <ruleml:var>x2</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </swrlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:individualPropertyAtom  swrlx:property="hasUncle"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </swrlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

An alternative formulation for the hasUncle rule given in Example 5.1-1 would be to assert that if x1 hasParent x2, x2 hasSibling x3, and x3 hasSex male, then x1 hasUncle x3:

Example 5.1-2
<ruleml:imp> 
  <ruleml:_rlab ruleml:href="#example2"/>
  <ruleml:_body> 
    <swrlx:individualPropertyAtom  swrlx:property="hasParent"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x2</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="hasSibling"> 
      <ruleml:var>x2</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="hasSex"> 
      <ruleml:var>x3</ruleml:var>
      <owlx:Individual owlx:name="#male" />
    </swrlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:individualPropertyAtom  swrlx:property="hasUncle"> 
      <ruleml:var>x1</ruleml:var>
      <ruleml:var>x3</ruleml:var>
    </swrlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

The following example is due to Guus Schreiber, and is based on ontologies used in an image annotation demo.

The rule expresses the fact that, given knowledge about the AAT style of certain ULAN artists (e.g., van Gogh is an Impressionist painter), we can derive the style of an art object (represented with the VRA element "style/period") from the value of the creator of the art object (represented by the VRA element "creator", a subproperty of dc:creator):

Example 5.1-3
<ruleml:imp> 
  <ruleml:_body> 
    <swrlx:classAtom> 
      <owlx:Class owlx:name="&ulan;Artist" />
      <ruleml:var>x</ruleml:var>
    </swrlx:classAtom> 
    <swrlx:classAtom> 
      <owlx:Class owlx:name="&aat;Style" />
      <ruleml:var>y</ruleml:var>
    </swrlx:classAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="&aatulan;artistStyle"> 
      <ruleml:var>x</ruleml:var>
      <ruleml:var>y</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="&vra;creator"> 
      <ruleml:var>x</ruleml:var>
      <ruleml:var>z</ruleml:var>
    </swrlx:individualPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:individualPropertyAtom  swrlx:property="&vra;style/period"> 
      <ruleml:var>z</ruleml:var>
      <ruleml:var>y</ruleml:var>
    </swrlx:individualPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

The following is taken from an extended example due to Mike Dean. It expresses the fact that for every Airport there is a map Point that has the same location (latitude and longitude) as the Airport and that is an object of "layer" (a map DrawingLayer). Moreover, this map point has the Airport as an underlyingObject and has the Airport name as its Label

Note how the expressive power of SWRL allows "existentials" to be expressed in the head of a rule--it is asserted that, for every airport, there must exist such a map point.

Example 5.1-4
<!--
Background knowledge about airports and maps:
-->

<owlx:DatatypeProperty owlx:name="latitude"/>
<owlx:DatatypeProperty owlx:name="longitude"/>

<owlx:SubClassOf> 
  <owlx:sub> 
    <owlx:Class owlx:name="Location" />
  </owlx:sub> 
  <owlx:super> 
    <owlx:IntersectionOf>
      <owlx:DataRestriction owlx:property="latitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
      <owlx:DataRestriction owlx:property="longitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
    </owlx:IntersectionOf>
  </owlx:super> 
</owlx:SubClassOf> 

<owlx:Individual owlx:name="&airport;GEG">
  <owlx:type owlx:name="&airport-ont;Airport" /> 
  <owlx:DataPropertyValue owlx:property="airport-ont:name">
    <owlx:DataValue owlx:datatype="&xsd;string">Spokane Intl</owlx:DataValue> 
  </owlx:DataPropertyValue>
  <owlx:ObjectPropertyValue owlx:property="location">
    <owlx:Individual>
      <owlx:DataPropertyValue owlx:property="latitude">
        <owlx:DataValue>47.6197</owlx:DataValue> 
      </owlx:DataPropertyValue>
      <owlx:DataPropertyValue owlx:property="longitude">
        <owlx:DataValue>-117.5336</owlx:DataValue> 
      </owlx:DataPropertyValue>
    </owlx:Individual>
  </owlx:ObjectPropertyValue>
</owlx:Individual>
 
<owlx:Individual owlx:name="layer">
  <owlx:type owlx:name="&map;DrawingLayer" /> 
</owlx:Individual>
 
<owlx:Individual owlx:name="map">
  <owlx:type owlx:name="&map;Map" /> 
  <owlx:DataPropertyValue owlx:property="&map;name">
    <owlx:DataValue owlx:datatype="&xsd;string">Airports</owlx:DataValue> 
  </owlx:DataPropertyValue>
  <owlx:ObjectPropertyValue owlx:property="map:layer">
    <owlx:Individual owlx:name="layer"/>
  </owlx:ObjectPropertyValue>
</owlx:Individual>

<!--
A map:Location has latitude and longitude, both of which are doubles:
-->

<owlx:SubClassOf> 
  <owlx:sub> 
    <owlx:Class owlx:name="&map;Location" />
  </owlx:sub> 
  <owlx:super> 
    <owlx:IntersectionOf>
      <owlx:DataRestriction owlx:property="&map;latitude"> 
        <owlx:someValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
      <owlx:DataRestriction owlx:property="&map;latitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
      <owlx:DataRestriction owlx:property="&map;longitude"> 
        <owlx:someValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
      <owlx:DataRestriction owlx:property="&map;longitude"> 
        <owlx:allValuesFrom owlx:datatype="&xsd;double"/>
      </owlx:DataRestriction> 
    </owlx:IntersectionOf>
  </owlx:super> 
</owlx:SubClassOf> 

<!--
If a map:Location is the sameLocation as another location, 
then it has the same values for latitude and longitude.
-->

<ruleml:imp> 
  <ruleml:_body> 
    <swrlx:classAtom> 
      <owlx:Class owlx:name="&map;Location" />
      <ruleml:var>maploc</ruleml:var>
    </swrlx:classAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="sameLocation"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>maploc</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="latitude"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>lat</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="longitude"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>lon</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&map;latitude"> 
      <ruleml:var>maploc</ruleml:var>
      <ruleml:var>lat</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&map;longitude"> 
      <ruleml:var>maploc</ruleml:var>
      <ruleml:var>lon</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

<!--
Wherever an Airport is located, there is some map:Location
that is the sameLocation as the Airport's location, and that
is the location of a map Point that is an object of the
map:DrawingLayer "layer":
-->

<owlx:ObjectProperty owlx:name="&map;location" owlx:inverseOf="&map;isLocationOf" />
<owlx:ObjectProperty owlx:name="&map;object" owlx:inverseOf="&map;isObjectOf" />

<ruleml:imp> 
  <ruleml:_body> 
    <swrlx:classAtom> 
      <owlx:Class owlx:name="&airport-ont;Airport" />
      <ruleml:var>airport</ruleml:var>
    </swrlx:classAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="location"> 
      <ruleml:var>airport</ruleml:var>
      <ruleml:var>loc</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="latitude"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>lat</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="longitude"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>lon</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:classAtom> 
      <owlx:ObjectRestriction owlx:property="sameLocation"> 
        <owlx:someValuesFrom>
          <owlx:IntersectionOf>
            <owlx:Class owlx:name="&map;Location" />
            <owlx:ObjectRestriction owlx:property="&map;isLocationOf"> 
              <owlx:someValuesFrom>
                <owlx:IntersectionOf>
                  <owlx:Class owlx:name="&map;Point" />
                  <owlx:ObjectRestriction owlx:property="&map;isObjectOf"> 
                    <owlx:someValuesFrom>
                      <owlx:OneOf>
                        <owlx:Individual owlx:name="#layer" /> 
                      </owlx:OneOf>
                    </owlx:someValuesFrom>
                  </owlx:ObjectRestriction>
                </owlx:IntersectionOf>
              </owlx:someValuesFrom>
            </owlx:ObjectRestriction>
          </owlx:IntersectionOf>
        </owlx:someValuesFrom>
      </owlx:ObjectRestriction> 
      <ruleml:var>loc</ruleml:var>
    </swrlx:classAtom> 
  </ruleml:_head> 
</ruleml:imp> 

<!--
The map:Point whose map:location is the map:Location of an Airport 
has the airport as a map:underlyingObject and has a map:label 
which is the name of the Airport.
-->

<ruleml:imp> 
  <ruleml:_body> 
    <swrlx:classAtom> 
      <owlx:Class owlx:name="&airport-ont;Airport" />
      <ruleml:var>airport</ruleml:var>
    </swrlx:classAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="location"> 
      <ruleml:var>airport</ruleml:var>
      <ruleml:var>loc</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="sameLocation"> 
      <ruleml:var>loc</ruleml:var>
      <ruleml:var>maploc</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:individualPropertyAtom  swrlx:property="&map;location"> 
      <ruleml:var>point</ruleml:var>
      <ruleml:var>maploc</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&airport-ont;name"> 
      <ruleml:var>airport</ruleml:var>
      <ruleml:var>name</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_body> 
  <ruleml:_head> 
    <swrlx:individualPropertyAtom  swrlx:property="&map;underlyingObject"> 
      <ruleml:var>point</ruleml:var>
      <ruleml:var>airport</ruleml:var>
    </swrlx:individualPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&map;label"> 
      <ruleml:var>point</ruleml:var>
      <ruleml:var>name</ruleml:var>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

The following ontology translation example shows the use of built-ins to convert units of measure:

Example 5.1-5
<ruleml:imp>
  <ruleml:_rlab ruleml:href="#convertLength"/>
  <owlx:Annotation>
    <owlx:Documentation>ex2:lengthInInches = ex1:lengthInFeet * 12</owlx:Documentation>
  </owlx:Annotation>
  <ruleml:_body>
    <swrlx:datavaluedPropertyAtom swrlx:property="&ex1;#lengthInFeet">
      <ruleml:var>instance</ruleml:var>
      <ruleml:var>feet</ruleml:var>
    </swrlx:datavaluedPropertyAtom>
  </ruleml:_body>
  <ruleml:_head>
    <swrlx:builtinAtom swrlx:builtin="&swrlb;#multiply">
      <ruleml:var>inches</ruleml:var>
      <ruleml:var>feet</ruleml:var>
      <owlx:DataValue owlx:datatype="&xsd;#int">12</owlx:DataValue>
    </swrlx:builtinAtom>
    <swrlx:datavaluedPropertyAtom swrlx:property="&ex2;#lengthInInches">
      <ruleml:var>instance</ruleml:var>
      <ruleml:var>inches</ruleml:var>
    </swrlx:datavaluedPropertyAtom>
  </ruleml:_head>
</ruleml:imp>

The following example shows the use of built-ins to perform comparisons necessary to compute a discount:

Example 5.1-6
<ruleml:imp> 
  <ruleml:_rlab ruleml:href="#goldDiscount"/>
  <owlx:Annotation>
    <owlx:Documentation>Gold customers get a 10% discount on purchases of $500 or more</owlx:Documentation>
  </owlx:Annotation>
  <ruleml:_body> 
    <swrlx:individualPropertyAtom  swrlx:property="&ex;#hasStatus"> 
      <ruleml:var>customer</ruleml:var>
      <owlx:Individual owlx:name="&ex;#gold"/>
    </swrlx:individualPropertyAtom> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&ex;#hasTotalPurchase"> 
      <ruleml:var>customer</ruleml:var>
      <ruleml:var>total</ruleml:var>
    </swrlx:datavaluedPropertyAtom>
    <swrlx:builtinAtom  swrlx:builtin="&swrlb;#greaterThanOrEqual">
      <ruleml:var>total</ruleml:var>
      <owlx:DataValue owlx:datatype="&xsd;#int">500</owlx:DataValue>
    </swrlx:builtinAtom>
  </ruleml:_body>
  <ruleml:_head> 
    <swrlx:datavaluedPropertyAtom  swrlx:property="&ex;#hasDiscount"> 
      <ruleml:var>customer</ruleml:var>
      <owlx:DataValue owlx:datatype="&xsd;#int">10</owlx:DataValue>
    </swrlx:datavaluedPropertyAtom> 
  </ruleml:_head> 
</ruleml:imp> 

These examples are also provided as example5.1-1.swrlx, example5.1-2.swrlx, example5.1-3.swrlx, example5.1-4.swrlx, example5.1-5.swrlx, and example5.1-6.swrlx.


6. RDF Concrete Syntax

In this section we present an RDF concrete syntax for the rules. It is straightforward to provide such an RDF concrete syntax for rules, but the presence of variables in rules goes beyond the RDF Semantics. We do not yet know if the intended semantics of the resultant RDF graphs can be described as a semantic extension of RDF.

An RDF Schema for SWRL is swrl.rdf. An OWL ontology for SWRL is swrl.owl. Each of these provides only a partial description of the syntax for SWRL; the OWL ontology is more complete than the RDF Schema.

Translation from the XML Concrete Syntax to RDF/XML could be easily accomplished by extending the XSLT transformation for the OWL XML Presentation syntax [OWL XML].

6.1. Rule Examples in RDF Concrete Syntax

These examples illustrate a suitable rules extension of the OWL RDF/XML syntax. The first example is a repetition of Example 5.1-2 using RDF/XML syntax:

Example 6.1-1
<swrl:Variable rdf:ID="x1"/>
<swrl:Variable rdf:ID="x2"/>
<swrl:Variable rdf:ID="x3"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasParent"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x2" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSibling"/> 
      <swrl:argument1 rdf:resource="#x2" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasSex"/> 
      <swrl:argument1 rdf:resource="#x3" />
      <swrl:argument2 rdf:resource="#male" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&eg;hasUncle"/> 
      <swrl:argument1 rdf:resource="#x1" />
      <swrl:argument2 rdf:resource="#x3" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

This example is a repetition of Example 5.1-3 using RDF/XML syntax:

Example 6.1-2
<swrl:Variable rdf:ID="x"/>
<swrl:Variable rdf:ID="y"/>
<swrl:Variable rdf:ID="z"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&ulan;Artist"/> 
      <swrl:argument1 rdf:resource="#x" />
    </swrl:ClassAtom>
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&aat;Style"/> 
      <swrl:argument1 rdf:resource="#y" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&aatulan;artistStyle"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;creator"/> 
      <swrl:argument1 rdf:resource="#x" />
      <swrl:argument2 rdf:resource="#z" />
    </swrl:IndividualPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="&vra;style/period"/> 
      <swrl:argument1 rdf:resource="#z" />
      <swrl:argument2 rdf:resource="#y" />
    </swrl:IndividualPropertyAtom>
  </ruleml:head> 
</ruleml:Imp> 

This example is a repetition of the complex rule from Example 5.1-4 using RDF/XML syntax:

Example 6.1-3
<swrl:Variable rdf:ID="airport"/>
<swrl:Variable rdf:ID="loc"/>
<swrl:Variable rdf:ID="name"/>
<swrl:Variable rdf:ID="lat"/>
<swrl:Variable rdf:ID="lon"/>
<ruleml:Imp> 
  <ruleml:body rdf:parseType="Collection">
    <swrl:ClassAtom> 
      <swrl:classPredicate rdf:resource="&airport-ont;Airport"/> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
    <swrl:IndividualPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#location"/> 
      <swrl:argument1 rdf:resource="#airport" />
      <swrl:argument2 rdf:resource="#loc" />
    </swrl:IndividualPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#latitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lat" />
    </swrl:DatavaluedPropertyAtom>
    <swrl:DatavaluedPropertyAtom> 
      <swrl:propertyPredicate rdf:resource="#longitude"/> 
      <swrl:argument1 rdf:resource="#loc" />
      <swrl:argument2 rdf:resource="#lon" />
    </swrl:DatavaluedPropertyAtom>
  </ruleml:body>
  <ruleml:head rdf:parseType="Collection"> 
    <swrl:ClassAtom> 
      <swrl:classPredicate>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#sameLocation"/>
          <owl:someValuesFrom>
            <owl:Class>
              <owl:intersectionOf rdf:parseType="Collection">
                <owl:Class rdf:about="&map;Location"/>
                <owl:Restriction>
                  <owl:onProperty rdf:resource="&map;isLocationOf"/>
                  <owl:someValuesFrom>
                    <owl:Class>
                      <owl:intersectionOf rdf:parseType="Collection">
                        <owl:Class rdf:about="&map;Point"/>
                        <owl:Restriction>
                          <owl:onProperty rdf:resource="&map;isObjectOf"/>
                          <owl:someValuesFrom>
                            <owl:Class>
                              <owl:oneOf rdf:parseType="Collection">
                                <owl:Item rdf:resource="#layer"/>
                              </owl:oneOf>
                            </owl:Class>
                          </owl:someValuesFrom>
                        </owl:Restriction>
                      </owl:intersectionOf>
                    </owl:Class>
                  </owl:someValuesFrom>
                </owl:Restriction>
              </owl:intersectionOf>
            </owl:Class>
          </owl:someValuesFrom>
        </owl:Restriction>
      </swrl:classPredicate> 
      <swrl:argument1 rdf:resource="#airport" />
    </swrl:ClassAtom>
  </ruleml:head> 
</ruleml:Imp> 

These examples are also provided as example6.1-1.owl, example6.1-2.owl, and example6.1-3.owl.


7. Usage Suggestions

The general intent of this proposal is to extend OWL DL, and thus to use OWL constructs wherever possible.

7.1. Extensibility and Interoperability Cautions

If users are making extensive use of rules, they may want to restrict the form or expressiveness of the rules they employ, in order to increase interoperability, reusability, extensibility, computational scaleability, or ease of implementation.

A useful restriction in the form of the rules is to limit antecedent and consequent classAtoms to be named classes, where the classes are defined purely in OWL (in the same document or in external OWL documents). Adhering to this format makes it easier to translate rules to or from existing (or future) rule systems, including:

  1. Prolog;
  2. production rules (descended from OPS5);
  3. event-condition-action rules; and
  4. SQL (where views, queries, and facts are all rules).

Adhering to this form also maximises reuse and interoperability of the ontology knowledge in the rules with other OWL-speaking systems that do not necessarily support SWRL.

Users also may want to restrict the expressiveness of the OWL classes and descriptions appearing in rules. One useful restriction on expressivity is Description Logic Programs [Grosof et al 2003] which, e.g., prohibits existentially-quantified knowledge in consequents. Suitably-restricted SWRL rules can be straightforwardly extended to enable procedural attachments and/or nonmonotonic reasoning (negation-as-failure and/or prioritised conflict handling) of the kinds supported in CCI rule systems and in RuleML [RuleML] which facilitates interoperability between those CCI rule systems. Such adherence may thus facilitate combining SWRL knowledge with knowledge from those other rules languages. Suitable restrictions can also improve the empirical tractability of reasoning with rules.

A longer, more detailed version of the above usage suggestions and cautions is available at http://www.daml.org/listarchive/joint-committee/1491.html.


8. Built-Ins

The set of built-ins for SWRL is motivated by a modular approach that will allow further extensions in future releases within a (hierarchical) taxonomy. At the same time, it will provide the flexibility for various implementations to select the modules to be supported with each version of SWRL.

SWRL's built-ins approach is also based on the reuse of existing built-ins in XQuery and XPath, which are themselves based on XML Schema Part 2: Datatypes.

This system of built-ins should also help in the interoperation of SWRL with other Web formalisms by providing an extensible, modular built-ins infrastructure for Semantic Web Languages, Web Services, and Web applications.

SWRL built-ins are used in builtin atoms. For example, swrlx:builtinAtom identifies a built-in using the swrlx:builtin attribute and lists its arguments as subelements.

Swrl built-ins are identified using the http://www.w3.org/2003/11/swrlb namespace.

8.1. Built-Ins for Comparisons

8.2. Math Built-Ins

The following built-ins are defined for various numeric types. For the relation to be satisfied the arguments all have to belong to some numeric type for which the relation is defined.

8.3. Built-Ins for Boolean Values

8.4. Built-Ins for Strings

The following built-ins are defined for strings (only), i.e., not untyped literals with language tags.

8.5. Built-Ins for Date, Time and Duration

The following built-ins are defined for the XML Schema date, time, and duration datatypes, only, as appropriate.

8.6. Built-Ins for URIs

The following built-ins are defined for the XML Schema datatypes related to URIs.

8.7. Built-Ins for Lists

The following built-ins are defined for RDF-style lists. (Note that these built-ins are not usable in OWL DL or OWL Lite as RDF-style lists can only be used as OWL data in OWL Full.)


Acknowledgments

This document was produced as part of the DARPA DAML Program, and has benefited from extensive discussion in the Joint US/EU ad hoc Agent Markup Language Committee, with contributions from Sandro Hawke and Pat Hayes being worthy of particular mention. It has also benefited from the close cooperation of the RuleML initiative, and input from the Semantic Web Services Initiative (SWSI).


References

[Grosof et al 2003]
Description Logic Programs: Combining Logic Programs with Description Logic. Benjamin Grosof, Ian Horrocks, Raphael Volz, Stefan Decker. Proc. WWW2003, Budapest, May 2003. http://www2003.org/cdrom/papers/refereed/p117/p117-grosof.html (also http://ebusiness.mit.edu/bgrosof/#DLP).
[Lloyd87]
Foundations of logic programming (second, extended edition). J. W. Lloyd. Springer series in symbolic computation. Springer-Verlag, New York, 1987.
[OWL Reference]
OWL Web Ontology Language Reference. Mike Dean, Guus Schreiber, Sean Bechhofer, Frank van Harmelen, James Hendler, Ian Horrocks, Deborah L. McGuinness, Peter F. Patel-Schneider, and Lynn Andrea Stein. W3C Recommendation 10 February 2004. Latest version is available at http://www.w3.org/TR/owl-ref/.
[OWL S&AS]
OWL Web Ontology Language Semantics and Abstract Syntax. Peter F. Patel-Schneider, Pat Hayes and Ian Horrocks, eds. W3C Recommendation 10 February 2004. Latest version is available at http://www.w3.org/TR/owl-semantics/.
[OWL XML]
OWL Web Ontology Language XML Presentation Syntax. Masahiro Hori, Jérôme Euzenat, Peter F. Patel-Schneider. W3C Note 11 June 2003
[RDF Concepts]
Resource Description Framework (RDF) Concepts and Abstract Syntax. Graham Klyne, Jeremy J. Carroll, and Brian McBride, eds. W3C Recommendation 10 February 2004. Latest version is available at http://www.w3.org/TR/rdf-concepts/.
[RuleML]
Rule Markup Language Initiative.
[Schmidt-Schauß89]
Subsumption in KL-ONE is Undecidable. M. Schmidt-Schauß. Proc. of KR'89, pages 421-431, Morgan Kaufmann.
[XML]
Extensible Markup Language (XML) 1.0 (Second Edition). Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, and Eve Maler, eds. W3C Recommendation 6 October 2000. Latest version is available at http://www.w3.org/TR/REC-xml/.