SWRL Implementations of RIF
This page discusses interchange between RIF and the Semantic Web Rule Language (SWRL).
Mapping SWRL to BLD
The following is a suggested mapping from SWRL to the RIF Basic Logic Dialect (BLD):
swrl:Ontology is mapped to a rif:Ruleset within a rif:Document.
ruleml:imp is mapped to rif:Forall. ruleml:_body is mapped to rif:if. ruleml:_head is mapped to rif:then. Multi-component heads are mapped into multiple rif:Foralls.
swrl:classAtom, swrl:individualPropertyAtom, swrl:datavaluedPropertyAtom, and swrl:builtinAtom are mapped to rif:Uniterm. These should be reversible provided OWL type information is available for the classes, properties, and builtins mapped to rif:op.
swrl:sameIndividualAtom is mapped to rif:Equal.
swrl:datarangeAtom has not yet been mapped.
swrl:differentIndividualsAtom cannot currently be mapped to BLD.
ruleml:var is mapped to rif:Var.
owlx:Individual is mapped to rif:Const with a rif:type of rif:iri.
owlx:DataValue is mapped to rif:Const with a rif:type of the specified XML Schema datatype.
SWRL2BLD
swrl2bld.xsl is a simple XSLT stylesheet implementing the above mapping from SWRL/XML with named classes only to BLD/XML. It was written by MikeDean shortly after F2F7, and should evolve along with BLD.
Below are several examples of SWRL/XML input and corresponding BLD output.
SWRL/XML |
BLD/XML |
Remaining items to do include:
addressing various TODO's in swrl2bld.xsl
validating the output against the BLD XML Schema
- testing the output in a non-SWRL rule engine