SWRL
Dr. Reynares, Emiliano
ereynares@frsf.utn.edu.ar
SWRL
Overview
“SWRL (Semantic Web Rule Language) is a proposal for a Semantic Web rules language,
which can be combined with an OWL knowledge base.”
• The proposal was submitted in May 2004 to the W3C
• 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.
ANTECEDENT  CONSEQUENT
hasParent(?x1,?x2) ∧ hasBrother(?x2,?x3) ⇒ hasUncle(?x1,?x3)
SWRL
• Antecedent (body) and consequent (head) consist of zero or more atoms
• Multiple atoms are treated as a conjunction
• 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
• 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
SWRL – Built-Ins
Enable the following operations:
1. Comparisons
2. Mathematical operations
3. String operations
4. Date, Time and Duration
SWRL – Built-Ins for Comparisons
• equal
Satisfied iff the first argument and the second argument are the same
• notEqual
The negation of swrlb:equal
• lessThan
Satisfied iff the first argument and the second argument are both in some implemented
type and the first argument is less than the second argument according to a type-specific
ordering (partial or total), if there is one defined for the type
• lessThanOrEqual
Either less than, as above, or equal, as above
• greaterThan
Similarly to lessThan
• greaterThanOrEqual
Similarly to swrlb:lessThanOrEqual
SWRL – Built-Ins for Mathematical Operations
• add
Satisfied iff the first argument is equal to the arithmetic sum of the second argument
through the last argument
• subtract
Satisfied iff the first argument is equal to the arithmetic difference of the second argument
minus the third argument
• multiply
Satisfied iff the first argument is equal to the arithmetic product of the second argument
through the last argument
• divide
Satisfied iff the first argument is equal to the arithmetic quotient of the second argument
divided by the third argument
SWRL – Built-Ins for String Operations
• stringEqualIgnoreCase
Satisfied iff the first argument is the same as the second argument (upper/lower case
ignored)
• stringConcat
Satisfied iff the first argument is equal to the string resulting from the concatenation of
the strings the second argument through the last argument
• substring
Satisfied iff the first argument is equal to the substring of optional length the fourth
argument starting at character offset the third argument in the string the second
argument
• stringLength
Satisfied iff the first argument is equal to the length of the second argument
SWRL – Built-Ins for Date, Time and Operations
• addDayTimeDurations
Satisfied iff the dayTimeDuration the first argument is equal to the arithmetic sum of the
dayTimeDuration the second argument through the dayTimeDuration the last argument.
• subtractDayTimeDurations
Satisfied iff the dayTimeDuration the first argument is equal to the arithmetic difference
of the dayTimeDuration the second argument minus the dayTimeDuration the third
argument.
SWRL
Resources
• SWRL Specification
http://www.w3.org/Submission/SWRL/

SWRL Overview

  • 1.
  • 2.
    SWRL Overview “SWRL (Semantic WebRule Language) is a proposal for a Semantic Web rules language, which can be combined with an OWL knowledge base.” • The proposal was submitted in May 2004 to the W3C • 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. ANTECEDENT  CONSEQUENT hasParent(?x1,?x2) ∧ hasBrother(?x2,?x3) ⇒ hasUncle(?x1,?x3)
  • 3.
    SWRL • Antecedent (body)and consequent (head) consist of zero or more atoms • Multiple atoms are treated as a conjunction • 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 • 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
  • 4.
    SWRL – Built-Ins Enablethe following operations: 1. Comparisons 2. Mathematical operations 3. String operations 4. Date, Time and Duration
  • 5.
    SWRL – Built-Insfor Comparisons • equal Satisfied iff the first argument and the second argument are the same • notEqual The negation of swrlb:equal • lessThan Satisfied iff the first argument and the second argument are both in some implemented type and the first argument is less than the second argument according to a type-specific ordering (partial or total), if there is one defined for the type • lessThanOrEqual Either less than, as above, or equal, as above • greaterThan Similarly to lessThan • greaterThanOrEqual Similarly to swrlb:lessThanOrEqual
  • 6.
    SWRL – Built-Insfor Mathematical Operations • add Satisfied iff the first argument is equal to the arithmetic sum of the second argument through the last argument • subtract Satisfied iff the first argument is equal to the arithmetic difference of the second argument minus the third argument • multiply Satisfied iff the first argument is equal to the arithmetic product of the second argument through the last argument • divide Satisfied iff the first argument is equal to the arithmetic quotient of the second argument divided by the third argument
  • 7.
    SWRL – Built-Insfor String Operations • stringEqualIgnoreCase Satisfied iff the first argument is the same as the second argument (upper/lower case ignored) • stringConcat Satisfied iff the first argument is equal to the string resulting from the concatenation of the strings the second argument through the last argument • substring Satisfied iff the first argument is equal to the substring of optional length the fourth argument starting at character offset the third argument in the string the second argument • stringLength Satisfied iff the first argument is equal to the length of the second argument
  • 8.
    SWRL – Built-Insfor Date, Time and Operations • addDayTimeDurations Satisfied iff the dayTimeDuration the first argument is equal to the arithmetic sum of the dayTimeDuration the second argument through the dayTimeDuration the last argument. • subtractDayTimeDurations Satisfied iff the dayTimeDuration the first argument is equal to the arithmetic difference of the dayTimeDuration the second argument minus the dayTimeDuration the third argument.
  • 9.