Main
About us
Members
Papers
Projects
Contact
Demo Podcasts and Posters
Integrity Rules in R2ML
A preferred client must have a portfolio that includes at least three products
(for example, a preferred client may have a portfolio that includes vehicle and
life insurance policies and an individual retirement account).
1 <r2ml:RuleBase xmlns:r2ml="http://www.rewerse.net/I1/2006/R2ML" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:userv="http://www.businessrulesforum.com/2005/userv#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.rewerse.net/I1/2006/R2ML http://oxygen.informatik.tu-cottbus.de/R2ML/0.5/R2ML.xsd" 2 <r2ml:IntegrityRuleSet r2ml:ruleSetID="UServIntegrityRuleSet" 3 r2ml:externalVocabulary="http://oxygen.informatik.tu-cottbus.de/rewerse-i1/files/UServ_IAR.jpg" r2ml:externalVocabularyLanguage="UML"> 4 <r2ml:DeonticIntegrityRule r2ml:ruleID="CC_01"> 5 <r2ml:Documentation> 6 <r2ml:RuleText r2ml:textFormat="plain"> <![CDATA[ A preferred client must have a portfolio that includes at least three products (for example, a preferred client may have a portfolio that includes vehicle and life insurance policies and an individual retirement account). ]]> 7 </r2ml:RuleText> 8 </r2ml:Documentation>
The r2ml:RuleBase
element (see Line 1) is the parent of one or many rule sets. Namespaces which must be available in all rules can be declared here.
An integrity rule set is declared by the element r2ml:IntegrityRuleSet
(see Line 2). This element contains three optional attributes:
r2ml:ruleSetID
- is the name of the rule set. In our example this is UServIntegrityRulesSetr2ml:externalVocabulary
- represent an URI of an external vocabulary. We use UML to represent vocabulary for this rule, and the representation of the vocabulary definition is available at the http://oxygen.informatik.tu-cottbus.de/rewerse-i1/files/UServ_IAR.jpg (see Line 3)
r2ml:externalVocabularyLanguage
- refers the language of the external vocabulary.
An integrity rule can be seen as an integrity constraint. R2ML framework supports two kinds of integrity rules: Alethic Integrity Rule (e.g. those constraints expressing the necessity, possibility and impossibility) and Deontic Integrity Rule (e.g. those constraints that refer obligativity, permission and prohibition).
The integrity rule from our example is enclosed into a r2ml:DeonticIntegrityRule
element (see Line 4).
An optional element r2ml:Documentation
(see line 5) can contains elements which enclose the rule text (Lines 5-8) and the representation of the rule in a specific rules language.
9 <r2ml:constraint> 10 <r2ml:UniversallyQuantifiedFormula> 11 <r2ml:ObjectVariable r2ml:name="client" r2ml:class="userv:Client"/> 12 <r2ml:Implication> 13 <r2ml:antecedent> 14 <r2ml:Conjunction> 15 <r2ml:ReferencePropertyAtom r2ml:referenceProperty="userv:hasPortfolio"> 16 <r2ml:subject> 17 <r2ml:ObjectVariable r2ml:name="client" r2ml:class="userv:Client"/> 18 </r2ml:subject> 19 <r2ml:object> 20 <r2ml:ObjectVariable r2ml:name="portfolio" r2ml:class="userv:Portfolio"/> 21 </r2ml:object> 22 </r2ml:ReferencePropertyAtom> 23 <r2ml:AtLeastQuantifiedFormula r2ml:minCardinality="3"> 24 <r2ml:ObjectVariable r2ml:name="product" r2ml:class="userv:Product"/> 25 <r2ml:ReferencePropertyAtom r2ml:referenceProperty="userv:hasProduct"> 26 <r2ml:subject> 27 <r2ml:ObjectVariable r2ml:name="portfolio" r2ml:class="userv:Portfolio"/> 28 </r2ml:subject> 29 <r2ml:object> 30 <r2ml:ObjectVariable r2ml:name="product"/> 31 </r2ml:object> 32 </r2ml:ReferencePropertyAtom> 33 </r2ml:AtLeastQuantifiedFormula> 34 </r2ml:Conjunction> 35 </r2ml:antecedent> 36 <r2ml:consequent> 37 <r2ml:ObjectClassificationAtom r2ml:class="userv:PreferredClient"> 38 <r2ml:ObjectVariable r2ml:name="client"/> 39 </r2ml:ObjectClassificationAtom> 40 </r2ml:consequent> 41 </r2ml:Implication> 42 </r2ml:UniversallyQuantifiedFormula> 43 </r2ml:constraint> 44 </r2ml:DeonticIntegrityRule> 45 </r2ml:IntegrityRuleSet> 46 </r2ml:RuleBase>
The rule example is an implication (antecedent implies consequent) that embeds an Logical Formula
without free variables (UniversallyQuantifiedFormula).
The conditions of the rule are introduced in the rule using r2ml:antecedent
element (Lines 13-35). It contains all atoms which forms the rule's body. By default, all atoms from the rule body are connected by r2ml:Conjunction
.
In this example, the rule conditions are expressed with the help of r2ml:ReferencePropertyAtom
(see Lines 15-22 and 25-32). A ReferencePropertyAtom
associates two object terms, having different meanings: subject and object. For example, to express the concept of: "client having a portfolio" we use the code above, where the subject
is client
and the object
is portfolio
.
The r2ml:ObjectVariable
element (see Lines 11, 17, 20, 27, 30, 38) expresses an object variable with a name represented by the value of r2ml:name
attribute. The type of this variable can be expressed by the value of the optional attribute r2ml:class
or if is an child of r2ml:ObjectClassificationAtom
, like in our example (see Lines 37-39), by the value of the attribute r2ml:class
of this atom.
The head of the rule is represented by the content of r2ml:consequent
element (see Lines 36-43). The conclusion for our example is a classification of the client
object variable to an userv:PreferredClient
class.
Integrity Rules