Buenos Aires Drools Expert Presentation
Upcoming SlideShare
Loading in...5
×
 

Buenos Aires Drools Expert Presentation

on

  • 2,075 views

Drools Expert presentation at Buenos Aires JUG

Drools Expert presentation at Buenos Aires JUG

Statistics

Views

Total Views
2,075
Views on SlideShare
2,075
Embed Views
0

Actions

Likes
0
Downloads
96
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

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
  • 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

Buenos Aires Drools Expert Presentation Buenos Aires Drools Expert Presentation 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
  • Drools Vs BRMS Repository Rules and Metadata JBoss Enterprise BRMS Platform JBoss Rules Rules Engine/ Execution Rules Development & Management CEP Complex Events Jboss EWP
  • Drools Vs BRMS
    • Stand-alone Framework
    • Innovation
    • Fast and Frequent Releases
    • Tested on developer environments
    • Suitable for development and prototype
    • No Patches – On to next big thing
    • Non SLA bound forum support
    • Fully Integrated Platform
    • Same Innovated Code + Stability
    • Stability – Includes usability, performance and security issues identified during productization
    • Certified for Multi-OS, Multi-DB
    • Best for Development and Production
    • 5 Yr lifecycle – Includes patches, updates, backward compatibility
    • SLA based full support from dedicated support engineers
    • Open Source Assurance – legal protection
    derived
  • 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
  • Evolution of JBoss BRMS 05/08 04/09 12/10 ?
    • Lightweight Business Rules Engine
    • Business Rules Engine
    • Authoring and Management App
    • Repository
    • EAP Certified
    • DBs, JVMs
    • Business Rules Engine
    • Authoring and Management App
    • Choice of Repository
    • Integrated Container
    • CEP – Tech Preview
    • EAP, EWS, EWP, JVMs, Dbs and more
    • Performance
    Repository JBoss Enterprise BRMS Platform 5.0 JBoss Rules BRM Repository JBoss Enterprise BRMS Platform 5.1 JBoss Rules BRM CEP Jboss EWP
  • Back Up
  •  
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • Sample Industries and Users
    • Investment
      • Millennium Investment Group (MIG)
    • Logistics
      • Fedex
    • Airline
      • Sabre
    • Mortgage
      • Franklin American
    • Healthcare
      • OSDE
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • It All Started Here Birth of CDSS 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 (this month)
      • Freeform expressions between patterns
      • Multi-function accumulates
      • Prolog like derivation queries
      • Decision tables and rule templates (Guvnor)
      • Pure GWT (Guvnor)
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • Integrated Systems Semantic Ontologies Rules Event Processes Workflows Rules Workflows Event Processes Semantic Ontologies
  • Integrated Systems
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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”
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • 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() );
  • 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
  • Agenda
    • Product Overview
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • 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
  • $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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • 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
  • 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
  • Agenda
    • Community
    • History
    • Declarative Programming
    • Drools Expert
      • Quick Example Stateless/Stateful
      • Conditional elements
      • Timers and Calendars
      • Truth maintenance and Inference
      • Backward chaining
    • Roadmap
  • Roadmap
    • Drools
    • Improved backward chaining (open queries)
    • Optimistic backward chaining.
    • Business Semantics (ontologies)
    • Simulation Testing
    • High Availability
    • Distributed (Grid) platform
    • Runtime Management
    • BAM
  • 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?