bdd34d106dad3b5ecd4eef24f32faca8.ppt
- Количество слайдов: 27
Rule Languages and Rule Interchange Sujit R Nair November 30, 2009
Introduction Need / Requirement. Characteristics of current rule markup Languages. A sample Scenario of Rule Interchange Future Work. Conclusion.
Need / Requirement Expressiveness. Machine-interpretation. Automated Processing. Translation and Interchange. Publication and Serialization.
Current Rule Languages Rule. ML. SWRL. R 2 ML. W 3 C RIF. Triple. N 3. Jena Rules. Prova.
Rule. ML Based on XML. Rules consists of derivation, integrity constraints, production, reaction, tools and transformation. Datalog Rule. ML and Hornlog Rule. ML.
SWRL Combining Sublanguages of OWL and Rule. ML. Union of DLP and Horn Logic. Adds rules at the cost of undecidability and lack of complete implementation. Protégé. Rules = Antecedent + Consequent.
R 2 ML Based on concept of Rule. ML and SWRL. Rules consists of derivation, integrity constraints, production, reaction. MOF/UML support.
W 3 C RIF Facilitate rule exchange. Dialects. Basic Logic Dialect(RIF-BLD) ↔ Horn Rule Language. Datatypes and Built-Ins(RIF-DTB). Core. Production Rule Dialect.
Jena Rules Java Rule object. Jena 2 is much simpler, allows rules to be specified in compact form in text source files.
Prova Web rule language + Highly expressive distributed Web rule engine. Supports complex reaction rule-based workflow, rulebased event processing, distributed inference services, rule interchange, rule-based decision logic, dynamic access to external data , Web Services and JAVA APIs.
Rule Interchange Sample Using RIF to interchange F-Logic Rules and Drools. Scenario : To supply a vendor-neutral representation of rules, so that rule-system developers can do their work without concern about a vendor-specific format and in particular without concern about the compatibility with the technology of its business partners. Jane's e-commerce system uses Drools therefore the rules vocabulary is represented using Java beans John uses an OWL vocabulary and its rules are represented in F-Logic.
Rule Interchange (contd) The Two rules that are to be implemented : a. Rule R 1: If an item is perishable and it is delivered more than 10 days after the scheduled delivery date then the item will be rejected. b. Rule R 2: If an item is perishable and it is delivered more than 7 days after the scheduled delivery date but less than 14 days after the scheduled delivery date then a discount of 18. 7% will be applied to this delivery.
Rule Interchange (contd) Points to be kept in mind: RIF needs to deal with different vocabularies. RIF needs an uniform mechanism to address vocabulary elements. The usage of URI's may be such a mechanism. Vocabulary and rules are separate layers
Rule Interchange (contd) John's OWL vocabulary:
Rule Interchange (contd) John Rules (F-Logic) //If an item is perishable and it is delivered more than 10 days after the scheduled delivery date then the item will be rejected RULE R 1 I: item[status -> "rejected"] < I: item[is. Perishable -> true] AND I[actual. Delivery. Date -> A] AND I[scheduled. Delivery. Date -> S] AND R is (A - S) AND R > 10.
Rule Interchange (contd) //If an item is perishable and it is delivered more than 7 days after the scheduled delivery date but less than 14 days after the scheduled delivery date then a discount of 18. 7% will be applied to this delivery. RULE R 2 I: item[discount -> 18. 7] <- D: delivery[has. Items->>Items] AND I: item[is. Perishable -> true] AND I[actual. Delivery. Date -> A] AND I[scheduled. Delivery. Date-> S] AND member(I, Items) AND R is (A - S) AND R > 7.
Rule Interchange (contd) Jane's Rules (Drools) package com. sample import com. sample. Item; rule "R 1" when i : Item( is. Perishable==true, actual. Delivery. Date : actual. Delivery. Date, scheduled. Delivery. Date : scheduled. Delivery. Date ) eval( actual. Delivery. Date. get. Day() – scheduled. Delivery. Date. get. Day() > 10 ) then i. is. Rejected(true); modify(i); end
Rule Interchange (contd) rule "R 2" when d: Delivery(has. Items: has. Items) i : Item(actual. Delivery. Date : actual. Delivery. Date, scheduled. Delivery. Date : scheduled. Delivery. Date ) eval( (actual. Delivery. Date. get. Day() – scheduled. Delivery. Date. get. Day() > 7) && has. Items. contains(i)) then i. set. Discount(18. 7); modify(i); end
Rule Interchange (contd) Importing Jane's Rules in the John's rule system Translating from Drools into RIF Presentation Syntax proposed by RIF-BLD is used to perform the vocabulary interchange.
Rule Interchange (contd) Translation of Jane's Drools Rules rules into RIF rule "R 1" when i : Item(is. Perishable==true, actual. Delivery. Date : actual. Delivery. Date, scheduled. Delivery. Date : scheduled. Delivery. Date ) eval( actual. Delivery. Date. get. Day() – scheduled. Delivery. Date. get. Day() > 10) then i. is. Rejected(true); modify(i); end
Rule Interchange (contd) // Translation to RIF Rule ("http: //jane. com/R 1" ? i#Item[(is. Rejected->"true"^^xs: boolean) : - And(? i#Item[(is. Perishable->"true"^^xs: boolean) (actual. Delivery. Date->? actual. Delivery. Date ) (scheduled. Delivery. Date ->? scheduled. Delivery. Date)] op: numeric-greater-than( op: numeric-subtract( userdefined: get. Day(? actual. Delivery. Date), userdefined: get. Day(? scheduled. Delivery. Date) ), "10"^^xs: int ) ) )
Future Work On going research to develop a general rule mark up language. Most of the research is concentrating on Rule. ML and RIF. To cover the shortcomings such as – procedural call to external objects, operating systems , terminological descriptions for dealing with real world distributed Web Applications.
Conclusion Why is rule markup needed ? Currents rule markup languages. Rule. ML and RIF. W 3 C RIF BLD provides a robust core for the interchange of business rules among commercial and academic rule systems. Embodies both production rules and derivation rules.
References Adrian Paschke , Harold Boley – Rule Markup Languages and SWRL. 2. W 3 C Rule Interchange Format, http: //www. w 3. org/2005/rules/wiki/RIF_Working_Grou p 3. RIF Basic Logic Dialect, http: //www. w 3. org/TR/rif-bld/ 4. W 3 C RIF Use Cases and Requirements, http: //www. w 3. org/TR/rif-ucr/ Gary Hallmark , Christian de Sainte Marie, Marcos Didonet Del Fabro, Patrick Albert , and Adrian Paschke - Please Pass the Rules: A Rule Interchange Demonstration 1.
Contact Information Sujit Raveendran Nair. Email: srn 071000@utdallas. edu. Phone: 972 -983 -4886.