Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JBoss World 2011 - Drools

2,935 views

Published on

Published in: Technology
  • Be the first to comment

JBoss World 2011 - Drools

  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. Agenda <ul><li>Product Overview
  9. 9. Community
  10. 10. History
  11. 11. Drools Expert </li><ul><li>Quick Example Stateless
  12. 12. Quick Example Stateful
  13. 13. Conditional elements
  14. 14. Timers and Calendars
  15. 15. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  16. 16. Enter the Decision table
  17. 17. Types
  18. 18. Decision tables in guvnor
  19. 19. Roadmap </li></ul></ul>
  20. 20. Drools Vs BRMS Repository Rules and Metadata JBoss Enterprise BRMS Platform JBoss Rules Rules Engine/ Execution Rules Development & Management CEP Complex Events Jboss EWP
  21. 21. Drools Vs BRMS <ul><li>Stand-alone Framework
  22. 22. Innovation
  23. 23. Fast and Frequent Releases
  24. 24. Tested on developer environments
  25. 25. Suitable for development and prototype
  26. 26. No Patches – On to next big thing
  27. 27. Non SLA bound forum support </li></ul><ul><li>Fully Integrated Platform
  28. 28. Same Innovated Code + Stability
  29. 29. Stability – Includes usability, performance and security issues identified during productization
  30. 30. Certified for Multi-OS, Multi-DB
  31. 31. Best for Development and Production
  32. 32. 5 Yr lifecycle – Includes patches, updates, backward compatibility
  33. 33. SLA based full support from dedicated support engineers
  34. 34. Open Source Assurance – legal protection </li></ul>derived
  35. 35. 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
  36. 36. Evolution of JBoss BRMS 05/08 04/09 12/10 ? <ul><li>Lightweight Business Rules Engine </li></ul><ul><li>Business Rules Engine
  37. 37. Authoring and Management App
  38. 38. Repository
  39. 39. EAP Certified
  40. 40. DBs, JVMs </li></ul><ul><li>Business Rules Engine
  41. 41. Authoring and Management App
  42. 42. Choice of Repository
  43. 43. Integrated Container
  44. 44. CEP – Tech Preview
  45. 45. EAP, EWS, EWP, JVMs, Dbs and more
  46. 46. 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
  47. 47. Back Up
  48. 49. Agenda <ul><li>Product Overview
  49. 50. Community
  50. 51. History
  51. 52. Drools Expert </li><ul><li>Quick Example Stateless
  52. 53. Quick Example Stateful
  53. 54. Conditional elements
  54. 55. Timers and Calendars
  55. 56. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  56. 57. Enter the Decision table
  57. 58. Types
  58. 59. Decision tables in guvnor
  59. 60. Roadmap </li></ul></ul>
  60. 61. 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>
  61. 62. Boot Camps <ul><li>San Francisco 2009 (40+ attendees) </li><ul><li>Sponsored by Third Pillar
  62. 63. 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
  63. 64. 5 day event, with 2 days focus on the healthcare industry
  64. 65. OSDE, AT&T, SAIC, US Navy Research, Kaiser, Clinica, Intermountain Healthcare, GE Healthcare, VA, Boeing, Nationwide .... </li></ul></ul>
  65. 66. Agenda <ul><li>Product Overview
  66. 67. Community
  67. 68. History
  68. 69. Drools Expert </li><ul><li>Quick Example Stateless
  69. 70. Quick Example Stateful
  70. 71. Conditional elements
  71. 72. Timers and Calendars
  72. 73. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  73. 74. Enter the Decision table
  74. 75. Types
  75. 76. Decision tables in guvnor
  76. 77. Roadmap </li></ul></ul>
  77. 78. It All Started Here Birth of CDSS 1970s 1980s Dendral Baobab Mycin Guidon Neomycin Teiresias Puff Emycin WM Sacon Centaur Wheeze Gravida Clot Oncocin
  78. 79. Because Not Everyone Is As Smart As He Is
  79. 80. Business Rules Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
  80. 81. 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
  81. 82. Iterative improves to JRules syntax with Clips functionality </li></ul><li>Drools 4 </li><ul><li>More declarative
  82. 83. Basic functional programming feature with “from”
  83. 84. Basic Rule Flow
  84. 85. Basic BRMS </li></ul><li>Drools 5 </li><ul><li>Improved functional programming with 'accumulate'
  85. 86. More Advanced Rule Flow integration
  86. 87. Complex Event Process </li><ul><li>Temporal Comparators
  87. 88. Sliding Time Windows </li></ul><li>Production ready BRMS (Guvnor) </li></ul></ul>
  88. 89. Drools History <ul><li>Drools 5.1 </li><ul><li>Differential Diff (true modify) </li></ul><li>Drools 5.2 (CR1 this week) </li><ul><li>Freeform expressions between patterns
  89. 90. Multi-function accumulates
  90. 91. Prolog like derivation queries
  91. 92. Decision tables and rule templates (Guvnor)
  92. 93. Pure GWT (Guvnor) </li></ul></ul>
  93. 94. Agenda <ul><li>Product Overview
  94. 95. Community
  95. 96. History
  96. 97. Drools Expert </li><ul><li>Quick Example Stateless
  97. 98. Quick Example Stateful
  98. 99. Conditional elements
  99. 100. Timers and Calendars
  100. 101. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  101. 102. Enter the Decision table
  102. 103. Types
  103. 104. Decision tables in guvnor
  104. 105. Roadmap </li></ul></ul>
  105. 106. Classes
  106. 107. 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
  107. 108. 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”
  108. 109. Agenda <ul><li>Product Overview
  109. 110. Community
  110. 111. History
  111. 112. Drools Expert </li><ul><li>Quick Example Stateless
  112. 113. Quick Example Stateful
  113. 114. Conditional elements
  114. 115. Timers and Calendars
  115. 116. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  116. 117. Enter the Decision table
  117. 118. Types
  118. 119. Decision tables in guvnor
  119. 120. Roadmap </li></ul></ul>
  120. 121. 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
  121. 122. 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() );
  122. 123. 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
  123. 124. Agenda <ul><li>Product Overview
  124. 125. Community
  125. 126. History
  126. 127. Drools Expert </li><ul><li>Quick Example Stateless
  127. 128. Quick Example Statefu l
  128. 129. Conditional elements
  129. 130. Timers and Calendars
  130. 131. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  131. 132. Enter the Decision table
  132. 133. Types
  133. 134. Decision tables in guvnor
  134. 135. Roadmap </li></ul></ul>
  135. 136. 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 { }
  136. 137. 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
  137. 138. 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
  138. 139. 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
  139. 140. 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
  140. 141. 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
  141. 142. 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
  142. 143. Agenda <ul><li>Product Overview
  143. 144. Community
  144. 145. History
  145. 146. Drools Expert </li><ul><li>Quick Example Stateless
  146. 147. Quick Example Stateful
  147. 148. Conditional elements
  148. 149. Timers and Calendars
  149. 150. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  150. 151. Enter the Decision table
  151. 152. Types
  152. 153. Decision tables in guvnor
  153. 154. Roadmap </li></ul></ul>
  154. 155. 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” ) )
  155. 156. 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
  156. 157. 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
  157. 158. 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
  158. 159. $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
  159. 160. Agenda <ul><li>Product Overview
  160. 161. Community
  161. 162. History
  162. 163. Drools Expert </li><ul><li>Quick Example Stateless
  163. 164. Quick Example Stateful
  164. 165. Conditional elements
  165. 166. Timers and Calendars
  166. 167. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  167. 168. Enter the Decision table
  168. 169. Types
  169. 170. Decision tables in guvnor
  170. 171. Roadmap </li></ul></ul>
  171. 172. 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
  172. 173. 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
  173. 174. Agenda <ul><li>Product Overview
  174. 175. Community
  175. 176. History
  176. 177. Drools Expert </li><ul><li>Quick Example Stateless
  177. 178. Quick Example Stateful
  178. 179. Conditional elements
  179. 180. Timers and Calendars
  180. 181. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  181. 182. Enter the Decision table
  182. 183. Types
  183. 184. Decision tables in guvnor
  184. 185. Roadmap </li></ul></ul>
  185. 186. 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?
  186. 187. TMS and Inference <ul><li>Bad </li><ul><li>Monolithic
  187. 188. Leaky
  188. 189. Brittle integrity - manual maintenance </li></ul></ul>
  189. 190. TMS and Inference <ul><li>A rule “logically” inserts an object
  190. 191. 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
  191. 192. 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
  192. 193. 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
  193. 194. TMS and Inference <ul><li>Good </li><ul><li>De-couple knowledge responsibilities
  194. 195. Encapsulate knowledge
  195. 196. Provide semantic abstractions for those encapsulation
  196. 197. Integrity robustness – truth maintenance </li></ul></ul>
  197. 198. Agenda <ul><li>Product Overview
  198. 199. Community
  199. 200. History
  200. 201. Drools Expert </li><ul><li>Quick Example Stateless
  201. 202. Quick Example Stateful
  202. 203. Conditional elements
  203. 204. Timers and Calendars
  204. 205. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  205. 206. Enter the Decision table
  206. 207. Types
  207. 208. Decision tables in guvnor
  208. 209. Roadmap </li></ul></ul>
  209. 210. Some decisions are simple I want to treat myself
  210. 211. Some decisions are simple
  211. 212. Some decisions are complex What insurance premium should I charge?
  212. 213. Some decisions are complex <ul><li>Business considerations </li><ul><li>Applicant's age
  213. 214. Applicant's experience
  214. 215. Sailing qualifications
  215. 216. Value of vessel
  216. 217. Type of cover </li></ul></ul>
  217. 218. 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
  218. 219. If less than 35 add 10% surcharge
  219. 220. If less than 45 add 5% surcharge </li></ul></ul></ul>
  220. 221. 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>
  221. 222. Agenda <ul><li>Product Overview
  222. 223. Community
  223. 224. History
  224. 225. Drools Expert </li><ul><li>Quick Example Stateless
  225. 226. Quick Example Stateful
  226. 227. Conditional elements
  227. 228. Timers and Calendars
  228. 229. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  229. 230. Enter the Decision table
  230. 231. Types
  231. 232. Decision tables in guvnor
  232. 233. Roadmap </li></ul></ul>
  233. 234. Enter the decision table <ul><li>Extract of decision table </li></ul>
  234. 235. Decision Table
  235. 236. 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
  236. 237. Decision Tables in Guvnor <ul><li>Generation of DRL
  237. 238. Each row compiles into a separate DRL rule </li></ul>
  238. 239. Decision Tables in Guvnor <ul><li>Generation of DRL
  239. 240. Each row compiles into a separate DRL rule
  240. 241. rule &quot;Row 1 dtable&quot;
  241. 242. dialect &quot;mvel&quot;
  242. 243. when
  243. 244. $person : Person( age < &quot;18&quot; )
  244. 245. then
  245. 246. $person.setHolidayEntitlement( 27 );
  246. 247. end
  247. 248. rule &quot;Row 2 dtable&quot;
  248. 249. dialect &quot;mvel&quot;
  249. 250. when
  250. 251. $person : Person( age >= &quot;18&quot; , age < &quot;45&quot; , lengthOfService < &quot;15&quot; )
  251. 252. then
  252. 253. $person.setHolidayEntitlement( 22 );
  253. 254. end </li></ul>
  254. 255. Agenda <ul><li>Product Overview
  255. 256. Community
  256. 257. History
  257. 258. Drools Expert </li><ul><li>Quick Example Stateless
  258. 259. Quick Example Stateful
  259. 260. Conditional elements
  260. 261. Timers and Calendars
  261. 262. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  262. 263. Enter the Decision table
  263. 264. Types
  264. 265. Decision tables in guvnor
  265. 266. Roadmap </li></ul></ul>
  266. 267. Types <ul>Types </ul><ul><ul><li>Layout </li><ul><ul><ul><li>Horizontal
  267. 268. Vertical
  268. 269. Limited entry
  269. 270. Extended entry </li></ul></ul></ul><li>Categorisation </li><ul><ul><ul><li>Expanded form, contracted form
  270. 271. Multi-hit, all hits
  271. 272. Multi-hit, first hit
  272. 273. Single hit </li></ul></ul></ul></ul></ul>
  273. 274. Layouts <ul>Horizontal </ul>
  274. 275. Layouts <ul>Vertical </ul>
  275. 276. Layouts <ul>Limited entry </ul>
  276. 277. Layouts <ul>Extended entry </ul>
  277. 278. Categorisation <ul>Expanded form </ul><ul><li>Single column for every condition combination
  278. 279. The number of columns should equal the product of the number of states for every condition. </li><ul><li>e.g. 3 conditions each with 2 states gives: </li></ul></ul>2 * 2 * 2 = 8 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
  279. 280. 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
  280. 281. 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>
  281. 282. Categorisation <ul>Expanded form (continued) </ul>
  282. 283. Categorisation <ul>Contracted form </ul><ul><li>Contraction is the first optimisation.
  283. 284. Reduces the number of condition columns.
  284. 285. 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>
  285. 286. Categorisation <ul>Contracted form – stage 1 Rules 2 and 3 are impossible conditions </ul>
  286. 287. Categorisation <ul>Contracted form – stage 2 Merge adjacent column groups with identical action parts </ul>
  287. 288. Categorisation <ul>Multi-hit, all hits </ul><ul><li>To get complete result all rules matching need to have their actions executed.
  288. 289. Condition columns are not mutually exclusive
  289. 290. 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>
  290. 291. 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
  291. 292. 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.
  292. 293. Condition columns are not mutually exclusive.
  293. 294. 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>
  294. 295. 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
  295. 296. Categorisation <ul>Single hit </ul><ul><li>Each possible combination of conditions matches exactly one, and only one, rule.
  296. 297. Condition columns are mutually exclusive
  297. 298. As the Condition columns are exclusive; combinations of conditions cannot be present in more than one column which eliminates ambiguity and inconsistency.
  298. 299. Classic form if Single-hit is &quot;expanded decision table&quot;; but this can be optimised or “contracted”. </li></ul>
  299. 300. 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
  300. 301. Agenda <ul><li>Product Overview
  301. 302. Community
  302. 303. History
  303. 304. Drools Expert </li><ul><li>Quick Example Stateless
  304. 305. Quick Example Stateful
  305. 306. Conditional elements
  306. 307. Timers and Calendars
  307. 308. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  308. 309. Enter the Decision table
  309. 310. Types
  310. 311. Decision tables in guvnor
  311. 312. Roadmap </li></ul></ul>
  312. 313. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul><li>Vertical layout
  313. 314. Generalised categorisation </li><ul><li>Multi-hit, all hit; Multi-hit first hit; Single hit </li></ul><li>Extended entry
  314. 315. Digitised condition states (enumerated fields)
  315. 316. New decision table editor </li></ul><ul><ul><li>Foundation for future work
  316. 317. Condition and rule negation
  317. 318. Cell merging
  318. 319. Cell grouping </li></ul></ul>
  319. 320. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell merging </ul>
  320. 321. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell grouping </ul>
  321. 322. 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>
  322. 323. Agenda <ul><li>Product Overview
  323. 324. Community
  324. 325. History
  325. 326. Drools Expert </li><ul><li>Quick Example Stateless
  326. 327. Quick Example Stateful
  327. 328. Conditional elements
  328. 329. Timers and Calendars
  329. 330. Truth maintenance and Inference </li></ul><li>Decision Tables </li><ul><li>Decisions
  330. 331. Enter the Decision table
  331. 332. Types
  332. 333. Decision tables in guvnor
  333. 334. Roadmap </li></ul></ul>
  334. 335. Roadmap <ul><li>What does the future hold? </li></ul><ul><li>Provision of other layouts </li><ul><li>Horizontal
  335. 336. Limited entry </li></ul></ul><ul><li>Automated optimisation
  336. 337. Improved support for digitised condition states
  337. 338. Integration of V&V providing visual feedback </li></ul><ul><li>Pluggable editors for Model Fact Types
  338. 339. Usability enhancements </li></ul>
  339. 340. Questions? Questions? <ul><li>Dave Bowman : All right, HAL; I'll go in through the emergency airlock.
  340. 341. HAL : Without your space helmet, Dave, you're going to find that rather difficult.
  341. 342. Dave Bowman : HAL, I won't argue with you anymore! Open the doors!
  342. 343. 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?
  343. 344. Backward Chaining query isContainedIn( String x, String y ) Location(x, y;) or ( Location(z, y;) and ?isContainedIn(x, z;) ) endn&quot; rule reactiveLook when Here( place : place) ?isContainedIn(place, &quot;keys&quot;;) thenn&quot; + System.out.println( &quot;We have found your keys&quot;); end

×