SWRL (http://www.w3.org/Submission/SWRL/#2.1) is proposal for a semantic web rules-language, combining sublanguage of the OWL Web Ontology Language (OWL DL and Lite) with those of rule markup language (RuleML). The Rule Markup Language (RuleML) is a markup language developed to express both forward (bottom-up) and backward (top-down) rules in XML for deduction, rewriting, and further inferential-transformational tasks.


SQWRL (Semantic Query-Enhanced Web Rule Language; pronounced squirrel) is a SWRL-based query language that can be used to query OWL ontologies. SQWRL provides SQL-like operations to format knowledge retrieved from an OWL ontology. SQWRL does not alter SWRL’s semantics and uses the standard SWRL presentation syntax supported by the SWRLTab.


Below is the example of SWRL syntax to infer visitor’s location.


representedBy(?visitor ?sensor) ^


–> isLocatedIn(?visitor, ?location)


‘?visitor’, ‘?sensor’ and ‘?location’ are the name of variable. Each variable in SWRL is beginned with question mark (‘?’). ‘representedBy’, ‘isMovingto’ and ‘isLocatedIn’ are the name of property. “^” represent AND relationship. “–>” is read as THEN. Above rule is human readable syntax. From above rule we can say if a visitor representedBy a sensor and a sensor is moving to a location then we can infer new knowledge a visitor is located in location.



Following syntax is XML Concrete Syntax for SWRL. The XML Concrete Syntax is a combination of the OWL Web Ontology Language XML Presentation Syntax with the RuleML XML syntax.




<ruleml:_rlab ruleml:href=”#userLoc”/>


<swrlx:individualPropertyAtom swrlx:property=”representedBy”>




<swrlx:individualPropertyAtom swrlx:property=”isMovingTo”>






<swrlx:individualPropertyAtom swrlx:property=”isLocatedIn”>







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. Variable (var) axioms are statements about variables, indicating that the given string is to be used as a variable. A var axiom simply defines the existence of a variable. This is taken from the RuleML namespace.From this XML COncrete Syntax rule we can see there are 3 variables: visitor, sensor and location.



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). Both _body and _head are lists of atoms and are read as the conjunction of the component atoms. Atoms can be formed from unary predicates (classes), binary predicates (properties), equalities or inequalities.


An alternative formulation for the userLoc rule given in this example would be to assert that if visitor representedBy sensor and sensor isMovingTo location, then visitor isLocatedIn location.