Drools5 Community Training Sponsored by Plugtree
Module 1: Drools BLiPTheoretical Introduction Drools5 Community Training version: 1.0-SNAPSHOT Release Date: 03/16/2011Under The Creative Common License
Module 1: Drools BLiPTheoretical Introduction Drools5 Community Training Course by Mauricio "Salaboy" Salatino and Esteban Aliverti is licensed under a Creative Commons Attribution 3.0 Unported License.Based on a work at salaboy.wordpress. com. Permissions beyond the scope of this license may be available at http: //salaboy.wordpress.com/.
Theoretical BackgroundArtificial Intelligence Expert Systems Knowledge Engineering Inference Engines Rules Based Production SystemsDrools History
Artificial Intelligence (AI) "The study and design of intelligent agents."An intelligent agent is a system that perceives its environmentand takes actions which maximize its chances of success.The ability of a machine to perform tasks that require humanintelligence.
Expert Systems"An expert system is software that attempts to provide ananswer to a problem where normally one or more humanexperts would be consulted." In the begining was replace and now its assist Software that knows about a specific domain It can solve/answer specific questions
Expert SystemsCommon Uses of Expert Systems+ Medicine -> Diagnosis based on patient symptoms+ Field Analysis -> Evaluation of geographical regions (Petrol Prospecting)+ Mortgages and Loans -> Used for risk evaluation (scoring)
Knowledge Engineering"Knowledge engineering" is the art and science ofobserving human experts to build models of their expertise thatthey can validate.
Inference Engines"An inference engine is a computer program that tries toderive answers from a knowledge base. It is the "brain" thatexpert systems use to reason to formulate new conclusions for acertain situation."
Inference EnginesAn inference engine will be in charge of using the formalizedknowledge from our expert to answer questions for a specificsituation.
Production SystemsA production system (or production rule system) aresoftware that are composed of a set of rules about behavior.These rules are a simple and basic representation ofknowledge.A production system provides the mechanism to executeactions (behavior) in order to achieve some goal for the system.
RuleIf / When / Where / On ConditionsThen / Do Actions
Chaining StrategiesMethods of Reasoning in Inference Engines Backward Chaining: goal-driven -> Prolog Forward Chaining: data-driven -> Drools
Chaining Strategies ExampleScenario:Pet (name == "Fritz", behavior =="croaks")Question: What is the color of my Pet?Rules / Knowledge:1) When Pet(behavior == "croaks") Then Pet.type = "Frog"2) When Pet(behavior == "sings") Then Pet.type = "Canary"3) When Pet(type == "Frog") Then Pet.color = "green"4) When Pet(type == "Canary") Then Pet.color = "yellow"
Some characteristicsOutput answers will contain the justificationThese kinds of systems are created to support large amountsof knowledge to solve complex situationsThe knowledge can be: Expressed by Domain Specific users Reused Iteratively improved Maintained decoupled from your application code
Drools HistoryThe project was born in 03Mark Proctor in the project leaderBorn as an Inference EngineIt started using the LEAPS algorithm for pattern matchingIn Drools 3.x they implemented RETE algorithmIn Drools 4.x the RETE algorithm was tuned for highperformance
Drools 5 BLiPNamed as Business Logic integration Platform (BLiP)Modules: Drools Expert (leader Mark Proctor) jBPM5 / Drools Flow (leader Kris Verlaenen) Drools Fusion (leader Edson Tirelli) Drools Guvnor (leader Toni Rikkola)* There are other experimental modules (Planner, Chance, Gridetc.) that will be not covered here.
Drools ExpertThe core of DroolsContains the inference engineUses the RETE algorithm for pattern matchingProvides us with a way to create a knowledge baseProvides us with a simple API to interact with the inferenceengine
Business Rule Structurerule "My Rule" <attributes> when <LHS> Person(name == "John") <CEs> then <RHS> System.out.println("Hi John!"); <Actions>end
Drools ExpertCommon use cases:+ Validations+ Decision Making+ Scoring+ Games
jBPM5Focused on BPMImplements the main stages of the discipline: Model/Design Execute MonitorPretty close to finish BPMN2 implementationUses the same APIs that we use in Drools ExpertFully integrated with the inference engine
Business ProcessDefinition:"A sequence of activities, performed by humans or systems to complete a business goal."
Business Process ExampleNew Bank Account process:
Business Process ManagementIterative/continuous DisciplineFour main stages: Discover Design / Model Execution Monitoring / Improvements / Optimizations
jBPM5Common use cases In every company Business Processes are used implicitly or explicitly In every business activity In every non-business situation that defines a logical set of activities that needs to be executed/performed
Drools FusionFocused in Complex Event ProcessingTemporal reasoning13 temporal operators (before, after, during, and so on)Enables us to detect complex events (event correlationpatterns)
Drools FusionCommon use cases: Fraud Detection Stock Trading Hardware monitoring Transport and Logistics Everywhere we need to correlate or aggregate events
Drools GuvnorCommonly tagged as a BRMSCentralized Knowledge Repository (JCR)Handles the Knowledge versioning and categorizationNow it includes more User Friendly features like: Guided Rules Authoring Test Cases Creation Rule Constraints Meta-Model Rule Validation and Verification Business Process Modeling