Drools New York City workshop 2011

3,858 views
3,749 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,858
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
233
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Example release/support life cycle, highly simplified (not a roadmap) Multiple Community projects develop their own respective versions Enterprise Platforms typically integrate many projects Diagram = binary releases only (all source is public; “source” version of this diagram would be much more complex) Community projects are always evolving Major/minor releases that are annual/quarterly Milestone releases that are approx. monthly Community releases are always being evaluated for functional, performance, quality standards for inclusion in a Platform Many Community releases are skipped over due to deficiencies e.g. AS5.0 didn't meet perf/stability, so EAP waited for AS5.1; AS6.0 probably will not meet criteria EAP alpha+beta+GA productization cycle follows Community AS “Final” release by 2-6 months During EAP productization period, many Community members move on to work on next release (new features) of Community projects For a given EAP release, support cycle lasts for 7 years Full support (4 yrs) – support + enhancements + patch releases Transition (1 yr) – support + patch releases Maintenance (2 yrs) – support + security patches only
  • Example release/support life cycle, highly simplified (not a roadmap) Multiple Community projects develop their own respective versions Enterprise Platforms typically integrate many projects Diagram = binary releases only (all source is public; “source” version of this diagram would be much more complex) Community projects are always evolving Major/minor releases that are annual/quarterly Milestone releases that are approx. monthly Community releases are always being evaluated for functional, performance, quality standards for inclusion in a Platform Many Community releases are skipped over due to deficiencies e.g. AS5.0 didn't meet perf/stability, so EAP waited for AS5.1; AS6.0 probably will not meet criteria EAP alpha+beta+GA productization cycle follows Community AS “Final” release by 2-6 months During EAP productization period, many Community members move on to work on next release (new features) of Community projects For a given EAP release, support cycle lasts for 7 years Full support (4 yrs) – support + enhancements + patch releases Transition (1 yr) – support + patch releases Maintenance (2 yrs) – support + security patches only
  • JBoss Community vs. Enterprise (another view of differences, similar to previous slide but with a few more details) Security Errata Certifications Out-of-the-box experience (e.g. configurations) Management/monitoring tools Software assurance / legal protection
  • Drools New York City workshop 2011

    1. 1. Mark Proctor Project Lead <ul><li>T he SkyNet funding bill is passed.
    2. 2. The system goes online on August 4th, 1997.
    3. 3. Human decisions are removed from strategic defense.
    4. 4. SkyNet begins to learn at a geometric rate.
    5. 5. It becomes self-aware at 2:14am Eastern time, August 29th
    6. 6. In a panic, they try to pull the plug.
    7. 7. And, Skynet fights back </li></ul>
    8. 8. Drools Vs BRMS Repository Rules and Metadata JBoss Enterprise BRMS Platform JBoss Rules Rules Engine/ Execution Rules Development & Management CEP Complex Events Jboss EWP
    9. 9. Drools Vs BRMS <ul><li>Stand-alone Framework
    10. 10. Innovation
    11. 11. Fast and Frequent Releases
    12. 12. Tested on developer environments
    13. 13. Suitable for development and prototype
    14. 14. No Patches – On to next big thing
    15. 15. Non SLA bound forum support </li></ul><ul><li>Fully Integrated Platform
    16. 16. Same Innovated Code + Stability
    17. 17. Stability – Includes usability, performance and security issues identified during productization
    18. 18. Certified for Multi-OS, Multi-DB
    19. 19. Best for Development and Production
    20. 20. 5 Yr lifecycle – Includes patches, updates, backward compatibility
    21. 21. SLA based full support from dedicated support engineers
    22. 22. Open Source Assurance – legal protection </li></ul>derived
    23. 23. JBoss Community & Enterprise Changes Community / Enterprise Platform Delta BRMS Drools Enterprise Platforms - Performance, Scalability, Security and Qualityimprove over time without compromising long-term compatibility. 08/09 12/10 03/11 05/11 Over 150+ defect fixes & 35+ OS/JVM/DB certifications (& counting) between Drools Community 5.1 & JBoss BRMS 5.1.x
    24. 24. Evolution of JBoss BRMS 05/08 04/09 12/10 ? <ul><li>Lightweight Business Rules Engine </li></ul><ul><li>Business Rules Engine
    25. 25. Authoring and Management App
    26. 26. Repository
    27. 27. EAP Certified
    28. 28. DBs, JVMs </li></ul><ul><li>Business Rules Engine
    29. 29. Authoring and Management App
    30. 30. Choice of Repository
    31. 31. Integrated Container
    32. 32. CEP – Tech Preview
    33. 33. EAP, EWS, EWP, JVMs, Dbs and more
    34. 34. Performance </li></ul>Repository JBoss Enterprise BRMS Platform 5.0 JBoss Rules BRM Repository JBoss Enterprise BRMS Platform 5.1 JBoss Rules BRM CEP Jboss EWP
    35. 35. Back Up
    36. 37. Agenda <ul><li>Community
    37. 38. History
    38. 39. Declarative Programming
    39. 40. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    40. 41. Conditional elements
    41. 42. Timers and Calendars
    42. 43. Truth maintenance and Inference
    43. 44. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    44. 45. Types
    45. 46. Validation and Verification
    46. 47. Transformation
    47. 48. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    48. 49. Sample Industries and Users <ul><li>Investment </li><ul><li>Millennium Investment Group (MIG) </li></ul><li>Logistics </li><ul><li>Fedex </li></ul><li>Airline </li><ul><li>Sabre </li></ul><li>Mortgage </li><ul><li>Franklin American </li></ul><li>Healthcare </li><ul><li>OSDE </li></ul></ul>
    49. 50. Boot Camps <ul><li>San Francisco 2009 (40+ attendees) </li><ul><li>Sponsored by Third Pillar
    50. 51. Sun, FAMC, OSDE, Kaseya, Fedex, TU Group, Intermountain Healthcare, Gap, Sony Pictures, Lockheed Martin, Kaiser, HP, Wells Fargo, US Navy Research, FOLIOfn, Boeing ..... </li></ul><li>San Diego 2010 (80+ attendess) </li><ul><li>Sponsored by US Navy
    51. 52. 5 day event, with 2 days focus on the healthcare industry
    52. 53. OSDE, AT&T, SAIC, US Navy Research, Kaiser, Clinica, Intermountain Healthcare, GE Healthcare, VA, Boeing, Nationwide .... </li></ul></ul>
    53. 54. Books <ul><li>Introduction to Expert Systems </li><ul><li>Peter Jackson </li></ul><li>Expert Systems, Principles and Programming </li><ul><li>Joseph C. Giarratano and Gary D. Riley </li></ul></ul>
    54. 55. Oh And There are Drools Books Too
    55. 56. Agenda <ul><li>Community
    56. 57. History
    57. 58. Declarative Programming
    58. 59. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    59. 60. Conditional elements
    60. 61. Timers and Calendars
    61. 62. Truth maintenance and Inference
    62. 63. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    63. 64. Types
    64. 65. Validation and Verification
    65. 66. Transformation
    66. 67. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    67. 68. It All Started Here Birth of CDSS 1970s 1980s Dendral Baobab Mycin Guidon Neomycin Teiresias Puff Emycin WM Sacon Centaur Wheeze Gravida Clot Oncocin
    68. 69. Because Not Everyone Is As Smart As He Is
    69. 70. Business Rules Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
    70. 71. Drools History <ul><li>Drools 2 </li><ul><li>Rete like XML Scripting language </li></ul><li>Drools 3 </li><ul><li>Based on Clips functionality
    71. 72. Iterative improves to JRules syntax with Clips functionality </li></ul><li>Drools 4 </li><ul><li>More declarative
    72. 73. Basic functional programming feature with “from”
    73. 74. Basic Rule Flow
    74. 75. Basic BRMS </li></ul><li>Drools 5 </li><ul><li>Improved functional programming with 'accumulate'
    75. 76. More Advanced Rule Flow integration
    76. 77. Complex Event Process </li><ul><li>Temporal Comparators
    77. 78. Sliding Time Windows </li></ul><li>Production ready BRMS (Guvnor) </li></ul></ul>
    78. 79. Drools History <ul><li>Drools 5.1 </li><ul><li>Differential Diff (true modify) </li></ul><li>Drools 5.2 (this month) </li><ul><li>Freeform expressions between patterns
    79. 80. Multi-function accumulates
    80. 81. Prolog like derivation queries
    81. 82. Decision tables and rule templates (Guvnor)
    82. 83. Pure GWT (Guvnor) </li></ul></ul>
    83. 84. Agenda <ul><li>Community
    84. 85. History
    85. 86. Declarative Programming
    86. 87. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    87. 88. Conditional elements
    88. 89. Timers and Calendars
    89. 90. Truth maintenance and Inference
    90. 91. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    91. 92. Types
    92. 93. Validation and Verification
    93. 94. Transformation
    94. 95. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    95. 96. Integrated Systems Semantic Ontologies Rules Event Processes Workflows Rules Workflows Event Processes Semantic Ontologies
    96. 97. Integrated Systems
    97. 98. Declarative Programming <ul><li>Production Rule Systems PRD (forward chaining) </li><ul><li>Reactive
    98. 99. when Alarm( status == “alert” ) then send( “warning” ) </li></ul><li>Logic Programming LP (backward chaining) </li><ul><li>Query
    99. 100. descendant( “mary”, “jane”) </li></ul><li>Functional Programming FP </li><ul><li>Map,Fold, Filter
    100. 101. avg([12, 16, 4, 6]) </li><ul><li>Returns single value 9.5 </li></ul><li>round([10.3, 4.7, 7.8] ) </li><ul><li>Returns List [10, 5, 8] </li></ul></ul><li>Description Logic </li><ul><li>Person Has Name and LivesAt Address </li></ul></ul>
    101. 102. Concepts Overview
    102. 103. Concepts Overview
    103. 104. Concepts Overview
    104. 105. Agenda <ul><li>Community
    105. 106. History
    106. 107. Declarative Programming
    107. 108. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    108. 109. Conditional elements
    109. 110. Timers and Calendars
    110. 111. Truth maintenance and Inference
    111. 112. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    112. 113. Types
    113. 114. Validation and Verification
    114. 115. Transformation
    115. 116. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    116. 117. Classes
    117. 118. rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount Credit Cashflow Rule
    118. 119. rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end rule “decrease balance for AccountPeriod Debits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == DEBIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance -= $amount; end Rules as a “view”
    119. 120. Agenda <ul><li>Community
    120. 121. History
    121. 122. Declarative Programming
    122. 123. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    123. 124. Conditional elements
    124. 125. Timers and Calendars
    125. 126. Truth maintenance and Inference
    126. 127. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    127. 128. Types
    128. 129. Validation and Verification
    129. 130. Transformation
    130. 131. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    131. 132. Definitions public class Applicant { private String name; private int age; private boolean valid; // getter and setter methods here } rule &quot;Is of valid age&quot; when $a : Applicant( age < 18 ) then modify ( $a ) { valid = false }; ends
    132. 133. Building KnowledgeBuilder kbuilder = KnowledgeBuilderFactory .newKnowledgeBuilder(); kbuilder .add( ResourceFactory .newClassPathResource( &quot;licenseApplication.drl&quot; , getClass() ), ResourceType.DRL ); if ( kbuilder .hasErrors() ) { System.err.println( kbuilder .getErrors().toString() ); } kbase .addKnowledgePackages( kbuilder .getKnowledgePackages() );
    133. 134. Executing StatelessKnowledgeSession ksession = kbase .newStatelessKnowledgeSession(); Applicant applicant = new Applicant ( &quot;Mr John Smith&quot; , 16 ); assertTrue ( applicant .isValid() ); ksession .execute( applicant ); assertFalse ( applicant .isValid() ); rule &quot;Is of valid age&quot; when $a : Applicant( age < 18 ) then modify ( $a ) { valid = false }; ends
    134. 135. Agenda <ul><li>Product Overview
    135. 136. Community
    136. 137. History
    137. 138. Declarative Programming
    138. 139. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    139. 140. Conditional elements
    140. 141. Timers and Calendars
    141. 142. Truth maintenance and Inference
    142. 143. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    143. 144. Types
    144. 145. Validation and Verification
    145. 146. Transformation
    146. 147. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    147. 148. Definitions public class Room { private String name // getter and setter methods here } public class Sprinkler { private Room room ; private boolean on ; // getter and setter methods here } public class Fire { private Room room ; // getter and setter methods here } public class Alarm { }
    148. 149. Definitions rule &quot;When there is a fire turn on the sprinkler&quot; when Fire ($room : room) $sprinkler : Sprinkler ( room == $room, on == false ) then modify ( $sprinkler ) { on = true }; println ( &quot;Turn on the sprinkler for room &quot; + $room.name ); end rule &quot;When the fire is gone turn off the sprinkler&quot; when $room : Room ( ) $sprinkler : Sprinkler ( room == $room, on == true ) not Fire ( room == $room ) then modify ( $sprinkler ) { on = false }; println ( &quot;Turn off the sprinkler for room &quot; + $room.name ); end
    149. 150. Definitions rule &quot;Raise the alarm when we have one or more fires&quot; when exists Fire () then insert ( new Alarm () ); println ( &quot;Raise the alarm&quot; ); end rule &quot;Cancel the alarm when all the fires have gone&quot; when not Fire () $alarm : Alarm () then retract ( $alarm ); println ( &quot;Cancel the alarm&quot; ); end
    150. 151. Definitions rule &quot;Status output when things are ok&quot; when not Alarm () not Sprinkler ( on === true ) then println ( &quot;Everything is ok&quot; ); end
    151. 152. Executing String [] names = new String []{ &quot;kitchen&quot; , &quot;bedroom&quot; , &quot;office&quot; , &quot;livingroom&quot; }; Map < String , Room > name2room = new HashMap < String , Room >(); for ( String name : names ){ Room room = new Room ( name ); name2room .put( name , room ); ksession .insert( room ); Sprinkler sprinkler = new Sprinkler ( room ); ksession .insert( sprinkler ); } ksession .fireAllRules() > Everything is ok
    152. 153. Executing Fire kitchenFire = new Fire ( name2room.get( &quot;kitchen&quot; ) ); Fire officeFire = new Fire ( name2room.get( &quot;office&quot; ) ); FactHandle kitchenFireHandle = ksession .insert( kitchenFire ); FactHandle officeFireHandle = ksession .insert( officeFire ); ksession .fireAllRules(); > Raise the alarm > Turn on the sprinkler for room kitchen > Turn on the sprinkler for room office
    153. 154. Executing ksession .retract( kitchenFireHandle ); ksession .retract( officeFireHandle ); ksession .fireAllRules() > Turn off the sprinkler for room office > Turn off the sprinkler for room kitchen > Cancel the alarm > Everything is ok rule &quot;Status output when things are ok&quot; when not Alarm () not Sprinkler ( on === true ) then println ( &quot;Everything is ok&quot; ); end
    154. 155. Agenda <ul><li>Community
    155. 156. History
    156. 157. Declarative Programming
    157. 158. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    158. 159. Conditional elements
    159. 160. Timers and Calendars
    160. 161. Truth maintenance and Inference
    161. 162. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    162. 163. Types
    163. 164. Validation and Verification
    164. 165. Transformation
    165. 166. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    166. 167. not Bus( color = “red” ) Conditional Elements exists Bus( color = “red” ) forall ( $bus : Bus( floors == 2 ) Bus( this == $bus, color == “red” ) ) forall ( $bus : Bus( color == “red” ) )
    167. 168. Accumulate CE rule &quot;accumulate&quot; when $sum : Number( intValue > 100 ) from accumulate ( Bus( color == &quot;red&quot; , $t : takings ) sum( $t ) ) then print &quot;sum is “ + $sum; end
    168. 169. Accumulate CE Patterns and CE's can be chained with ' from ' rule &quot;collect&quot; when $zipCode : ZipCode() $sum : Number( intValue > 100 ) from accumulate ( Bus( color == &quot;red&quot; , $t : takings ) from $hbn.getNamedQuery( “Find Buses” ) .setParameters( [ “zipCode” : $zipCode ] ) .list(), sum( $t ) ) then print &quot;sum is “ + $sum; end
    169. 170. Aggregations Rule Engines do not deal with aggregations $n : Number( intValue > 100 ) from accumulate ( $s : StockTicker( symbol == “RHAT” ) over window:time ( 5s ), average ( $s.price ) ) Over 5 seconds Aggregate ticker price for RHAT over last 5 seconds The pattern 'Number' reasons 'from' the accumulate result
    170. 171. $c : Custumer( type == “VIP ) $oe : BuyOrderEvent( customer == $c ) from entry-point “Home Broker Stream” not BuyAckEvent( relatedEvent == $oe.id, this after[1s, 10s] $oe ) from entry-point “Stock Trader Stream” Operators Existing Drools 'not' Conditional Elements can be used to detect non-occurrence of events BackAckEvent must occur between 1s and 10s ' after' BuyOrderEvent
    171. 172. Agenda <ul><li>Community
    172. 173. History
    173. 174. Declarative Programming
    174. 175. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    175. 176. Conditional elements
    176. 177. Timers and Calendars
    177. 178. Truth maintenance and Inference
    178. 179. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    179. 180. Types
    180. 181. Validation and Verification
    181. 182. Transformation
    182. 183. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    183. 184. Timers rule “name” timer ( cron: 0 0/15 * * * * ) when Alarm( ) then sendEmail( ”Alert Alert Alert!!!” ) Field Name Mandatory? Allowed Values Allowed Special Characters Seconds YES 0-59 , - * / Minutes YES 0-59 , - * / Hours YES 0-23 , - * / Day of month YES 1-31 , - * ? / L W Month YES 1-12 or JAN-DEC , - * / Day of week YES 1-7 or SUN-SAT , - * ? / L # Year NO empty, 1970-2099 , - * / Send alert every quarter of an hour
    184. 185. Calendars rule &quot;weekdays are high priority&quot; calendars &quot;weekday&quot; timer (int:0 1h) when Alarm() then send( &quot;priority high - we have an alarm” ); end rule &quot;weekend are low priority&quot; calendars &quot;weekend&quot; timer (int:0 4h) when Alarm() then send( &quot;priority low - we have an alarm” ); end Execute now and after 1 hour duration Execute now and after 4 hour duration
    185. 186. Agenda <ul><li>Community
    186. 187. History
    187. 188. Declarative Programming
    188. 189. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    189. 190. Conditional elements
    190. 191. Timers and Calendars
    191. 192. Truth maintenance and Inference
    192. 193. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    193. 194. Types
    194. 195. Validation and Verification
    195. 196. Transformation
    196. 197. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    197. 198. TMS and Inference rule &quot;Issue Child Bus Pass&quot; when $p : Person ( age < 16 ) then insert(new ChildBusPass ( $p ) ); end rule &quot;Issue Adult Bus Pass&quot; when $p : Person ( age >= 16 ) then insert(new AdultBusPass ( $p ) ); end Couples the logic What happens when the Child stops being 16?
    198. 199. TMS and Inference <ul><li>Bad </li><ul><li>Monolithic
    199. 200. Leaky
    200. 201. Brittle integrity - manual maintenance </li></ul></ul>
    201. 202. TMS and Inference <ul><li>A rule “logically” inserts an object
    202. 203. When the rule is no longer true, the object is retracted. </li></ul>when $p : Person ( age < 16 ) then logicalInsert ( new IsChild ( $p ) ) end when $p : Person ( age >= 16 ) then logicalInsert ( new IsAdult ( $p ) ) end de-couples the logic Maintains the truth by automatically retracting
    203. 204. TMS and Inference rule &quot;Issue Child Bus Pass&quot; when $p : Person ( ) IsChild ( person =$p ) then logicalInsert ( new ChildBusPass ( $p ) ); end rule &quot;Issue Adult Bus Pass&quot; when $p : Person ( age >= 16 ) IsAdult ( person =$p ) then logicalInsert ( new AdultBusPass ( $p ) ); end The truth maintenance cascades
    204. 205. TMS and Inference rule &quot;Issue Child Bus Pass&quot; when $p : Person ( ) not ( ChildBusPass ( person == $p ) ) then requestChildBusPass( $p ); end The truth maintenance cascades
    205. 206. TMS and Inference <ul><li>Good </li><ul><li>De-couple knowledge responsibilities
    206. 207. Encapsulate knowledge
    207. 208. Provide semantic abstractions for those encapsulation
    208. 209. Integrity robustness – truth maintenance </li></ul></ul>
    209. 210. Agenda <ul><li>Community
    210. 211. History
    211. 212. Declarative Programming
    212. 213. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    213. 214. Conditional elements
    214. 215. Timers and Calendars
    215. 216. Truth maintenance and Inference
    216. 217. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    217. 218. Types
    218. 219. Validation and Verification
    219. 220. Transformation
    220. 221. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    221. 222. Backward Chaining query isChild( Person p ) $p : Person ( age <= 16 ) end rule &quot;Issue Child Bus Pass&quot; when $p : Person ( ) ?isChild ( $p ) then logicalInsert ( new ChildBusPass ( $p ) ); end
    222. 223. Backward Chaining query isContainedIn( String x, String y ) Location ( x, y; ) or ( Location ( z, y; ) and ?isContainedIn ( x, z; ) ) end rule reactiveLook when Here ( place : place) ?isContainedIn ( place, &quot;keys&quot; ; ) then System.out.println( &quot;We have found your keys&quot; ); end
    223. 224. Agenda <ul><li>Community
    224. 225. History
    225. 226. Declarative Programming
    226. 227. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    227. 228. Conditional elements
    228. 229. Timers and Calendars
    229. 230. Truth maintenance and Inference
    230. 231. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    231. 232. Types
    232. 233. Validation and Verification
    233. 234. Transformation
    234. 235. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    235. 236. Some decisions are simple I want to treat myself
    236. 237. Some decisions are simple
    237. 238. Some decisions are complex What insurance premium should I charge?
    238. 239. Some decisions are complex <ul><li>Business considerations </li><ul><li>Applicant's age
    239. 240. Applicant's experience
    240. 241. Sailing qualifications
    241. 242. Value of vessel
    242. 243. Type of cover </li></ul></ul>
    243. 244. Some decisions are complex <ul><li>Business considerations </li><ul><li>Applicant's age </li><ul><li>Only insure people over 25 years of age
    244. 245. If less than 35 add 10% surcharge
    245. 246. If less than 45 add 5% surcharge </li></ul></ul></ul>
    246. 247. Some decisions are complex <ul><li>Business considerations </li><ul><li>Applicant's experience </li><ul><li>If sailing < 5 years then charge +10% </li></ul><li>Sailing qualifications </li><ul><li>None charge +100% </li></ul></ul><li>Etc... </li></ul>
    247. 248. Enter the decision table <ul><li>Extract of decision table </li></ul>
    248. 249. Decision Table
    249. 250. Decision Table rule &quot;Pricing bracket_10&quot; when Driver(age >= 18, age <= 24, locationRiskProfile == &quot;LOW&quot;, priorClaims == &quot;1&quot;) policy: Policy(type == &quot;COMPREHENSIVE&quot;) then policy.setBasePrice(450); end
    250. 251. Decision Tables in Guvnor <ul><li>Generation of DRL
    251. 252. Each row compiles into a separate DRL rule </li></ul>
    252. 253. Decision Tables in Guvnor <ul><li>Generation of DRL
    253. 254. Each row compiles into a separate DRL rule
    254. 255. rule &quot;Row 1 dtable&quot;
    255. 256. dialect &quot;mvel&quot;
    256. 257. when
    257. 258. $person : Person( age < &quot;18&quot; )
    258. 259. then
    259. 260. $person.setHolidayEntitlement( 27 );
    260. 261. end
    261. 262. rule &quot;Row 2 dtable&quot;
    262. 263. dialect &quot;mvel&quot;
    263. 264. when
    264. 265. $person : Person( age >= &quot;18&quot; , age < &quot;45&quot; , lengthOfService < &quot;15&quot; )
    265. 266. then
    266. 267. $person.setHolidayEntitlement( 22 );
    267. 268. end </li></ul>
    268. 269. Agenda <ul><li>Community
    269. 270. History
    270. 271. Declarative Programming
    271. 272. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    272. 273. Conditional elements
    273. 274. Timers and Calendars
    274. 275. Truth maintenance and Inference
    275. 276. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    276. 277. Types
    277. 278. Validation and Verification
    278. 279. Transformation
    279. 280. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    280. 281. Types <ul>Types </ul><ul><ul><li>Layout </li><ul><ul><ul><li>Horizontal
    281. 282. Vertical
    282. 283. Limited entry
    283. 284. Extended entry </li></ul></ul></ul><li>Categorisation </li><ul><ul><ul><li>Expanded form, contracted form
    284. 285. Multi-hit, all hits
    285. 286. Multi-hit, first hit
    286. 287. Single hit </li></ul></ul></ul></ul></ul>
    287. 288. Layouts <ul>Horizontal </ul>
    288. 289. Layouts <ul>Vertical </ul>
    289. 290. Layouts <ul>Limited entry </ul>
    290. 291. Layouts <ul>Extended entry </ul>
    291. 292. Categorisation <ul>Expanded form </ul><ul><li>Single column for every condition combination
    292. 293. The number of columns should equal the product of the number of states for every condition. </li><ul><li>e.g. 2 conditions, one with 3 states the other 4 (see above): </li></ul></ul>3 * 4 = 12 combinations <ul><ul><li>e.g. 2 conditions each with 3 states and 1 condition with 4 states gives: </li></ul></ul>3 * 3 * 4 = 36 combinations
    293. 294. Categorisation <ul>Expanded form (continued) </ul><ul><li>Condition states should be digitised </li><ul><li>e.g. age: <18, 18-35, 36-60, >60 not a free-form integer field </li></ul><li>Condition states should be continuous </li><ul><li>e.g. GOOD: age<18, age>=18; BAD: age<18, age>=30
    294. 295. Not essential for expansion but ensures completeness </li></ul><li>This guarantee of completeness of condition combinations is one of the main advantages of decision tables. </li></ul>
    295. 296. Categorisation <ul>Expanded form (continued) </ul>
    296. 297. Categorisation <ul>Contracted form </ul><ul><li>Contraction is the first optimisation.
    297. 298. Reduces the number of condition columns.
    298. 299. Removes impossible combinations
    299. 300. If the same actions exist for rules covering all condition states for a given condition they can be combined and the condition state becomes irrelevant. </li></ul>
    300. 301. Categorisation <ul>Contracted form – stage 1 Rules 2 and 3 are impossible conditions </ul>
    301. 302. Categorisation <ul>Contracted form – stage 2 Merge adjacent column groups with identical action parts </ul>
    302. 303. Categorisation <ul>Multi-hit, all hits </ul><ul><li>To get complete result all rules matching need to have their actions executed.
    303. 304. Condition columns are not mutually exclusive
    304. 305. If the Condition columns are not exclusive, some combination of conditions are present in more than one column, which may lead to ambiguity or inconsistency. </li></ul>
    305. 306. Categorisation <ul>Multi-hit, all hits </ul>Given a 35 year old with 15 years service 1. Rule 1 matches, giving 22 days 2. Rule 5 matches, giving an additional 3 days 3. A total of 25 days is assigned
    306. 307. Categorisation <ul>Multi-hit, first hit </ul><ul><li>To get complete result the first rule (from left-to-right) matching needs to have its action executed.
    307. 308. Condition columns are not mutually exclusive.
    308. 309. If the Condition columns are not exclusive, some combination of conditions are present in more than one column, which may lead to ambiguity or inconsistency. </li></ul>
    309. 310. Categorisation <ul>Multi-hit, first hit </ul>Given a 35 year old with 15 years service 1. Rule 4 matches, giving 25 days 2. Rule 6 would match but Rule 4 was the first hit
    310. 311. Categorisation <ul>Single hit </ul><ul><li>Each possible combination of conditions matches exactly one, and only one, rule.
    311. 312. Condition columns are mutually exclusive
    312. 313. As the Condition columns are exclusive; combinations of conditions cannot be present in more than one column which eliminates ambiguity and inconsistency.
    313. 314. Classic form if Single-hit is &quot;expanded decision table&quot;; but this can be optimised or “contracted”. </li></ul>
    314. 315. Categorisation <ul>Single hit </ul>Given a 35 year old with 15 years service 1. Rule 3 matches, giving 25 days 2. No other rules match
    315. 316. Agenda <ul><li>Community
    316. 317. History
    317. 318. Declarative Programming
    318. 319. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    319. 320. Conditional elements
    320. 321. Timers and Calendars
    321. 322. Truth maintenance and Inference
    322. 323. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    323. 324. Types
    324. 325. Validation and Verification
    325. 326. Transformation
    326. 327. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    327. 328. Validation & Verification <ul><li>Redundancy
    328. 329. Ambivalence (conflicting)
    329. 330. Deficiency
    330. 331. Mitigation </li></ul>
    331. 332. Validation & Verification <ul><li>Redundancy </li></ul><ul><li>Duplication
    332. 333. Subsumption </li></ul><ul><ul><li>Two rules have the same actions, but one contains additional conditions in which it will succeed. Whenever the more restrictive rule succeeds, the less restrictive rule also succeeds, resulting in redundancy. </li></ul></ul><ul><li>Impossible conditions </li><ul><li>Conditions that do not make sense (e.g. age < 0) </li></ul></ul>
    333. 334. Validation & Verification <ul><li>Redundancy - Subsumption </li></ul>
    334. 335. Validation & Verification <ul><li>Ambivalence </li></ul><ul><li>Contradictory rules </li></ul><ul><ul><li>Two (or more) rules have the same conditions but with different actions. </li></ul></ul><ul><li>Conflicting rules </li></ul><ul><ul><li>An action for one rule is the opposite of the same action for the other rule. </li></ul></ul><ul><li>Ambiguous rules </li><ul><li>The actions are different but not opposite. </li></ul></ul>
    335. 336. Validation & Verification <ul><li>Deficiency </li></ul><ul><li>Missing rules </li><ul><li>A situation exists in which a particular action is required, but there is no rule that succeeds in that situation and produces the desired conclusion. </li></ul><li>Unused input state or domain attribute
    336. 337. Missing knowledge </li><ul><li>The absence of some essential elements from the problem situation. </li></ul></ul>
    337. 338. Validation & Verification <ul><li>Deficiency </li></ul><ul><ul><li>Premium is £500 if applicant age is less than 30
    338. 339. Premium is £300 if Years Without Claim is greater than or equal to 10 years. </li></ul></ul><ul><ul><li>Applicant is 29, premium is £500
    339. 340. Applicant has 12 years without claim, premium is £300 </li></ul></ul><ul><ul><li>Applicant is 29 with 12 years without claim, premium is ?!? </li></ul></ul>
    340. 341. Agenda <ul><li>Community
    341. 342. History
    342. 343. Declarative Programming
    343. 344. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    344. 345. Conditional elements
    345. 346. Timers and Calendars
    346. 347. Truth maintenance and Inference
    347. 348. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    348. 349. Types
    349. 350. Validation and Verification
    350. 351. Transformation
    351. 352. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    352. 353. Transformation <ul><li>Decision Trees </li></ul><ul><li>Requirements </li><ul><li>Digitised condition states
    353. 354. Each Condition in a column becomes a branch </li></ul><li>Multi-hit </li><ul><li>Walk every path through tree </li></ul><li>Single-hit </li><ul><li>Walk single path through tree </li></ul></ul>
    354. 355. Transformation <ul><li>Example - Decision Table </li></ul>
    355. 356. Transformation <ul><li>Example - Decision Tree </li></ul>
    356. 357. Transformation <ul><li>Paying attention?
    357. 358. Rules 1, 2 and 3, 4 have the same action no matter what the state of “Hunger”. Therefore they can be contracted... </li></ul>
    358. 359. Agenda <ul><li>Community
    359. 360. History
    360. 361. Declarative Programming
    361. 362. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    362. 363. Conditional elements
    363. 364. Timers and Calendars
    364. 365. Truth maintenance and Inference
    365. 366. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    366. 367. Types
    367. 368. Validation and Verification
    368. 369. Transformation
    369. 370. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    370. 371. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul><li>Vertical layout
    371. 372. Generalised categorisation </li><ul><li>Multi-hit, all hit; Multi-hit first hit; Single hit </li></ul><li>Extended entry
    372. 373. Digitised condition states (enumerated fields)
    373. 374. New decision table editor </li></ul><ul><ul><li>Foundation for future work
    374. 375. Condition and rule negation
    375. 376. Cell merging
    376. 377. Cell grouping </li></ul></ul>
    377. 378. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell merging </ul>
    378. 379. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell grouping </ul>
    379. 380. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul><li>Video demonstration </li></ul><ul><ul><li>Demonstration available online at http://vimeo.com/21438537 </li></ul></ul>
    380. 381. Agenda <ul><li>Community
    381. 382. History
    382. 383. Declarative Programming
    383. 384. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
    384. 385. Conditional elements
    385. 386. Timers and Calendars
    386. 387. Truth maintenance and Inference
    387. 388. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
    388. 389. Types
    389. 390. Validation and Verification
    390. 391. Transformation
    391. 392. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
    392. 393. Roadmap <ul><li>Decision Tables </li></ul><ul><li>Provision of other layouts </li><ul><li>Horizontal
    393. 394. Limited entry </li></ul></ul><ul><li>Automated optimisation
    394. 395. Improved support for digitised condition states
    395. 396. Integration of V&V providing visual feedback </li></ul><ul><li>Pluggable editors for Model Fact Types
    396. 397. Usability enhancements </li></ul>
    397. 398. Roadmap <ul><li>Drools </li></ul><ul><li>Improved backward chaining (open queries)
    398. 399. Optimistic backward chaining.
    399. 400. Business Semantics (ontologies)
    400. 401. Simulation Testing
    401. 402. High Availability
    402. 403. Distributed (Grid) platform
    403. 404. Runtime Management
    404. 405. BAM </li></ul>
    405. 406. Questions? Questions? <ul><li>Dave Bowman : All right, HAL; I'll go in through the emergency airlock.
    406. 407. HAL : Without your space helmet, Dave, you're going to find that rather difficult.
    407. 408. Dave Bowman : HAL, I won't argue with you anymore! Open the doors!
    408. 409. HAL : Dave, this conversation can serve no purpose anymore. Goodbye. </li></ul>Joshua: Greetings, Professor Falken. Stephen Falken : Hello, Joshua. Joshua: A strange game. The only winning move is not to play. How about a nice game of chess?

    ×