RuleML

The RuleML Initiative is an international non-profit organization covering all aspects of Web rules and their interoperation, with a [|Structure] and Technical Groups that center on RuleML specification, tool, and application development. Around RuleML, an open network of individuals and groups from both industry and academia has emerged, having a shared interest in modern rule topics, including the interoperation of Semantic Web rules. The RuleML Initiative has been collaborating with OASIS on [|Legal XML], [|Policy RuleML], and related efforts since 2004. The Initiative has further been interacting with the developers of ISO Common Logic ([|CL]), which became an International Standard, First edition, in October 2007. RuleML is also a member of OMG, contributing to its Semantics of Business Vocabulary and Business Rules ([|SBVR]), which went into Version 1.0 in January 2008, and to its Production Rule Representation ([|PRR]), which went into Version 1.0 in December 2009. Moreover, participants of the RuleML Initiative have supported the development of the W3C Rule Interchange Format ([|RIF]), which attained Recommendation status in June 2010. The annual [|RuleML Symposium] has taken the lead in bringing together delegates from industry and academia who share this interest focus in Web rules. RuleML (Rule Markup Language) is a unifying family of XML-serialized rule languages spanning across all industrially relevant kinds of Web rules. It accommodates and extends other recent rule languages, building interoperation bridges between them.

[] == This document describes RuleML, the Rule Markup Language. RuleML is a markup language for publishing and sharing rule bases on the World Wide Web. RuleML builds a hierarchy of rule sublanguages upon XML, RDF, XSLT, and OWL. ==

