2005-11-09 -

Quick links:

Each XML Schema Definition (XSD) in the evolving hierarchy corresponds to a specific RuleML
sublanguage. The implementation uses a
modularization approach similar to the one in XHTML
in order to offer appropriate flexibility and accomodate different implementations and approaches.
Note that the Document Type Definition (DTD) specification of RuleML is no longer being maintained,
but will continue to be available as an archive. Tools
capable of converting between XML Schema and DTDs such as XMLSpy
are always available.

An introduction to RuleML is given in our tutorial.
Also, the main page's design section
discusses the upper layer of the RuleML hierarchy of rules.
In that terminology, the system of RuleML XSDs presented here only covers
derivation rules, not reaction rules (see the official model)

This is because we think it is important to start with a subset of
simple rules, test and refine our principal strategy using these,
and then work 'up' to the more general categories of rules in the hierarchy.
For this we choose
Datalog,
a language corresponding to relational databases
(ground facts without complex domains or 'constructors')
augmented by views (possibly recursive rules),
and work a few steps upwards to further declarative rules
as allowed in (equational) Horn logic.

Below is a summary of the changes in version 0.9:

new sublanguage: hornlog with negation-as-failure (nafhornlog), as implemented by OO jDREW

RuleML 0.9 consists of the following changes relative to the previous version 0.89.

The sublanguage of hornlog with negation-as-failure (nafhornlog), as implemented by OO jDREW, is added to the family of sublanguages (see the Modularization section). The language is analogous to nafdatalog, differing only by the addition of complex terms and rest variables.

Since RuleML 0.8, the <opr>, <opc> and <opf> roles have been substituted (because of technical reasons) for a generic operator of relations, functions and constructors. These are now merged into such a generic operator (<op>) using context-sensitivity (i.e. the allowable content of <op> depends on whether it is within an <Atom>, <Cterm>, etc). This is demonstrated in book.ruleml:

Mutual exclusion (<Mutex>) is generalized as integrity constraints (<Integrity>). As with the original <Mutex> tag, <Integrity> is allowable within the <Protect> performative (optionally wrapped by a <warden> role). For example, the constraint that the discount offered to the same customer cannot be two distinct values (from the SWSL submission to the W3C) would be marked up as

The new @kind attribute is optionally added to <Implies> for the purpose of distinguishing between FOL and LP types of implication (as in the Web Rule Language).

An n-ary <RuleML> toplevel element is introduced (formally similar to RDF's <rdf:RDF>), permitting (ordered) transactions of the performatives <Assert>, <Query> and <Protect>. This allows combining, for example, asserted and queried content in the same document, as in discount.ruleml:

The attributes @wlab and @wref are replaced with a single attribute: @uri (deviating from XML's @id vs. @idref and RDF's @about vs. @resource dualisms). This change allows a <Var> to 'read' or 'input' an <Ind uri="..."/> and 'write' or 'output' it as an <Ind uri="..."/>.

A prefix normal form is officially introduced, where certain role tags are 'positionalized', i.e. restricted to certain positions within content models (in this case, the beginning). This has always been the case for the <oid> role, which can only be at the beginning of an <Atom>. Now, however, other role tags are affected: in 0.9, <op> may no longer be postfix. While applying the prefix normal form to other role tags is under consideration (for future versions), some role tags (e.g. <body> and <head>) will not be affected. The prefix normal form greatly reduces the complexity of certain content models, helping avoid issues with current validation tools. Since postfix (and mixed postfix-and-prefix) forms are no longer possible in 0.9, the 0.89-0.9 upgrader also transforms from postfix (and mixed postfix-and-prefix) forms to prefix normal form.

Finally, the optional element <degree> permits the assignment of an uncertainty value (between 0.0 and 1.0) to facts and rules. For example,
the following rule (from Fuzzy RuleML) asserts that a person's happiness is more dependent on
being healthy than being rich:

To ensure validation stability, the 0.9 XSDs are
tested (using corresponding instance documents/examples)
with a selection of the most reliable validators. A summary of these validation results follows:

W3C XML Schema Validator (XSV)v 2.10-1
All examples and schemas validate perfectly except for the binary sublanguages. There was a related known bug in XSV 2.7-1 affecting the binary sublanguages that may still be causing problems. See Appendix 3 for instructions on validating an example against its XML Schema and the corresponding output.

Numerous sample RuleML documents have been prepared and maintained as examples and for testing purposes. They
are stored in the Examples directory. (Examples from previous versions of RuleML are also maintained, e.g.
0.89 examples).

There are two kinds tags in RuleML: method-like 'role' tags and class-like 'type' tags. The two are easily
distinguished by their initial letter, much like the convention used in Java: role tags start with a lower-case
letter, whereas type tags start with an upper-case letter. For example, <head> is a role tag and
<Ind> is a type tag.

Furthermore, type and role tags alternate in RuleML. For example, notice the alternation in this a fact
asserting that John sells XMLBible to Mary:

This is known as the "striped syntax" of RuleML, and is important for compatibility with RDF.
Because this is quite verbose, all role tags can also be skipped (in the spirit of Sandro Hawke's
StripeSkipping), leaving a more compact form.
For example, the above fact can be shortened to:

Note that there is no loss of information, because all role tags can be reconstructed based on the
remaining type tags. In fact, this reconstruction (from the latter positional form to the former slotted form) can be done automatically via XSLT, as with the
Normalizer in 0.89.

This gives the syntax of RuleML a lot of flexibility because it allows either a compact or expanded form
(or any combination thereof), where the compact form is more user-friendly and the expanded (normalized)
form is more compatible with other languages.

There are two pairs of attributes in RuleML that have names which differ only by a 'map' prefix: closure and mapClosure, and direction and mapDirection. The naming convention reflects attribute 'mapping' through XML trees, where

Appended below is the XML Schema (version 0.9) for the Datalog
sublanguage of RuleML (Appendix 1). Also appended
below is a simple example rulebase that conforms to that XSD (Appendix 2),
and instructions for how to validate the example against the schema
(Appendix 3).

(Validator for XML Schema REC (20010502) version, as amended).
2. Enter the following URL of our example RuleML file (or any other) into the textfield
preceded by "Address(es)": http://www.ruleml.org/0.9/exa/own.ruleml
3. If desired, check the "Show Warnings" box.
4. Click the "Get Results" button.
Note: The validation may take a while, and may require a full
refresh when re-validating to avoid caching.
Also note: Depending on your browser, you may want to select a different
output using the radio buttons just above the "Get Results" button.
***
You should get the following output (using the default output):