JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system...

78
The 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 Business Logic Platform Declarative Behavioural Modelling JBoss Drools – Viva Le Drools Mark Proctor Project Lead

Transcript of JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system...

Page 1: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

●The 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

Bus iness Logic PlatformDeclarative Behavioural Modelling

JBoss Drools – Viva Le Drools

Mark Proctor Project Lead

Page 2: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

2

Agenda Introduction Rules Quick Drool Overview Processes Complex Event Processing Community Projects Road Map

Page 3: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Introduction

Page 4: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

4

http://labs .jboss .com/drools

Page 5: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

5

http://blog.athico.com

Page 6: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Rules

Page 7: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

7

Date datedouble amountint typelong accountNo

Cashflow

long accountNodouble balance

Account

Date startDate end

AccountingPeriod

Classes

Page 8: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

8

date amount type12-Jan-07 100 CREDIT 12-Feb-07 200 DEBIT 118-May-07 50 CREDIT 19-Mar-07 75 CREDIT 1

accountNo

AccountaccountNo balance

1 0

increase balance for AccountPeriod Credits

select * from Account acc, Cashflow cf, AccountPeriod apwhere acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end

decrease balance for AccountPeriod Debits

select * from Account acc, Cashflow cf, AccountPeriod apwhere acc.accountNo == cf.accountNo and cf.type == DEBIT cf.date >= ap.start and cf.date <= ap.end

AccountingPeriodstart end

01-Jan-07 31-Mar-07

CashFlowdate amount type

12-Jan-07 100 CREDIT18-May-07 50 CREDIT

date amount type2-Feb-07 200 DEBIT

CashFlow

trigger : acc.balance += cf.amount trigger : acc.balance -= cf.amount

Accountbalance

1 -50accountNo

Creating Views with Triggers

Page 9: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

9

date amount type12-Jan-07 100 CREDIT 12-Feb-07 200 DEBIT 118-May-07 50 CREDIT 19-Mar-07 75 CREDIT 1

accountNo

AccountaccountNo balance

1 0increase balance for AccountPeriod Credits decrease balance for AccountPeriod Debits

start end01-Apr-07 30-Jun-07

AccountingPeriod

date amount type2-Feb-07 200 CREDIT

CashFlow

date amount typeCashFlow

Accountbalance

1 150accountNo

select * from Account acc, Cashflow cf, AccountPeriod apwhere acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end

select * from Account acc, Cashflow cf, AccountPeriod apwhere acc.accountNo == cf.accountNo and cf.type == DEBIT cf.date >= ap.start and cf.date <= ap.end

trigger : acc.balance += cf.amount trigger : acc.balance -= cf.amount

Creating Views with Triggers

Page 10: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

10

What is a Rule

• rule “<name>” <attribute> <value> when <LHS> then <RHS>end

Quotes on Rule names are optional if the rule name has no spaces.

salience <int>agenda-group <string>no-loop <boolean>auto-focus <boolean>duration <long>

RHS can be any valid java. Future versions will support other languages, i.e Groovy

Page 11: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

11

What is a Rule

