R u l e M L


Translators between RuleML and RFML

Harold Boley

2001-09-17: Version 0.2

Experimental XSLT translators between the Horn-logic subsets of RuleML and RFML are provided through this page.



This is a first pair of (XSLT-specified) translators exporting/importing RuleML markup to/fro another XML-based rule language, namely the functional-logic programming language RFML (where only the logic part is used here):


The two XML-to-XML stylesheets are quite different, since RFML -- like normal Prolog -- is positional while RuleML is role-based. XML comments in the stylesheets explain the important XSLT-template rules. The XSLT-stylesheet engines used for the translations were both Xalan and Cocoon.

As an example let us consider a roundtrip starting and ending at the sample RuleML business rulebase for discounting (View | Page Source): Its XSLT-annotated RuleML version, discount.ruleml, via ruleml2rfml.xsl, becomes RFML's discount.rfml (already annotated for the alternative continuation below). This, in the XSLT-annotated RFML version discount-roundtrip.rfml, via rfml2ruleml.xsl, becomes RuleML's discount-roundtrip.ruleml. Except for XSLT annotations, comments, and whitespace, this is the same as the original RuleML version.

As an alternative continuation of the example, the intermediate RFML version discount.rfml (XSLT-annotated for viewing), via the XML-to-HTML stylesheet rfmlsp.xsl, leads to the font-and-color-coded HTML Prolog version discount.html. Using something like "File | Save As... | Text", an ASCII Prolog version can be obtained, which permits whitespace-separated phrases as constant symbols.

The inverse transformation of (ordinary) ASCII Prolog to RFML markup, hence to RuleML, requires a separate parser such as the (Lisp-implemented) parser of Relfun: there are no ASCII-to-XML stylesheets.

Site Contact: Harold Boley.

"Practice what you preach": XML source of this homepage at rfml-ruleml.xml;
transformed to HTML via the adaptation of Michael Sintek's SliML XSLT stylesheet at homepage.xsl (View | Page Source)

Powered by Cocoon