• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
rules, events and workflow
 

rules, events and workflow

on

  • 1,945 views

presentation on rules, events and workflow

presentation on rules, events and workflow

Statistics

Views

Total Views
1,945
Views on SlideShare
1,945
Embed Views
0

Actions

Likes
2
Downloads
165
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    rules, events and workflow rules, events and workflow Presentation Transcript

    • Mark Proctor Project Lead
      • T he SkyNet funding bill is passed.
      • The system goes online on August 4th, 1997.
      • Human decisions are removed from strategic defense.
      • SkyNet begins to learn at a geometric rate.
      • It becomes self-aware at 2:14am Eastern time, August 29th
      • In a panic, they try to pull the plug.
      • And, Skynet fights back
    • Agenda
      • Community
      • History
      • Declarative Programming
      • Drools Expert
      • Drools Fustion
      • jBPM
      • Roadmap
    • Boot Camps
      • San Francisco 2009 (40+ attendees)
        • Sponsored by Third Pillar
        • Sun, FAMC, OSDE, Kaseya, Fedex, TU Group, Intermountain Healthcare, Gap, Sony Pictures, Lockheed Martin, Kaiser, HP, Wells Fargo, US Navy Research, FOLIOfn, Boeing .....
      • San Diego 2010 (80+ attendess)
        • Sponsored by US Navy
        • 5 day event, with 2 days focus on the healthcare industry
        • OSDE, AT&T, SAIC, US Navy Research, Kaiser, Clinica, Intermountain Healthcare, GE Healthcare, VA, Boeing, Nationwide ....
    • Books
      • Introduction to Expert Systems
        • Peter Jackson
      • Expert Systems, Principles and Programming
        • Joseph C. Giarratano and Gary D. Riley
    • Oh And There are Drools Books Too
    • History
    • 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
    • Because Not Everyone Is As Smart As He Is
    • Business Rules Engines 1980s 2010s 1990s 2000s OPS5 ART Clips Jess Drools 2 JRules Drools 3 Drools 4 Drools 5
    • Drools History
      • Drools 2
        • Rete like XML Scripting language
      • Drools 3
        • Based on Clips functionality
        • Iterative improves to JRules syntax with Clips functionality
      • Drools 4
        • More declarative
        • Basic functional programming feature with “from”
        • Basic Rule Flow
        • Basic BRMS
      • Drools 5
        • Improved functional programming with 'accumulate'
        • More Advanced Rule Flow integration
        • Complex Event Process
          • Temporal Comparators
          • Sliding Time Windows
        • Production ready BRMS (Guvnor)
    • Drools History
      • Drools 5.1
        • Differential Diff (true modify)
      • Drools 5.2
        • Freeform expressions between patterns
        • Multi-function accumulates
        • Prolog like derivation queries
        • Decision tables and rule templates (Guvnor)
        • Pure GWT (Guvnor)
      • Drools 5.3
        • ...
    • Declarative Programming
    • Integrated Systems Semantic Ontologies Rules Event Processes Workflows Rules Workflows Event Processes Semantic Ontologies
    • Integrated Systems
    • Rules and processes loosely coupled tightly coupled specific generic Decision Services Process Rules SCOPE COUPLING ?
    • Business Logic Lifecycle
    • Declarative Programming
      • Production Rule Systems PRD (forward chaining)
        • Reactive
        • when Alarm( status == “alert” ) then send( “warning” )
      • Logic Programming LP (backward chaining)
        • Query
        • descendant( “mary”, “jane”)
      • Functional Programming FP
        • Map,Fold, Filter
        • avg([12, 16, 4, 6])
          • Returns single value 9.5
        • round([10.3, 4.7, 7.8] )
          • Returns List [10, 5, 8]
      • Description Logic
        • Person Has Name and LivesAt Address
    • Concepts Overview
    • Concepts Overview
    • Concepts Overview
    • Drools Expert
    • Classes
    • 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
    • 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”
    • 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 { }
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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” ) )
    • 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
    • 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
    • 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
    • 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
    • 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
    • Drools Fusion
    • Drools Fusion: Enables...
      • Event Detection:
        • From an event cloud or set of streams, select all the meaningful events, and only them.
      • [Temporal] Event Correlation:
        • Ability to correlate events and facts declaring both temporal and non-temporal constraints between them.
        • Ability to reason over event aggregation.
      • Event Sequencing:
        • A -> ( B OR C ) -> D
      • Event Abstraction:
        • Ability to compose complex events from atomic events AND reason over them
    • Drools Fusion: Features
      • Support to Event semantics:
        • Usually immutable, but not enforced
        • Strong temporal relationships
        • Managed lifecycle
        • Point-in-time and Interval events
      • Time semantics
        • Discrete
      • Temporal relationships
        • All 13 operators defined by James Allen (+ negations)
    • 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.”
    • CEP vs EDA vs SOA
      • CEP is component of EDA
      • EDA is **not** SOA 2.0
      • Complementary architectures
      • Metaphor
        • In our body :
          • SOA is used to build our muscles and organs
          • EDA is used to build our sensory system
    • $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
    • 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
    • $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”
      • coincides
      • before
      • after
      • meets
      • metby
      • overlaps
      • overlappedby
      • during
      • includes
      • starts
      • startedby
      • finishes
      • finishedby
      Operators The Full set of Operators are supported BackAckEvent must occur between 1s and 10s ' after' BuyOrderEvent
    • Drools Fusion: Temporal Reasoning
    • Drools Fusion: Temporal Reasoning
    • $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
    • 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
    • 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
    • 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
    • CEP Applied at FedEx Custom Critical
      • Time specific deliveries for critical freight
      • Exclusive use non-stop door-to-door services
      • Blended Surface and Air services to minimize cost and transit time
      • Extra care in handling and specially equipped vehicles
        • Temperature Control, Secured Services, Hazardous Material, Constant Surveillance
      * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
    • CEP Applied at FedEx Custom Critical * Presented by Adam Mollemkopf at ORF 2009
      • At least 50% of Alerts can be reasoned automatically, promoting staff savings and improved Customer and Driver experiences.
      • Risk Avoidance via pro-active monitoring
        • Reduction in insurance claims and shipment service failures
      • Minimum 30% efficiency gains in shipment monitoring , saving at least 15% of Operations staff cost.
    • CEP Applied at FedEx Custom Critical
      • Some numbers (from early 2010):
        • 24 x 7 sessions, no downtime
        • Average of 500k+ facts/events concurrently in memory
          • Business hours: 1M+ facts/events concurrently
        • Response time for reasoning cycles:
          • Average: 150 ms
          • Peak: 1.2 sec
        • Several hundred rules
    • 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?
    • TMS and Inference
      • Bad
        • Monolithic
        • Leaky
        • Brittle integrity - manual maintenance
    • TMS and Inference
      • A rule “logically” inserts an object
      • When the rule is no longer true, the object is retracted.
      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
    • 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
    • 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
    • TMS and Inference
      • Good
        • De-couple knowledge responsibilities
        • Encapsulate knowledge
        • Provide semantic abstractions for those encapsulation
        • Integrity robustness – truth maintenance
    • Some decisions are complex What insurance premium should I charge?
    • Some decisions are complex
      • Business considerations
        • Applicant's age
        • Applicant's experience
        • Sailing qualifications
        • Value of vessel
        • Type of cover
    • Some decisions are complex
      • Business considerations
        • Applicant's age
          • Only insure people over 25 years of age
          • If less than 35 add 10% surcharge
          • If less than 45 add 5% surcharge
    • Some decisions are complex
      • Business considerations
        • Applicant's experience
          • If sailing < 5 years then charge +10%
        • Sailing qualifications
          • None charge +100%
      • Etc...
    • Enter the decision table
      • Extract of decision table
    • Decision Table
    • 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
    • Decision Tables in Guvnor
      • Generation of DRL
      • Each row compiles into a separate DRL rule
    • Types
        Types
        • Layout
              • Horizontal
              • Vertical
              • Limited entry
              • Extended entry
        • Categorisation
              • Expanded form, contracted form
              • Multi-hit, all hits
              • Multi-hit, first hit
              • Single hit
    • Layouts
        Horizontal
    • Layouts
        Vertical
    • Layouts
        Limited entry
    • Layouts
        Extended entry
    • Categorisation
        Expanded form
      • Single column for every condition combination
      • The number of columns should equal the product of the number of states for every condition.
        • e.g. 2 conditions, one with 3 states the other 4 (see above):
      3 * 4 = 12 combinations
        • e.g. 2 conditions each with 3 states and 1 condition with 4 states gives:
      3 * 3 * 4 = 36 combinations
    • Categorisation
        Expanded form (continued)
      • Condition states should be digitised
        • e.g. age: <18, 18-35, 36-60, >60 not a free-form integer field
      • Condition states should be continuous
        • e.g. GOOD: age<18, age>=18; BAD: age<18, age>=30
        • Not essential for expansion but ensures completeness
      • This guarantee of completeness of condition combinations is one of the main advantages of decision tables.
    • Categorisation
        Expanded form (continued)
    • Categorisation
        Contracted form
      • Contraction is the first optimisation.
      • Reduces the number of condition columns.
      • Removes impossible combinations
      • 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.
    • Categorisation
        Contracted form – stage 1 Rules 2 and 3 are impossible conditions
    • Categorisation
        Contracted form – stage 2 Merge adjacent column groups with identical action parts
    • Categorisation
        Multi-hit, all hits
      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
    • Categorisation
        Multi-hit, first hit
      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
    • Categorisation
        Single hit
      Given a 35 year old with 15 years service 1. Rule 3 matches, giving 25 days 2. No other rules match
    • Agenda
      • Community
      • History
      • Declarative Programming
      • Drools Expert
        • Quick Example Stateless/Stateful
        • Conditional elements
        • Timers and Calendars
        • Truth maintenance and Inference
        • Backward chaining
      • Decision Tables
        • Decisions and Decision Tables
        • Types
        • Validation and Verification
        • Transformation
        • Decision tables in guvnor
      • Roadmap
    • Validation & Verification
      • Redundancy
      • Ambivalence (conflicting)
      • Deficiency
      • Mitigation
    • Validation & Verification
      • Redundancy - Subsumption
    • Validation & Verification
      • Deficiency
        • Premium is £500 if applicant age is less than 30
        • Premium is £300 if Years Without Claim is greater than or equal to 10 years.
        • Applicant is 29, premium is £500
        • Applicant has 12 years without claim, premium is £300
        • Applicant is 29 with 12 years without claim, premium is ?!?
    • Transformation
      • Example - Decision Table
    • Transformation
      • Example - Decision Tree
    • Transformation
      • Paying attention?
      • Rules 1, 2 and 3, 4 have the same action no matter what the state of “Hunger”. Therefore they can be contracted...
    • Decision Tables in Guvnor
      • What do we currently provide?
      • Vertical layout
      • Generalised categorisation
        • Multi-hit, all hit; Multi-hit first hit; Single hit
      • Extended entry
      • Digitised condition states (enumerated fields)
      • New decision table editor
        • Foundation for future work
        • Condition and rule negation
        • Cell merging
        • Cell grouping
    • Decision Tables in Guvnor
      • What do we currently provide?
        Cell merging
    • Decision Tables in Guvnor
      • What do we currently provide?
        Cell grouping
    • jBPM
    • Key Characteristics of jBPM5
      • Open-source business process management project offering:
        • generic process engine supporting native BPMN 2.0 execution
        • targeting developers and business users
        • collaboration, management and monitoring using web-based consoles
        • powerful rules and event integration
    • From Workflow to BPM
      • Core engine is a workflow engine in pure Java
        • state transitions
        • lightweight
        • embeddable
        • generic, extensible
      Core Engine
    • Java Interface ProcessRuntime interface
      • startProcess(processId)
      • startProcess(processId, parameters)
      • signalEvent(type, event)
      • signalEvent(type, event, instanceId)
      • abortProcessInstance(instanceId)
      • getProcessInstance(instanceId)
    • 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
    • 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
    • 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
    • <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
    • Stateful Knowledge Session
    • Knowledge Runtime
    •  
    • BPMN 2.0
      • OMG specification
        • Model
        • Notation
        • Execution semantics
      • Understandable by all business users
      • Process, collaboration, choreography
      • Extensible
    • 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 >
    • Persistence and Transactions
      • Persistence (JPA, pluggable)
        • Runtime persistence
        • History logging
        • Services
      • Transactions (JTA, pluggable)
        • Command-scoped
        • User-defined
    • Domain-specific Processes
      • Extend palette with domain-specific, declarative service nodes
        • define input / output parameters
        • runtime binding
    • Human task service
      • User task
      • Human task service (WS-HT)
        • Task lists
        • Task life cycle
      • Task clients
        • Task forms
    •  
    • Integrated debug and audit
    • 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
    • Rules and Process Together
    • Exceptional Control Flow 90% 5% 3% 2%
    • Exceptional Control Flow 90% Rule1 When ... Then ... Rule2 When ... Then ... Rule3 When ... Then ... 5% 3% 2%
    • Example: Clinical DSS
    • 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
    • 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
    • Drools flow in Oryx
    • Drools flow in Eclipse
    • Questions? Questions?
      • Dave Bowman : All right, HAL; I'll go in through the emergency airlock.
      • HAL : Without your space helmet, Dave, you're going to find that rather difficult.
      • Dave Bowman : HAL, I won't argue with you anymore! Open the doors!
      • HAL : Dave, this conversation can serve no purpose anymore. Goodbye.
      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?