Drools5 Community Training Module#1: Drools5 BLiP Introduction

39
Drools5 Community Training Sponsored by Plugtree

Transcript of Drools5 Community Training Module#1: Drools5 BLiP Introduction

  

Drools5 Community Training Sponsored by Plugtree

Module 1: Drools BLiP Theoretical Introduction

Drools5 Community Trainingversion: 1.0-SNAPSHOT

Release Date: 03/16/2011Under The Creative Common License

Module 1: Drools BLiP Theoretical IntroductionDrools5 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/.

Overview

Theoretical BackgroundDrools Business Logic Integration Platform Introduction

Drools ExpertjBPM5 / Drools FlowDrools FusionDrools Guvnor

Theoretical Background

Artificial Intelligence Expert SystemsKnowledge Engineering Inference EnginesRules Based Production Systems

Drools History

Artificial Intelligence (AI)

"The study and design of intelligent agents."

An intelligent agent is a system that perceives its environment and takes actions which maximize its chances of success. The ability of a machine to perform tasks that require human intelligence.

Expert Systems

"An expert system is software that attempts to provide an answer to a problem where normally one or more human experts would be consulted."

In the begining was replace and now it's assist Software that knows about a specific domainIt can solve/answer specific questions

Expert Systems

Common 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 of observing human experts to build models of their expertise that they can validate.

Inference Engines

"An inference engine is a computer program that tries to derive answers from a knowledge base. It is the "brain" that expert systems use to reason to formulate new conclusions for a certain situation."

Inference Engines

An inference engine will be in charge of using the formalized knowledge from our expert to answer questions for a specific situation.

Production Systems

A production system (or production rule system) are software that are composed of a set of rules about behavior.

These rules are a simple and basic representation of knowledge.

A production system provides the mechanism to execute actions (behavior) in order to achieve some goal for the system.

Rule

If / When / Where / On Conditions

Then / Do Actions

Chaining Strategies

Methods of Reasoning in Inference Engines

Backward Chaining: goal-driven -> Prolog

Forward Chaining: data-driven -> Drools

Chaining Strategies Example

Scenario: 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"

Backward Chaining

Forward Chaining

Full Picture

Some characteristics

Output answers will contain the justificationThese kinds of systems are created to support large amounts of knowledge to solve complex situationsThe knowledge can be:

Expressed by Domain Specific usersReused Iteratively improvedMaintained decoupled from your application code

Drools History

The project was born in '03 Mark 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 high performance

Drools 5 BLiP

Named 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, Grid etc.) that will be not covered here.

Drools Expert

The core of Drools Contains the inference engine Uses the RETE algorithm for pattern matchingProvides us with a way to create a knowledge baseProvides us with a simple API to interact with the inference engine

Business Rule Structure

rule "My Rule" <attributes> when <LHS> Person(name == "John") <CEs> then <RHS> System.out.println("Hi John!"); <Actions>end

Drools Expert

Common use cases: + Validations + Decision Making + Scoring + Games

jBPM5

Focused on BPMImplements the main stages of the discipline:

Model/DesignExecuteMonitor

Pretty close to finish BPMN2 implementationUses the same APIs that we use in Drools ExpertFully integrated with the inference engine

Business Process

Definition: "A sequence of activities, performed by humans or systems to

complete a business goal."

Business Process Example

New Bank Account process:

Business Process Management

Iterative/continuous DisciplineFour main stages:

Discover Design / ModelExecutionMonitoring / Improvements / Optimizations

jBPM5

Common use casesIn every company Business Processes are used implicitly or explicitlyIn every business activityIn every non-business situation that defines a logical set of activities that needs to be executed/performed

Drools Fusion

Focused in Complex Event ProcessingTemporal reasoning13 temporal operators (before, after, during, and so on)Enables us to detect complex events (event correlation patterns)

Drools Fusion

Big Picture

Drools Fusion

Temporal Operators Table

Drools Fusion

Common use cases:Fraud DetectionStock Trading Hardware monitoringTransport and LogisticsEverywhere we need to correlate or aggregate events

Drools Guvnor

Commonly tagged as a BRMS Centralized Knowledge Repository (JCR)Handles the Knowledge versioning and categorizationNow it includes more User Friendly features like:

Guided Rules AuthoringTest Cases CreationRule Constraints Meta-ModelRule Validation and VerificationBusiness Process Modeling

Drools Guvnor

Guided Editor:

Briefing Up

Covered Topics:Conceptual background of Drools ProjectDrools Main Modules Introduction

  

Questions?

Enjoy! Questions and Feedback are always appreciated!Stay Tuned!

  

Contact us atwww.plugtree.com