R u l e M L


RuleML in RDF

Harold Boley

2001-03-09: Version 0.2

This is an experimental RDF translator for a subset or RuleML.



RDF-like 'resources' can be represented in RuleML as 'ur' elements and triples can be represented as special, 'ur'-centered facts (see e.g. KR Principles and DTD Modularization). Vice versa, RuleML rules can be represented in RDF, e.g. through the generation results of the experimental translator described here (you may also start from RDF Relationships and DTD Modularization).

In order to be flexible w.r.t future changes of the RuleML DTD, the current RDF version of RuleML is defined by an XSLT stylesheet translating RuleML rules to RDF. The translation, based on Cocoon 1.8, can already be fed into RDF tools such as the RDFViz data grapher.

The RDF representation directly reflects the tree structure of RuleML rulebases as defined by the RuleML DTD. For this, the abbreviated RDF syntax (similar to nested property lists) is used which nests subtrees and uses types as rdf:Descriptions: A particular rulebase becomes an RDF resource of type ruleml:Rulebase with an rdf:Container property leading to its rdf:Bag of rules labeled rdf:_1, rdf:_2, ... A ruleml:If rule has ruleml:Conc and ruleml:Prem properties leading to ruleml:Atom or ruleml:And resources. Etc., down to RuleML's PCDATA for relation symbols, individual constants, and variables, etc., which become corresponding resources with ruleml:Name literals in RDF.

The RDF graphs generated in this way become quite large, due to the various intermediate layers of nodes. E.g., the own example becomes 228 lines of pretty-printed RDF/XML, 166 RDF triples, and an 8-page RDFViz graph. Perhaps (some of) the node layers may be collapsed to obtain more compact RDF graphs. (Also, should the container Bag be abolished in a future RDF version, it would be possible to represent the bag content by unordered 'parallel' labeled arcs; for the Seq container we would still need some 'order' labels rdf:_1, rdf:_2, ...). The XSLT stylesheet would then need to be adapted to the new output form.


The XSLT stylesheet ruledf.xsl (ruledf.xsl.txt) implements the translator. Its output can be given to RDFViz for visualization.

The RuleML own example can be augmented by an XSLT prelude/prolog line, obtaining own.ruleml (own.ruleml.txt). Running this through Cocoon leads to own.rdf. The RDFViz visualization of the RDF version of the RuleML example then leads to a large GIF image (own-rdfviz.gif). For printing it on a matrix of pages, it can first be inserted as graphics into a standard spreadsheet program.

Known omissions:

Site Contact: Harold Boley. Page Version: 2001-03-09

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

Powered by Cocoon