• public void helloMark(Person person) { if ( person.getName().equals( “mark” ) { System.out.println( “Hello Mark” ); }}

• rule “Hello Mark” when Person( name == “mark” ) then System.out.println( “Hello Mark” );end

LHS

RHS

specific passing of instances

Methods that must be called directly

Rules can never be called directly

Specific instances cannot be passed.

Page 12: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

12

Shower( temperature == “hot” )

Pattern

Field Constraint

Restriction

Evaluator Value

Object Type

Field Name

What is a Pattern

Page 13: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

13

Anatomy of a Pattern

Page 14: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

14

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 apwhere acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end

trigger : acc.balance += cf.amountPattern

Pattern Binding

field Binding

Literal Restriction

Variable Restriction

Multri Restriction - Variable Restriction

field BindingConsequence (RHS)

Our Firs t Rule

Page 15: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

15

date amount type accountNo12-Jan-07 100 CREDIT 12-Feb-07 200 DEBIT 118-May-07 50 CREDIT 19-Mar-07 75 CREDIT 1 Account

accountNo balance1 0

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

AccountingPeriodstart end

01-Jan-07 31-Mar-07

CashFlowdate amount type

12-Jan-07 100 CREDIT18-May-07 50 CREDIT

CashFlowdate amount type

2-Feb-07 200 DEBIT

AccountaccountNo balance

1 -50

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”

Page 16: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

16

date amount type accountNo12-Jan-07 100 CREDIT 12-Feb-07 200 DEBIT 118-May-07 50 CREDIT 19-Mar-07 75 CREDIT 1 Account

accountNo balance1 0

AccountingPeriodstart end

01-Apr-07 30-Jun-07

CashFlowdate amount type

2-Feb-07 200 CREDIT

CashFlowdate amount type

AccountaccountNo balance

1 150

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”

Page 17: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

17

What is a Production Rule S ystem

ProductionMemory

WorkingMemory

Inference Engine

Pattern Matcher

Agenda(rules) (facts)

insertupdateretract

Repository of asserted Java instances

Codification of the business knowledge

Page 18: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

18

Account AccountingPeriod Cashflow

view1 view2

main view

Tables

Views

ViewAccount AccountingPeriod Cashflow

rule1 rule2

agenda

Object Types

Rules

agenda

Production Rule S ystemApproximated by S QL and Views

Page 19: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

19

rule “Print blance for AccountPeriod” salience -50 when ap : AccountPeriod() acc : Account( ) then System.out.println( acc.accountNo + “ : “ acc.balance ); end

Salience

Agenda1 increase balance

arbitrary2 decrease balance3 increase balance4 print balance

Conflict Resolution with S alience

Page 20: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

20

rule “increase balance for AccountPeriod Credits” ruleflow-group “calculation” 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 “Print blance for AccountPeriod” ruleflow-group “report” when ap : AccountPeriod() acc : Account( ) then System.out.println( acc.accountNo + “ : “ acc.balance ); end

ruleflow-group

RuleFlow

Page 21: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

21

rule “increase balance for AccountPeriod Credits” when ap : AccountingPeriod( ) not AccountingPeriod( start < ap.start) acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && <= ap.end, $ammount : ammount ) then acc.balance += $amount; end

not

Using 'not' exis tentialnot Bus( color == “red” )

'not', 'exis ts ', 'forall'

Page 22: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

22

rule "Test 01 - Credit Cashflow" salience 100

when UpdatingAccount( $account : account ) CurrentAccountingPeriod( $start : start, $end : end ) Number( $sum : doubleValue ) from accumulate( $c : Cashflow( type==Cashflow.CREDIT,

account == $account, date >= $start && <= $end, $amount : amount )

sum( $c.getAmount() ) ) then System.out.println( "CREDIT : " + $end + " : " + $sum ); $account.balance += $sum);

end

from accumulate

Using 'accumulate' exis tential

'from', 'collect', 'accumulate'

Page 23: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

23

Package

package com.sample

import java.util.Map

import com.sample.Cheese

global Cheese cheese

function void exampleFunction(Cheese cheese) {System.out.println( cheese );

}

rule “A Cheesy Rule”

when

….

then ….

end

Namespace for all package members

Imports can be used in functions and rules. Uses valid java import syntax

Page 24: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

24

Two Phase S ystem

Working Memory Action

retract

modifyinsert

Agenda Evaluation

Select Rule to Fire

exit

No RuleFound

Fire Rule

Determine possible rules to

fire

RuleFound

Page 25: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Quick Drools Overview

Page 26: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

26

Features Engine

● Full Rete Implementation -- with high performance indexing● Dynamic RuleBases● S tateful and S tateless Execution Modes● Async operations● Rete and S equential Rete● Rule Agent● Optional Data S hadowing● Pluggeable Dialects

Propositional Logic● Literal Restriction● Variable Restriction● Return Value Restriction● Jointed and dis-jointed Connectives allowed - '&&' '||'● inline-Eval

Page 27: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

27

Features First Order Logic (Quantifiers)

● And● Or● Exists● Not● Accumulate● Collect● From● Forall● Nesting of any CE inside of 'and' and 'or'● S upport for both infix and prefix 'and'/'or' CEs● Nesting and Chaining of 'from', 'accumulate', 'collect'

Page 28: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

28

Features Execution Control

● Conflict Resolution (salience) Now pluggeable● Agenda Filters● Agenda Groups● Activation Groups● Rule Flow● Attributes ( no-loop, lock-on-active )

Temporal Rules● S cheduler for rule duration will fire when a rule is true for X

duration Truth maintenance

● Logical Insertions Event Model

● Working Memory, Agenda, Rule Flow and Rule Base

Page 29: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

29

Eclipse IDE

Page 30: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

30

Eclipse IDE

Page 31: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

31

Eclipse IDE

Page 32: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

32

Eclipse IDE

Page 33: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

33

Guided Editor (Eclipse)

Page 34: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

34

DS Ls (Eclipse)

Page 35: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

35

DS Ls (Eclipse)

