rules, events and workflow

2,354 views

Published on

presentation on rules, events and workflow

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

No Downloads
Views
Total views
2,354
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
187
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

rules, events and workflow

  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>Community
  9. 9. History
  10. 10. Declarative Programming
  11. 11. Drools Expert
  12. 12. Drools Fustion
  13. 13. jBPM
  14. 14. Roadmap </li></ul>
  15. 15. Boot Camps <ul><li>San Francisco 2009 (40+ attendees) </li><ul><li>Sponsored by Third Pillar
  16. 16. 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
  17. 17. 5 day event, with 2 days focus on the healthcare industry
  18. 18. OSDE, AT&T, SAIC, US Navy Research, Kaiser, Clinica, Intermountain Healthcare, GE Healthcare, VA, Boeing, Nationwide .... </li></ul></ul>
  19. 19. 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>
  20. 20. Oh And There are Drools Books Too
  21. 21. History
  22. 22. It All Started Here Birth of CDSS Clinical Decision Support Systems 1970s 1980s Dendral Baobab Mycin Guidon Neomycin Teiresias Puff Emycin WM Sacon Centaur Wheeze Gravida Clot Oncocin
  23. 23. Because Not Everyone Is As Smart As He Is
  24. 24. Business Rules Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
  25. 25. 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
  26. 26. Iterative improves to JRules syntax with Clips functionality </li></ul><li>Drools 4 </li><ul><li>More declarative
  27. 27. Basic functional programming feature with “from”
  28. 28. Basic Rule Flow
  29. 29. Basic BRMS </li></ul><li>Drools 5 </li><ul><li>Improved functional programming with 'accumulate'
  30. 30. More Advanced Rule Flow integration
  31. 31. Complex Event Process </li><ul><li>Temporal Comparators
  32. 32. Sliding Time Windows </li></ul><li>Production ready BRMS (Guvnor) </li></ul></ul>
  33. 33. Drools History <ul><li>Drools 5.1 </li><ul><li>Differential Diff (true modify) </li></ul><li>Drools 5.2 </li><ul><li>Freeform expressions between patterns
  34. 34. Multi-function accumulates
  35. 35. Prolog like derivation queries
  36. 36. Decision tables and rule templates (Guvnor)
  37. 37. Pure GWT (Guvnor) </li></ul><li>Drools 5.3 </li><ul><li>... </li></ul></ul>
  38. 38. Declarative Programming
  39. 39. Integrated Systems Semantic Ontologies Rules Event Processes Workflows Rules Workflows Event Processes Semantic Ontologies
  40. 40. Integrated Systems
  41. 41. Rules and processes loosely coupled tightly coupled specific generic Decision Services Process Rules SCOPE COUPLING ?
  42. 42. Business Logic Lifecycle
  43. 43. Declarative Programming <ul><li>Production Rule Systems PRD (forward chaining) </li><ul><li>Reactive
  44. 44. when Alarm( status == “alert” ) then send( “warning” ) </li></ul><li>Logic Programming LP (backward chaining) </li><ul><li>Query
  45. 45. descendant( “mary”, “jane”) </li></ul><li>Functional Programming FP </li><ul><li>Map,Fold, Filter
  46. 46. 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>
  47. 47. Concepts Overview
  48. 48. Concepts Overview
  49. 49. Concepts Overview
  50. 50. Drools Expert
  51. 51. Classes
  52. 52. 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
  53. 53. 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”
  54. 54. 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 { }
  55. 55. 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
  56. 56. 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
  57. 57. 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
  58. 58. 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
  59. 59. 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
  60. 60. 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
  61. 61. 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” ) )
  62. 62. 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
  63. 63. 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
  64. 64. 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
  65. 65. 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
  66. 66. 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
  67. 67. Drools Fusion
  68. 68. Drools Fusion: Enables... <ul><li>Event Detection: </li><ul><li>From an event cloud or set of streams, select all the meaningful events, and only them. </li></ul><li>[Temporal] Event Correlation: </li><ul><li>Ability to correlate events and facts declaring both temporal and non-temporal constraints between them.
  69. 69. Ability to reason over event aggregation. </li></ul><li>Event Sequencing: </li><ul><li>A -> ( B OR C ) -> D </li></ul><li>Event Abstraction: </li><ul><li>Ability to compose complex events from atomic events AND reason over them </li></ul></ul>
  70. 70. Drools Fusion: Features <ul><li>Support to Event semantics: </li><ul><li>Usually immutable, but not enforced
  71. 71. Strong temporal relationships
  72. 72. Managed lifecycle
  73. 73. Point-in-time and Interval events </li></ul><li>Time semantics </li><ul><li>Discrete </li></ul><li>Temporal relationships </li><ul><li>All 13 operators defined by James Allen (+ negations) </li></ul></ul>
  74. 74. Event Driven Architecture (EDA) “ Event Driven Architecture (EDA) is a software architecture pattern promoting the production , detection , consumption of, and reaction to events. An event can be defined as &quot;a significant change in state&quot;[1]. For example, when a consumer purchases a car, the car's state changes from &quot;for sale&quot; to &quot;sold&quot;. A car dealer's system architecture may treat this state change as an event to be produced, published, detected and consumed by various applications within the architecture.”
  75. 75. CEP vs EDA vs SOA <ul><li>CEP is component of EDA
  76. 76. EDA is **not** SOA 2.0
  77. 77. Complementary architectures
  78. 78. Metaphor </li><ul><li>In our body : </li><ul><li>SOA is used to build our muscles and organs
  79. 79. EDA is used to build our sensory system </li></ul></ul></ul>
  80. 80. $c : Custumer( type == “VIP ) BuyOrderEvent( customer == $c ) from entry-point “Home Broker Stream” Scalability EntryPoint entryPoint = session. getEntryPoint ( “Home Broker Stream” ); entryPoint.insert( event ) ; So lets allow multiple named entry points for those streams So now we can insert different streams concurrently Patterns can now optional specify their entry-point. When not specified uses the “default” entry-point
  81. 81. declare StockTick @role( event ) end declare StockTick @role( event ) @timestamp( timestampAttr ) companySymbol : String stockPrice : double timestampAttr : long end Automatic Life-Cycle Management Just use the declare statement to declare a type as an event and it will be retracted when it is no longer needed The declare statement can also specify an internal model, that external objects/xml/csv map on to. We support Smooks and JAXB
  82. 82. $c : Custumer( type == “VIP ) $oe : BuyOrderEvent( customer == $c ) from entry-point “Home Broker Stream” BuyAckEvent( relatedEvent == $oe.id, this after[1s, 10s] $oe ) from entry-point “Stock Trader Stream” <ul><li>coincides
  83. 83. before
  84. 84. after
  85. 85. meets
  86. 86. metby </li></ul><ul><li>overlaps
  87. 87. overlappedby
  88. 88. during
  89. 89. includes </li></ul><ul><li>starts
  90. 90. startedby
  91. 91. finishes
  92. 92. finishedby </li></ul>Operators The Full set of Operators are supported BackAckEvent must occur between 1s and 10s ' after' BuyOrderEvent
  93. 93. Drools Fusion: Temporal Reasoning
  94. 94. Drools Fusion: Temporal Reasoning
  95. 95. $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
  96. 96. 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
  97. 97. Aggregations acc ( $s : StockTicker( symbol == “RHAT” ) over window:time ( 5s ); $min : min ( $s.price ), $min : min ( $s.price ), $avg : avg ( $s.price ); $min > 10 && $max < 20 && $avg > 16 ) Over 5 seconds functions Accumlate over data Guard constraint
  98. 98. 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
  99. 99. CEP Applied at FedEx Custom Critical <ul><li>Time specific deliveries for critical freight
  100. 100. Exclusive use non-stop door-to-door services
  101. 101. Blended Surface and Air services to minimize cost and transit time
  102. 102. Extra care in handling and specially equipped vehicles </li><ul><li>Temperature Control, Secured Services, Hazardous Material, Constant Surveillance </li></ul></ul>* Presented by Adam Mollemkopf at ORF 2009
  103. 103. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  104. 104. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  105. 105. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  106. 106. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  107. 107. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  108. 108. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
  109. 109. CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009 <ul><li>At least 50% of Alerts can be reasoned automatically, promoting staff savings and improved Customer and Driver experiences.
  110. 110. Risk Avoidance via pro-active monitoring </li><ul><li>Reduction in insurance claims and shipment service failures </li></ul><li>Minimum 30% efficiency gains in shipment monitoring , saving at least 15% of Operations staff cost. </li></ul>
  111. 111. CEP Applied at FedEx Custom Critical <ul><li>Some numbers (from early 2010): </li><ul><li>24 x 7 sessions, no downtime
  112. 112. Average of 500k+ facts/events concurrently in memory </li><ul><li>Business hours: 1M+ facts/events concurrently </li></ul><li>Response time for reasoning cycles: </li><ul><li>Average: 150 ms
  113. 113. Peak: 1.2 sec </li></ul><li>Several hundred rules </li></ul></ul>
  114. 114. 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?
  115. 115. TMS and Inference <ul><li>Bad </li><ul><li>Monolithic
  116. 116. Leaky
  117. 117. Brittle integrity - manual maintenance </li></ul></ul>
  118. 118. TMS and Inference <ul><li>A rule “logically” inserts an object
  119. 119. 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
  120. 120. 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
  121. 121. 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
  122. 122. TMS and Inference <ul><li>Good </li><ul><li>De-couple knowledge responsibilities
  123. 123. Encapsulate knowledge
  124. 124. Provide semantic abstractions for those encapsulation
  125. 125. Integrity robustness – truth maintenance </li></ul></ul>
  126. 126. Some decisions are complex What insurance premium should I charge?
  127. 127. Some decisions are complex <ul><li>Business considerations </li><ul><li>Applicant's age
  128. 128. Applicant's experience
  129. 129. Sailing qualifications
  130. 130. Value of vessel
  131. 131. Type of cover </li></ul></ul>
  132. 132. 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
  133. 133. If less than 35 add 10% surcharge
  134. 134. If less than 45 add 5% surcharge </li></ul></ul></ul>
  135. 135. 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>
  136. 136. Enter the decision table <ul><li>Extract of decision table </li></ul>
  137. 137. Decision Table
  138. 138. 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
  139. 139. Decision Tables in Guvnor <ul><li>Generation of DRL
  140. 140. Each row compiles into a separate DRL rule </li></ul>
  141. 141. Types <ul>Types </ul><ul><ul><li>Layout </li><ul><ul><ul><li>Horizontal
  142. 142. Vertical
  143. 143. Limited entry
  144. 144. Extended entry </li></ul></ul></ul><li>Categorisation </li><ul><ul><ul><li>Expanded form, contracted form
  145. 145. Multi-hit, all hits
  146. 146. Multi-hit, first hit
  147. 147. Single hit </li></ul></ul></ul></ul></ul>
  148. 148. Layouts <ul>Horizontal </ul>
  149. 149. Layouts <ul>Vertical </ul>
  150. 150. Layouts <ul>Limited entry </ul>
  151. 151. Layouts <ul>Extended entry </ul>
  152. 152. Categorisation <ul>Expanded form </ul><ul><li>Single column for every condition combination
  153. 153. 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
  154. 154. 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
  155. 155. 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>
  156. 156. Categorisation <ul>Expanded form (continued) </ul>
  157. 157. Categorisation <ul>Contracted form </ul><ul><li>Contraction is the first optimisation.
  158. 158. Reduces the number of condition columns.
  159. 159. Removes impossible combinations
  160. 160. 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>
  161. 161. Categorisation <ul>Contracted form – stage 1 Rules 2 and 3 are impossible conditions </ul>
  162. 162. Categorisation <ul>Contracted form – stage 2 Merge adjacent column groups with identical action parts </ul>
  163. 163. 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
  164. 164. 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
  165. 165. 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
  166. 166. Agenda <ul><li>Community
  167. 167. History
  168. 168. Declarative Programming
  169. 169. Drools Expert </li><ul><li>Quick Example Stateless/Stateful
  170. 170. Conditional elements
  171. 171. Timers and Calendars
  172. 172. Truth maintenance and Inference
  173. 173. Backward chaining </li></ul><li>Decision Tables </li><ul><li>Decisions and Decision Tables
  174. 174. Types
  175. 175. Validation and Verification
  176. 176. Transformation
  177. 177. Decision tables in guvnor </li></ul><li>Roadmap </li></ul>
  178. 178. Validation & Verification <ul><li>Redundancy
  179. 179. Ambivalence (conflicting)
  180. 180. Deficiency
  181. 181. Mitigation </li></ul>
  182. 182. Validation & Verification <ul><li>Redundancy - Subsumption </li></ul>
  183. 183. Validation & Verification <ul><li>Deficiency </li></ul><ul><ul><li>Premium is £500 if applicant age is less than 30
  184. 184. 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
  185. 185. 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>
  186. 186. Transformation <ul><li>Example - Decision Table </li></ul>
  187. 187. Transformation <ul><li>Example - Decision Tree </li></ul>
  188. 188. Transformation <ul><li>Paying attention?
  189. 189. Rules 1, 2 and 3, 4 have the same action no matter what the state of “Hunger”. Therefore they can be contracted... </li></ul>
  190. 190. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul><li>Vertical layout
  191. 191. Generalised categorisation </li><ul><li>Multi-hit, all hit; Multi-hit first hit; Single hit </li></ul><li>Extended entry
  192. 192. Digitised condition states (enumerated fields)
  193. 193. New decision table editor </li></ul><ul><ul><li>Foundation for future work
  194. 194. Condition and rule negation
  195. 195. Cell merging
  196. 196. Cell grouping </li></ul></ul>
  197. 197. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell merging </ul>
  198. 198. Decision Tables in Guvnor <ul><li>What do we currently provide? </li></ul><ul>Cell grouping </ul>
  199. 199. jBPM
  200. 200. Key Characteristics of jBPM5 <ul><li>Open-source business process management project offering: </li></ul><ul><ul><li>generic process engine supporting native BPMN 2.0 execution
  201. 201. targeting developers and business users
  202. 202. collaboration, management and monitoring using web-based consoles
  203. 203. powerful rules and event integration </li></ul></ul>
  204. 204. From Workflow to BPM <ul><li>Core engine is a workflow engine in pure Java </li></ul><ul><ul><li>state transitions
  205. 205. lightweight
  206. 206. embeddable
  207. 207. generic, extensible </li></ul></ul>Core Engine
  208. 208. Java Interface ProcessRuntime interface <ul><li>startProcess(processId)
  209. 209. startProcess(processId, parameters)
  210. 210. signalEvent(type, event)
  211. 211. signalEvent(type, event, instanceId)
  212. 212. abortProcessInstance(instanceId)
  213. 213. getProcessInstance(instanceId)
  214. 214. … </li></ul>
  215. 215. Drools Expert KnowledegBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBulider(); kbuilder.addResource( ResourceFactory.newClassPathResource( “myrules.drl”, ResourceType.DRL ); If ( kbuilder.hasErrors() ) { log.error( kbuilder.hasErrors().toString() ); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbase.getKnowledgePackages() ); Knowledge API
  216. 216. Drools Flow KnowledegBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBulider(); kbuilder.addResource( ResourceFactory.newClassPathResource( “myflow.bpmn2”, ResourceType.BPMN2 ); If ( kbuilder.hasErrors() ) { log.error( kbuilder.hasErrors().toString() ); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages( kbase.getKnowledgePackages() ); Knowledge API
  217. 217. Drools Integration Deployment Descriptors <change-set> <add> <resource source='classpath:myapp/data/myflow.bpmn2' type='BPMN2' /> <resource source='http:myapp/data/myrules.drl' type='DRL' /> <resource source='classpath:data/IntegrationExampleTest. xls ' type=&quot;DTABLE&quot;> <decisiontable- conf input-type=&quot;XLS&quot; worksheet-name=&quot;Tables_2&quot; /> </resource> <add> </change-set> KnowledegBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBulider(); kbuilder.addResource( ResourceFactory.newFileResource( “changeset.xml”, ResourceType.ChangeSet ); Knowledge XML
  218. 218. <drools:kbase id=&quot;kbase1&quot;> <drools:resource type=&quot;DRL&quot; source=&quot;classpath:.../testSpring.drl&quot; /> </drools:kbase> <drools:ksession id=&quot;ksession1&quot; type=&quot; stateless &quot; kbase =&quot;kbase1&quot; /> <drools:ksession id=&quot;ksession2&quot; type=&quot; stateful &quot; kbase =&quot;kbase1&quot;/> <camelContext id=&quot;camel&quot;> <route> <from uri=&quot;cxfrs://bean://rsServer&quot;/> <marshal ref=&quot;xstream&quot;/> <to uri=”drools:ksession1” /> <unmarshal ref=&quot;xstream&quot;/> </route> </camelContext> Declarative Services Spring XML and Camel
  219. 219. Stateful Knowledge Session
  220. 220. Knowledge Runtime
  221. 222. BPMN 2.0 <ul><li>OMG specification </li><ul><li>Model
  222. 223. Notation
  223. 224. Execution semantics </li></ul><li>Understandable by all business users
  224. 225. Process, collaboration, choreography
  225. 226. Extensible </li></ul>
  226. 227. BPMN 2.0 Example < definitions ... > < process id=&quot;com.sample.bpmn.hello&quot; name=&quot;Hello World&quot; > < startEvent id=&quot;_1&quot; name=&quot;StartProcess&quot; /> < sequenceFlow sourceRef=&quot;_1&quot; targetRef=&quot;_2&quot; /> < scriptTask id=&quot;_2&quot; name=&quot;Hello&quot; > < script >System.out.println(&quot;Hello World&quot;);</ script > </ scriptTask > < sequenceFlow sourceRef=&quot;_2&quot; targetRef=&quot;_3&quot; /> < endEvent id=&quot;_3&quot; name=&quot;EndProcess&quot; /> </ process > </ definitions > < definitions ... > < process id=&quot;com.sample.bpmn.hello&quot; name=&quot;Hello World&quot; > < startEvent id=&quot;_1&quot; name=&quot;StartProcess&quot; /> < sequenceFlow sourceRef=&quot;_1&quot; targetRef=&quot;_2&quot; /> < scriptTask id=&quot;_2&quot; name=&quot;Hello&quot; > < script >System.out.println(&quot;Hello World&quot;);</ script > </ scriptTask > < sequenceFlow sourceRef=&quot;_2&quot; targetRef=&quot;_3&quot; /> < endEvent id=&quot;_3&quot; name=&quot;EndProcess&quot; /> </ process > </ definitions >
  227. 228. Persistence and Transactions <ul><li>Persistence (JPA, pluggable) </li><ul><li>Runtime persistence
  228. 229. History logging
  229. 230. Services </li></ul><li>Transactions (JTA, pluggable) </li><ul><li>Command-scoped
  230. 231. User-defined </li></ul></ul>
  231. 232. Domain-specific Processes <ul><li>Extend palette with domain-specific, declarative service nodes </li></ul><ul><ul><li>define input / output parameters
  232. 233. runtime binding </li></ul></ul>
  233. 234. Human task service <ul><li>User task
  234. 235. Human task service (WS-HT) </li></ul><ul><ul><li>Task lists
  235. 236. Task life cycle </li></ul></ul><ul><li>Task clients </li></ul><ul><ul><li>Task forms </li></ul></ul>
  236. 238. Integrated debug and audit
  237. 239. Self monitoring and adaptive declare ProcessStartedEvent @role( event ) end rule &quot;Number of process instances above threshold&quot; when Number( nbProcesses : intValue > 1000 ) from accumulate( e: ProcessStartedEvent( processInstance.processId == &quot;com.sample.order.OrderProcess&quot; ) over window:size(1h), count(e) ) then System.err.println( &quot;WARNING: Nb of order processes in the last hour > 1000: &quot; + nbProcesses ); end
  238. 240. Rules and Process Together
  239. 241. Exceptional Control Flow 90% 5% 3% 2%
  240. 242. Exceptional Control Flow 90% Rule1 When ... Then ... Rule2 When ... Then ... Rule3 When ... Then ... 5% 3% 2%
  241. 243. Example: Clinical DSS
  242. 244. Interception When StockMark status == crash Then Terminate “Buy Request” Process Start “System Shutdown” Process Stock Buy Order Request Buy Order Acknowledgement Buy Order Request Process Payment Confirmation Terminate
  243. 245. Interception and Redirection When Origin != USA and Destination == USA Then Suspend “Flight Booking” Process Start “ESTA” Process OnSuccess Resume “Flight Booking” OnFailure Terminate “Flight Booking” Simple Flight Booking Process Get Destination Get Dates Get Origin Process Payment Confirmation Terminate
  244. 246. Drools flow in Oryx
  245. 247. Drools flow in Eclipse
  246. 248. Questions? Questions? <ul><li>Dave Bowman : All right, HAL; I'll go in through the emergency airlock.
  247. 249. HAL : Without your space helmet, Dave, you're going to find that rather difficult.
  248. 250. Dave Bowman : HAL, I won't argue with you anymore! Open the doors!
  249. 251. 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?

×