Experiences Using 
Deliberation RuleML 1.01 as 
a Rule Interchange Language 
Do Rulebases Need an External Vocabulary? 
Ma...
RuleML Basics 
• Individuals, Data, Atomic statements, logical 
formulas, rules, quantifiers 
• Hierarchical sub-languages...
UServ Product Derby 
• Describes a virtual car insurance company 
• Business model based on business rules 
• Traditional ...
Individuals, Data and Variables (1) 
RuleML Support: 
• IRIs (@iri) to provide unique names for individuals. Typing 
of in...
Individuals, Data and Variables (2) 
RuleML Support: 
• Best practice of declarative definition of instances (facts) 
by a...
Individuals, Data and Variables (3) 
RuleML Support: 
• Beyond the logic programming tradition, allows typing of XML 
data...
UServ - Design 
• Object instances (such as specific cars) map to 
RuleML individuals 
• Classes map to RuleML unary relat...
Encoding Types/Classes 
RuleML Support: 
• Type/class encoding using variables or individuals 
• Type/class encoding using...
Multi-typing 
RuleML Support: 
• Explicit typing of individuals 
<Assert> 
푐푎푟 푐푎푟1 ∧ 푐표푛푣푒푟푡푖푏푙푒퐶푎푟(푐푎푟1) 
<Atom> 
<Rel i...
Inheritance (1) 
RuleML Support: 
• No internal subClassOf inheritance support 
• Define inheritance externally (e.g. RDFS...
Inheritance (2) 
RuleML Support: 
• Rule-based inheritance may introduce complexity in execution. 
• Usually search (backt...
Encoding Properties (1) 
<Atom> 
<Rel iri="us:price">price</Rel> 
<!-- the subject of the property --> 
<Var type="us:Car"...
Encoding Properties(2) 
<Atom> 
<Rel iri="us:theftRating">theftRating</Rel> 
<Var type="http://userv.org/ontology/LuxuryCa...
Encoding Properties (3) 
• Definition of properties via external ontology 
<Atom> 
<Rel iri="us:price">price</Rel> 
<Var t...
Built-ins 
RuleML Support: 
• Tests such as for numerical constraints and list memberships 
• Operators with an @iri attri...
Collection membership (1) 
RuleML Support: 
• List membership tests via use of collections (<Plex>) in atoms 
<Atom> 
<Rel...
Collection membership (2) 
RuleML Support: 
• Collections must be repeatedly given wherever needed 
• Best practice to def...
Rules and Rulebases (1) 
RuleML Support: 
• Rules are defined similarly with logical implications, but 
many flavours are ...
Rules and Rulebases (2) 
RuleML Support: 
• Limited support for annotations of rulebases: 
o Logic programming defines a r...
Rulebase Metrics 
• This rulebase covers around 40% of the use case 
• We encoded: 
o 30 rules 
o 32 predicates, 5 built-i...
Conclusion 
• RuleML 1.01 can be used as a rule interchange language 
• Improvements on handling types, inheritance, colle...
Acknowledgments 
We would like to thank to Tara Athan, Harold Boley, 
Adrian Giurca and Adrian Paschke for their essential...
Useful information sources 
• Tutorial introduction (http://ruleml.org/papers/Primer) 
• RuleML MediaWiki (http://wiki.rul...
Upcoming SlideShare
Loading in …5
×

Experiences Using Deliberation RuleML 1.01 as a Rule Interchange Language

513 views

Published on

Presentation at 8th International Rule Challenge during RuleML 2014 conference on August 19 in Prague, Czech Republic.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
513
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • The "extension" of a class/type is the set of all instances belonging to that class.
    car(car1) – car1 is instanceOf Car
    price(car1, 39000) – two arguments
    Rules are based on ontology models:
    - Car, LuxuryCar, Driver – ontology classes
    - price, carModel - ontology properties.

    While in traditional logic programming they are just symbols in an ontology one can check the domain and range of a property (binary predicate) and so on
    Otherwise logic programming comes with n-ary predicates more difficult to be represented by traditional ontology languages such as OWL and RDFS
  • Experiences Using Deliberation RuleML 1.01 as a Rule Interchange Language

    1. 1. Experiences Using Deliberation RuleML 1.01 as a Rule Interchange Language Do Rulebases Need an External Vocabulary? Matthias Tylkowski and Martin Müller Binarypark, Erich-Weinertstr. 1, 03044 Cottbus, Germany The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014
    2. 2. RuleML Basics • Individuals, Data, Atomic statements, logical formulas, rules, quantifiers • Hierarchical sub-languages – RuleML lattice • Support for various semantics • Schema configurability via MYNG 1.01 • Design based on Relax NG and XML Schema The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 2
    3. 3. UServ Product Derby • Describes a virtual car insurance company • Business model based on business rules • Traditional object-oriented data model o classes (Car, Driver, ConvertibleCar, …), o properties (price, eligibilityScore, potentialTheftRating ) o objects (car1, car2, …) If all of the following are true, then the car’s potential theft rating is low: - car’s price is less that $20,000 - car model is not on the list of “High Theft Probability Auto” Any senior driver is not a young driver. The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 3
    4. 4. Individuals, Data and Variables (1) RuleML Support: • IRIs (@iri) to provide unique names for individuals. Typing of individuals (@type) • Declaration of property values for individuals. <Atom> <oid> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80-de3a8c2e15ba" type="http://userv.org/ontology/LuxuryCar"> </Ind> </oid> <slot> <Rel iri="http://userv.org/ontology/price">price</Rel> <Data xsi:type="xs:positiveInteger">39000</Data> </slot> </Atom> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 4
    5. 5. Individuals, Data and Variables (2) RuleML Support: • Best practice of declarative definition of instances (facts) by atoms/formulas (푙푢푥푢푟푦퐶푎푟 becomes a type) <Assert> 푙푢푥푢푟푦퐶푎푟 푐푎푟4 ∧ 푐푎푟푀표푑푒푙 푐푎푟4, ′Honda Odyssey′ ∧ 푝푟푖푐푒 푐푎푟4, 39000 . <Atom> <Rel iri="http://userv.org/ontology/carModel"/> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80-de3a8c2e15ba" type="http://userv.org/ontology/LuxuryCar">car4</Ind> <Data xsi:type="xs:string">Honda Odyssey</Data> </Atom> <Atom> <Rel iri="http://userv.org/ontology/price">price</Rel> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80-de3a8c2e15ba" type="http://userv.org/ontology/LuxuryCar">car4</Ind> <Data xsi:type="xs:positiveInteger">39000</Data> </Atom> </Assert> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 5
    6. 6. Individuals, Data and Variables (3) RuleML Support: • Beyond the logic programming tradition, allows typing of XML data(@xsi:type). However, only RuleML supported XML datatypes are permitted. • Typed variables (@type). <Data xsi:type="xs:positiveInteger">39000</Data> <Var type="http://userv.org/ontology/ConvertibleCar">C</Var> <Data type="us:Rating"> <us:ratingValue xsi:type="xs:positiveInteger">4</us:ratingValue> <us:ratingVerbalization xml:lang="en"> high </us:ratingVerbalization> </Data> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 6 • No typing of User-defined structured data
    7. 7. UServ - Design • Object instances (such as specific cars) map to RuleML individuals • Classes map to RuleML unary relations. • Type classification (aka classes) can also be declared explicitly inside typed variables or typed individuals • Properties map to RuleML binary relations • Rules are based on ontology models • UServ rules are based on relations and properties defined by an external ontology (accessible via RuleML @type ) – the rule vocabulary . The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 7
    8. 8. Encoding Types/Classes RuleML Support: • Type/class encoding using variables or individuals • Type/class encoding using atoms with unary relations <Ind type="us:Car">car4</Ind> <Var type="us:Car">C</Var> <Atom> <Rel iri="us:Car">car</Rel> <Var>C</Var> </Atom> ∀퐶 푐푎푟(퐶) The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 8 푐푎푟(푐푎푟4)
    9. 9. Multi-typing RuleML Support: • Explicit typing of individuals <Assert> 푐푎푟 푐푎푟1 ∧ 푐표푛푣푒푟푡푖푏푙푒퐶푎푟(푐푎푟1) <Atom> <Rel iri="http://userv.org/ontology/Car">car</Rel> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80">car1</Ind> </Atom> <Atom> <Rel iri="http://userv.org/ontology/ConvertibleCar">car</Rel> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80">car1</Ind> </Atom> </Assert> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 9
    10. 10. Inheritance (1) RuleML Support: • No internal subClassOf inheritance support • Define inheritance externally (e.g. RDFS) or via of rules <Implies> <Atom> ∀퐶 푐표푛푣푒푟푡푖푏푙푒퐶푎푟 퐶 → 푐푎푟(퐶) <Rel iri="us:ConvertibleCar">convertibleCar</Rel> <Var>X</Var> </Atom> <Atom> <Rel iri="us:Car">car</Rel> <Var>X</Var> </Atom> </Implies> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 10
    11. 11. Inheritance (2) RuleML Support: • Rule-based inheritance may introduce complexity in execution. • Usually search (backtracking) used for multiple inheritance • Keep inheritance in external vocabulary or use higher-order syntax <owl:Class rdf:about="http://userv.org/ontology/ConvertibleCar"> <rdfs:subClassOf rdf:resource="http://userv.org/ontology/Car"/> </owl:Class> <Atom> <Rel iri="rdfs:subClassOf">subClassOf</Rel> <arg index="1"> <Rel iri="us:ConvertibleCar" type="owl:Class">convertibleCar</Rel> </arg> <arg index="2"> <Plex> ∀퐶 ([푐표푛푣푒푟푡푖푏푙푒퐶푎푟 퐶 → 푐푎푟 퐶 ] ∨ [푐표푛푣푒푟푡푖푏푙푒퐶푎푟 퐶 → 푙푢푥푢푟푦퐶푎푟 퐶 ]). <Rel iri="us:Car" type="owl:Class">car</Rel> <Rel iri="us:LuxuryCar" type="owl:Class">luxuryCar</Rel> </Plex> </arg> </Atom> 퐶표푛푣푒푟푡푖푏푙푒퐶푎푟 ⊑ 퐶푎푟 The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 11
    12. 12. Encoding Properties (1) <Atom> <Rel iri="us:price">price</Rel> <!-- the subject of the property --> <Var type="us:Car">C</Var> <!-- the value of the property --> <Data xsi:type="xs:positiveInteger">25000</Data> </Atom> <Atom> ∀퐶 푐푎푟(퐶) ∧ 푝푟푖푐푒 퐶, 25000 . luxuryCar (푐푎푟4) ∧ 푝푟푖푐푒 푐푎푟4, 39000 . <Rel iri="us:price">price</Rel> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80-de3a8c2e15ba" type="http://userv.org/ontology/LuxuryCar">car4</Ind> <Data xsi:type="xs:positiveInteger">39000</Data> </Atom> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 12
    13. 13. Encoding Properties(2) <Atom> <Rel iri="us:theftRating">theftRating</Rel> <Var type="http://userv.org/ontology/LuxuryCar">C</Var> <Data type="us:Rating" > <us:ratingValue xsi:type="xs:positiveInteger">4</us:ratingValue> <us:ratingVerbalization xsi:type="xs:string" xml:lang="en"> high </us:ratingVerbalization> </Data> </Atom> <Atom> ∀퐶 푙푢푥푢푟푦퐶푎푟 퐶 ∧ 푡ℎ푒푓푡푅푎푡푖푛푔 퐶, 푟푎푡푖푛푔(4, ′high′) . <Rel iri="us:airbag">airbags</Rel> <Var type="http://userv.org/ontology/Car">C</Var> <Plex> <Data xsi:type="xs:string">driverAirbag</Data> <Data xsi:type="xs:string">frontAirbag</Data> </Plex> </Atom> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 13 ∀퐶 푐푎푟 퐶 ∧ 푎푖푟푏푎푔푠 퐶, [′driverAirbag′, ′푓푟표푛푡퐴푖푟푏푎푔′]
    14. 14. Encoding Properties (3) • Definition of properties via external ontology <Atom> <Rel iri="us:price">price</Rel> <Var type="us:Car">C</Var> <Plex> <Data xsi:type="xs:string">high</Data> <Data xsi:type="xs:positiveInteger">25000</Data> </Plex> </Atom> <owl:DatatypeProperty rdf:about="http://userv.org/ontology/price"> <rdfs:domain rdf:resource=http://userv.org/ontology/Car/> <rdfs:range> <owl:Class> <owl:unionOf rdf:parseType="Collection"> <owl:Class rdf:about="xs:positiveInteger"/> <owl:Class rdf:about="xs:string"/> </owl:unionOf> </owl:Class> </rdfs:range> </owl:DatatypeProperty> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 14
    15. 15. Built-ins RuleML Support: • Tests such as for numerical constraints and list memberships • Operators with an @iri attribute refer to libraries of built-in predicates such as one defined by RIF <Atom> 푃 ≤ 45000. <Rel iri="pred:numeric-less-than-or-equal">gt</Rel> <Var type="xs:positiveInteger">P</Var> <Data xsi:type="xs:integer">45000</Data> </Atom> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 15
    16. 16. Collection membership (1) RuleML Support: • List membership tests via use of collections (<Plex>) in atoms <Atom> <Rel iri="prolog:member">member</Rel> <Var>M</Var> <Plex> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80">car1</Ind> <Ind iri="http://userv.org/ontology/i/5bff7cc6-72f7-4be3">car3</Ind> <Ind iri="http://userv.org/ontology/i/5eb91389-f1f3-473c">car5</Ind> </Plex> </Atom> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 16
    17. 17. Collection membership (2) RuleML Support: • Collections must be repeatedly given wherever needed • Best practice to define collection constants via equality <Equal oriented="yes"> <Ind>HighTheftProbabilityAutoList</Ind> <Plex> <Ind iri="http://userv.org/ontology/i/a9fccd3a-a851-4e80">car1</Ind> <Ind iri="http://userv.org/ontology/i/5bff7cc6-72f7-4be3">car3</Ind> <Ind iri="http://userv.org/ontology/i/5eb91389-f1f3-473c">car5</Ind> </Plex> </Equal> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 17
    18. 18. Rules and Rulebases (1) RuleML Support: • Rules are defined similarly with logical implications, but many flavours are supported. A rulebase is a set of rules. <Implies direction="backward"> <Naf> <Atom> If the car is a convertible and has no roll bar, then the potential occupant injury is extremely high. <Rel iri="http://userv.org/ontology/hasRollBar">hasRollBar</Rel> <Var type="http://userv.org/ontology/ConvertibleCar">C</Var> </Atom> </Naf> <Atom> <Rel iri="http://userv.org/ontology/injuryRating">injuryRating</Rel> <Var>C</Var> <Data><us:Value xsi:type="xs:positiveInteger">5</us:Value></Data> </Atom> </Implies> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 18
    19. 19. Rules and Rulebases (2) RuleML Support: • Limited support for annotations of rulebases: o Logic programming defines a relation by rules. All rules referring that relation are grouped o Production rules define a rulebase towards performing a specific task • No global identity for rulebases (@iri) <Rulebase xml:id="theftRating"> <!-- Processing cars' theftRating --> <meta> <Atom> <Rel iri="http://userv.org/ontology/theftRating">theftRating</Rel> </Atom> </meta> … </Rulebase> The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 19
    20. 20. Rulebase Metrics • This rulebase covers around 40% of the use case • We encoded: o 30 rules o 32 predicates, 5 built-ins o 11 compound facts, 5 descriptions of individuals o 7 usages of Naf o 2 usages of Neg The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 20
    21. 21. Conclusion • RuleML 1.01 can be used as a rule interchange language • Improvements on handling types, inheritance, collections and global constants are possible • UServ design used classes and properties, defined by the UServ ontology • Our knowledge base uses NafNegHornlogEq family • However, except for collections we do not use functions ("Datalog with Plex") • Equality is used only to define collections as individuals • Strong negation is used twice because of an explicit negative information • NafDatalog+FiniteCollections would be great The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 21
    22. 22. Acknowledgments We would like to thank to Tara Athan, Harold Boley, Adrian Giurca and Adrian Paschke for their essential feedback and insights. The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 22
    23. 23. Useful information sources • Tutorial introduction (http://ruleml.org/papers/Primer) • RuleML MediaWiki (http://wiki.ruleml.org) • RuleML Blog & Social Mediazine (http://blog.ruleml.org) • Mailing lists (http://wiki.ruleml.org/index.php/Mailing_Lists) • Technical Groups (http://wiki.ruleml.org/index.php/Technical_Groups) • RuleML sources hosted on Github (https://github.com/RuleML) The 8th International Web Rule Symposium Prague, Czech Republic, August 18-20, 2014 23

    ×