Page 36: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

36

Decis ionTables (Excel/OpenOffice)

Page 37: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

37

BRMS

Page 38: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

38

BRMS

Page 39: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

39

BRMS

Page 40: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

40

BRMS

Page 41: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

41

BRMS UI Improvements

Page 42: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Processes

Page 43: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

43

Rule Flow Unifies Rules and Processes in a single engine

● Rules (LHS When) and expressions can be used in splits, milestones etc

● creates a much richer model● Rules and Processes see, reason and react and process the

same data● Do not have send messages between two different engines

● Multiple instances, of different processes, can be executing at the same time in a single engine.

● Processes and Rules interactive with each other.● A Process or Rule can change data, which can impact how

another rule or process is executing.● Integrated Tooling and APIs

● S ingle api for execution● Audit logging and visual Audit tools● S ingle server side tooling for storage, configuration and

management and deployment

Page 44: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

44

Architectural Overview

Pluggeable NodesPluggeable Work ItemsSemantic Module Framework

Pluggable XML representations for DSLs

Page 45: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

45

Rules and Process Overlap Process can work independent of rules Rules (including cep) can work independent of processes process can control rule execution

● ruleflow-groups rules (including cep) can control processes

● S plits● Event wait states (listeners)

● start node● Timers

Page 46: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

46

Ruleflow features

Rule set nodes

Control flow● S equence● Parallelism (split / join)● Choice

Nodes● Actions● Milestone (= state)● S ubflows● Looping

Page 47: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

47

Rule Flow – Process Diagram

Page 48: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

48

Rule Flow – Rules and Processes

Page 49: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

49

S plit Constraint

Page 50: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

50

Rule Flow – S plit Constraint Editor

Page 51: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

51

Different Dialect Actions

Page 52: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

52

WorkItem With Custom Editor

Page 53: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

53

Work Item With Properties Editor

Page 54: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

54

Work Item Definition

Page 55: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

55

ePDL<process xmlns="http://drools.org/drools-4.0/process" xmlns:mydsl="http://domain/org/mydsl"

xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"

name="process name" id="process name" package-name="org.domain" > <nodes>

<start name="start node" /> <action name="action node" dialect="java"> list.add( "action node was here" ); </action> <mydsl:logger name="test logger" type="warn"> This is my message <mydsl:logger> <end name="end node" />

</nodes> <connections> <connection from="start node" to="action node" /> <connection from="action node" to="test logger" /> <connection from="test logger" to="end node" /> </connections> </process>

Page 56: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

56

ePDL S emantic Module HandlerS emanticModule module = new DefaultS emanticModule( "http://domain/org/mydsl" );

module.addHandler( "logger", new LoggerHandler() );

Page 57: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

57

ePDL Handler s tart implpublic Object start(S tring uri, S tring localName,

Attributes attrs,

ExtensibleXmlParser xmlPackageReader) throws S AXException {

xmlPackageReader.startConfiguration( localName, attrs );

RuleFlowProcessImpl process = ( RuleFlowProcessImpl) xmlPackageReader.getParent();

ActionNodeImpl actionNode = new ActionNodeImpl();

actionNode.setName( attrs.getValue( "name" ) );

process.addNode( actionNode );

((ProcessBuildData)xmlPackageReader.getData()).addNode( actionNode );

return actionNode;

}

Starts Building DOM fragment

Page 58: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

58

ePDL Handler end implpublic Object end(S tring uri, S tring localName,

ExtensibleXmlParser xmlPackageReader) throws S AXException {

Configuration config = xmlPackageReader.endConfiguration();

RuleFlowProcessImpl process = ( RuleFlowProcessImpl ) xmlPackageReader.getParent();

ActionNodeImpl actionNode = ( ActionNodeImpl ) xmlPackageReader.getCurrent();

actionNode.setAction( "logger.Warn(" + config.getText() + ")") );

return actionNode;

}

end and return DOM fragment

Page 59: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

59

Unified auditing

Page 60: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

60

Rule Flow – Unified BRMS

Page 61: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Complex Event Processing

Page 62: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

62

CEP Reason over time windows (ES P)

● fixed, time, count and relative● sum, average, max, min

● absence of events● remove duplicate events

Reason over time differences on facts (CEP)● detect invalid ordering of events● detect specific sequence of events● correlate out-of-order events

Page 63: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

63

Temporal Reasoning (ES P/CEP) Clock Abstractions

● S ystem Clock: a clock that periodically synchronizes with the machine clock.

● Event based clock: a clock that is updated every time a given event arrives