The Kernel Datalog Sublanguage
The Datalog (constructor-function-free) sublanguage of Horn logic is the foundation for the kernel of [|RuleML]. Datalog is the language in the intersection of [|SQL] and [|Prolog]. It can thus be considered as the subset of logic programming needed for representing the information of null-value-free relational databases, including (recursive) views. That is, in Datalog we can define facts corresponding to explicit rows of relational tables and rules corresponding to tables defined implictly by views. RuleML Datalog, being a markup language, can conveniently represent relational information where all of the columns are natural-language phrases. To explain the Datalog features we will develop a small example formalizing natural-language business rules in RuleML. This example correspond to the 'Eligibility' Category of Terry Moriarty's [|Business Rule Classification]. Consider the English sentence "Peter Miller's spending has been min 5000 euro in the previous year." It can be marked up as the following RuleML Datalog fact:  spending Peter Miller min 5000 euro previous year  This markup can be regarded as a kind of parse tree, where tags correspond to non-terminals labeling both inner nodes (oval, RDF-like anonymous resources), e.g. with 'Atom', and leaf nodes (rectangular, RDF-like literals containing PCDATA that correspond to terminals), e.g. with 'Rel': Going through the tags from inside out, we find that "spending" is marked up as the relation name (table name) for the fact: spending. On the same level, the three phrases "Peter Miller", "min 5000 euro", and "previous year" are marked up as individual constants that are the three arguments (table columns) of the relation, in the given sequence: Peter Miller, min 5000 euro, and previous year</Ind>. The entire relation application constitutes an atomic formula, marked up by  ... </Atom>. In the above Datalog markup, the three"spending" arguments are not further analyzed; they are considered as just names of individual constants. For identification purposes, they would need to be repeated verbatim by a query that is to retrieve the above fact (as illustrated by the query in the body of rule below). A step-wise refining analysis could exhibit the internal structure and natural-language meaning of the basic three arguments using further, auxiliary, arguments, or going beyond Datalog, with all steps marked up in RuleML. Notice that in the RuleML Datalog kernel a relation can be n-ary, i.e. have any fixed number, n = 0, 1, 2, 3, ..., of arguments. The unary/binary restriction of Datalog is an important special case, e.g. for combining RuleML with [|OWL], as in [|SWRL]. While the above markup uses one 3-ary"spending" relation, it could also be reduced to three binary relations branching off from an individual constant that stands for the ternary relationship, as shown in a [|W3C Working Draft]. Moreover, RuleML Datalog provides for the markup of null values via empty individuals, <Ind/>. Now consider the English sentence "A customer is premium if their spending has been min 5000 euro in the previous year." This can be marked up as the following RuleML Datalog rule (an implication): <Implies>  premium</Rel> <Var>customer</Var> </Atom>  spending</Rel> <Var>customer</Var> min 5000 euro</Ind> previous year</Ind> </Atom> </Implies> Like for the fact, this rule markup can be viewed as a parse tree: Looking at these tags, notice that RuleML follows the Java class-vs.-method naming convention by distinguishing upper-case //type tags// from lower-case //role tags//. The atomic formula within the role of the <Implies> is like the  constituting the above fact, except that Peter Miller</Ind> is replaced by <Var>customer</Var>, the markup of a variable named "customer". This variable also occurs in an  within the role of the <Implies>, which applies the unary relation premium</Rel> to <Var>customer</Var>. The rule and the fact can be used together for a first derivation example: The rule's body matches the fact, binding <Var>customer</Var> to Peter Miller</Ind> ; using this binding to instantiate the same variable in the rule's head, a new  is derived expressing that Peter Miller</Ind> is a premium</Rel> customer. Besides using a single atomic formula in the body, a RuleML Datalog rule can also use an entire conjunction of atoms. This will allow complex conditions via 'and-ed' atoms, which can involve various variables. As an example with a body 'and-ing' two atoms, consider the English sentence "The discount for a customer buying a product is 7.5 percent if the customer is premium and the product is luxury." It can be marked up as the following RuleML Datalog (implication) rule: <Implies> <Atom> <Rel>discount</Rel> <Var>customer</Var> <Var>product</Var> <Ind>7.5 percent</Ind> </Atom> <And> <Atom> <Rel>premium</Rel> <Var>customer</Var> </Atom> <Atom> <Rel>luxury</Rel> <Var>product</Var> </Atom> </And> </Implies> Viewed as a parse tree, this markup contains an 'and' branch with atomic subtrees: The main <Implies> tag here has a body whose <And> conjoins the <Rel>premium</Rel> atom of the earlier rule and a similar <Rel>luxury</Rel> atom; they are used for tests over two different variables. The rule's head is an atom applying a "discount" relation to these two variables and to an individual constant that marks up "7.5 percent". While <Rel>premium</Rel> was defined by our first rule, <Rel>luxury</Rel> could be (partially) defined as "A Porsche is luxury." by another RuleML Datalog fact: <Atom> <Rel>luxury</Rel> <Ind>Porsche</Ind> </Atom> Again, this fact markup can be viewed as a parse tree: The new rule and fact can augment our earlier rule and fact for a chaining derivation example as follows: The first conjunct of the <Rel>discount</Rel> rule's body chains to the <Rel>premium</Rel> rule, which succeeds as shown earlier, binding <Var>customer</Var> to <Ind>Peter Miller</Ind>. The second conjunct just matches the <Rel>luxury</Rel> fact, binding <Var>product</Var> to <Ind>Porsche</Ind>. So, the <Rel>discount</Rel> rule succeeds with those bindings, proving an atom shown here with its translation to English: "The discount for Peter Miller buying a Porsche is 7.5 percent." This derived atom markup may be stored for further processing: <Atom> <Rel>discount</Rel> <Ind>Peter Miller</Ind> <Ind>Porsche</Ind> <Ind>7.5 percent</Ind> </Atom> As always, such markup can be viewed as a parse tree: Notice that we explained the first rule in a bottom-up manner and the second rule in a top-down manner. Actually, each rule can be used in both ways; the RuleML kernel is neutral with respect to any use direction. RuleML uses Datalog as the kernel of its [|family of sublanguages]. Its syntax is defined by an [|XML Schema]. Its semantics is defined via Herbrand models. Various RuleML Datalog implementations exist, including one as part of [|jDREW].