● Pseudo Clock: a generic implementation that is arbitrarily updated by application code

● Event Attribute Clock: a clock that is updated by a configured event attribute

Page 64: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

64

Temporal Reasoning (CEP/ES P)

Reasoning over absolute time windows● This is the common case of reasoning over a slide time-window

and/or aggregation of values: "when the average transaction throughput calculated over 1 minute goes bellow the threshold, raise the alarm"

rule "absolute time window"when $throughput : Number( doubleValue < threshold ) from accumulate( Throughput( [time:win:(30days)] $current : current ), average( $current ) )then // raise the alarmend

Page 65: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

65

Temporal Reasoning (CEP/ES P)

S upport separate time-windows per CE:rule "absolute time window per CE "whenS tock( $id : id )Number( $monthAvg : doubleValue) from accumulate( DayCloseS tockPrice( [time:win:(30days)] id == $id, $value : value ), average( $value ) )Number( intValue >= 3 ) from accumulate( $o : S ellOrder( [time:win:(30secs), distinct] completed == true,

id == $id, value < $monthAvg ) count( $o ) )

Page 66: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

66

Temporal Reasoning (CEP/ES P)

Reasoning over relative time windows● this is a powerful feature of reasoning over variable time-

windows defined in relation to other patterns. S ecurity example: "since a user logs in, until the user logs off, when there is any privileged action for this user, allow it and log it to the audit log"

rule "relative time window"when $evt : Event( user == $user, privileged == true ) since LogInEvent( $user : user ) until LogOffEvent( user == $user )then // log event // allow actionend

Page 67: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

67

Temporal Reasoning (CEP/ES P) Events have implicit time attributes and it must be possible to

constraint events on its time attributes, using operators "after", "before", "between":

rule "time constraints between events"when $order : S tockBuyOrder( $id : id ) S tockBuyConfirmation( relatedEvent == id, this after [0,10] $order)then // buy order confirmedend

Page 68: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

68

Temporal Reasoning (CEP/ES P) S upport to reason over the absence of events: rule "absence of events"when $temp : TemperatureReading( celciusGrade > $threshold ) not S plinkerActivation( this after [0, 10] $temp )then // raise the alarmend

Page 69: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Community Projects

Page 70: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

70

Uncertainty S ystems Uncertainty S ystems to express truth degrees and reason

over partial data - Davide S ottara (dsottara@ deis.unibo.it)

Forms of Uncertainty(measures)

Proability

Frequentist Subjecttve(bayesian)

Belief / Plausability

Approaches

Basic MassAssignment Functions

Given for Single Event Given for Set of Events

Belief FunctionsPlausability Functions

Possibility / NecessityFuzzy Sets

Aggregator(sum)

Page 71: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

71

Uncertainty S ystems Traditional Pattern

● S hower( temperature == “hot” )

Pattern with uncertainty evaluator● S hower( temperature == ~“hot” )

Pattern with uncertainty evaluator and parameters● S hower( temperature == ~(10, $x, 15, $y) “hot” )

Shower( temperature == “hot” )

Pattern

Field Constraint

Restriction

Evaluator Value

Object Type

Field Name

Page 72: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

72

Planning problems

S olves planning problems, such as:

Employee shift rostering

Freight routing

S upply sorting

Lesson scheduling

Exam scheduling

The traveling salesmen problem

The traveling tournament problem

Page 73: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

73

The n queens example

Place n queens that cannot attach each other on a n*n chessboard

One of the examples of drools-solver

Implementation explained in detail in the reference manual

Page 74: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

74

Different seach algorithms

S upports several search algorithms:

S imple local search

Tabu search

S imulated annealing

You can easily switch the search algorithm, by simply changing the configuration.

Page 75: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

Road Map

Page 76: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

76

Road Map Engine

● S tateful High Availability Event S tream Processing, Complex Event Processing

● time windows (fixed, length, s ince, until)● date comparisons between objects (before, same, after)

RuleFlow will handle full Process definitions● Persistence● Timers● Dialect support● better rule/code usage● More complex workflow patterns● Pluggable Nodes● Pluggable XML● Pluggable WorkItems

Page 77: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

77

Road Map Rule Analysis

● Verification● Impact Analysis

BRMS● UI improvements● ACL S ecurity● S cenario Testing● Decision Tables

Agent based computing Drools S olver Uncertainty

● Bayesian Network subsystems Decision Trees S BVR

Page 78: JBoss Drools – Viva Le Drools Business Logic PlatformThe SkyNet funding bill is passed. The system goes online on August 4th, 1997. Human decisions are removed from strategic defense.

78

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?