panel streams vs rules vs subscriptions system …jacobsen/canoe/ss09/panel on rules...streams vs...

20
PANEL Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent TIBCO Software Inc.

Upload: others

Post on 15-Apr-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

PANELStreams vs Rules vs Subscriptions: System and Language Issues

The Case for Rules

Paul VincentTIBCO Software Inc.

Page 2: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rules, rules, everywhere

Data aquisition

Data processing

� Data relationships

� Data constraints

� Business calculations

© 2008 TIBCO Software Inc. All Rights Reserved. 2

Workflow

Business logic

� Process exceptions

� Business decisions

� Compliance regulations

� Etc etc

Page 3: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

C/EP, a “technology”

© 2008 TIBCO Software Inc. All Rights Reserved. 3

Page 4: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

C/EP = various technology components

Relationship rules

State transition rules

© 2008 TIBCO Software Inc. All Rights Reserved. 4

rules

Pattern matching rules

Reaction / decision rules

Page 5: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule =

� <conditions> ���� result

� Logic: <conditions> ���� inferred fact

� Constraint: <conditions> ���� constraint satisfaction fact

� Data relationship: <ownership> ���� relationship fact

© 2008 TIBCO Software Inc. All Rights Reserved. 5

� Production: <conditions> ���� action

� ECA: <event conditions><conditions> ���� action

� State model: <state><event><conditions> ���� new state

� Query: <conditions> ���� resultset

� “CEP”: <event><state><conditions> ���� new state

Page 6: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rules are across IT Solutions

CEP

Services

BPM

Workflow

Services

Rules fordata validation,

data constraints

User

Interface

Services

Rules about events

and deducing information and

Rules representing

flow decisions,process

exceptions,

declarative

SOA

Services

Rules representing

message

switching,

TIBCO infrastructure

BAM

Services

Rules checkingbusinessactivities,

MDM

Services

Rules for

Master

Data

© 2008 TIBCO Software Inc. All Rights Reserved. 6

Enterprise Service Bus

data constraints information and

consequences

declarativeprocesses,decisionservices

switching,data transforms

Business

LogicCustom Java etc

activities,and relatedresponses

DataManagement

transformations

Rules representing business decisions

Page 7: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule types: per RuleML as used in CEP

DerivationRule ReactionRuleIntegrityRule ProductionRule TransformationRule

Rule

rulequery

© 2008 TIBCO Software Inc. All Rights Reserved. 7

SQL: 1999

AssertionECARule

SQL: 1999 Trigger

SQL:1999 View

OCL 2.0 Invariant

XSB 2.6 Prolog

Rule Jess 3.4 Rule

ECAPRule

XSL 1.0 Rule

MS Outlook 6 RuleOracle 10g

SQL View

ILOG JRule BlazeAdvisorRule

InferenceRule ProdeduralRule

{OR}

Rule classification

per Gerd Wagner, RuleML

rulewith event declaration

query+ callback

rule function

query+ callback

rule function

Page 8: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

EPTS Glossary: on Rules

� Constraint (also event pattern constraint): A Boolean condition that must

be satisfied by the events observed in a system.

� Examples:

� A service level agreement limiting the time taken to complete a mortgage transaction from the time an application is received.

� Rule (in event processing): A prescribed method for processing events.

� Examples:

� Whenever three timeouts have happened send an alert to the network manager.

Event processing rules may be prescribed in many different ways,including by finite state machines,

activity diagrams,Java code, SQL code,

© 2008 TIBCO Software Inc. All Rights Reserved. 8

� Whenever three timeouts have happened send an alert to the network manager.

� If more than ten shopping carts have been active for more than five minutes then activate the website reaction time monitor and display an amber alert on the dashboard.

� Whenever IBM trades 2% above its 1 hour VWAP and then within 15 minutes trades 5 points below then buy 1000 shares IBM.

� Notes: Event processing rules may be prescribed in many different ways, including by finite state machines, activity diagrams, Java code, SQL code, ECA (event-condition-action) rules or reactive rules that are triggered by event patterns.

� Event pattern triggered reactive rule: a rule that prescribes actions to be taken whenever an instance of a given event pattern is detected.

SQL code, ECA (event-condition-action) rules

or reactive rules that are triggered by event patterns.

Page 9: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

C/EP = a process, development to deployment

Subscriptions

Relationships, properties, inheritance rules

Behavioural rules

© 2008 TIBCO Software Inc. All Rights Reserved. 9

Behavioural rules

Set definition rules

Rule executionalgorithms

Page 10: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Advanced Patterns & Event Behaviors

� Many EP apps fit the standard CEP patterns:

� Filter interesting rules

� Detect predefined patterns / state changes

� Update data / invoke processes and

services based on business rules and

high level events

Filter

Join

© 2008 TIBCO Software Inc. All Rights Reserved. 10

� Advanced EP:

� Exploiting inferencing to maximise

understanding of EP chains

� Apply interesting statistical functions

to event data to detect new / complex

trends

� Apply different algorithms to event data

� Modify parameters used in other rules

(“metarules”)

Decide

React

Page 11: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Example: Rete-driven Production Rules

� Scope / declaration� Classes / Events

relevant for the rule

� Conditions � Filters on declarations

� Joins across declarations

� Actions

Declarative

Performance

Filter

Join

© 2008 TIBCO Software Inc. All Rights Reserved. 11

� Actions� What to do

for each combination of declaration instances

that satisfies the conditions…

� Inference = knowledge-based

Scalable...

Inference = knowledge

Event-by-event but not set semantics

Decide

React

Page 12: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Initial Stage

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

© 2008 TIBCO Software Inc. All Rights Reserved. 12

RulesetRule R1

ScopeC1

Conditions

ActionsC1.Pj=True

Scope defines relevant classes

and events

Page 13: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Simple Operation

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1 A2 B1

© 2008 TIBCO Software Inc. All Rights Reserved. 13

RulesetRule R1

ScopeC1

Conditions

ActionsC1.Pj=True

R1 tuples are:

{A1}

{A2}No conditions

Both {A1} & {A2}

can fire

=> A1.Pj = Trueand A2.Pj = True

At runtime, a Rule definition acts like a class, with tuple-

based instances

Page 14: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Filters

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1Pi=T

A2Pi=F

B1

© 2008 TIBCO Software Inc. All Rights Reserved. 14

RulesetRule R1

ScopeC1

ConditionsC1.Pi

ActionsC1.Pj=True

R1 tuples are:

{A1}

{A2}Condition

result is {A1}

=> A1.Pj = TrueConditions act as

WHERE clausesto filter tuples

Page 15: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Tuples and Joins

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1Pi=T

A2Pi=F

B1Pk=T

© 2008 TIBCO Software Inc. All Rights Reserved. 15

RulesetRule R1

ScopeC1, C2

ConditionsC1.Pi

ActionsC1.Pj=True

R1 tuples are:

{A1, B1}

{A2, B1}Condition

result is

{A1, B1}

=> A1.Pj = TrueTuple dimension is based on # of

declarations

Page 16: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Cross Product

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1Pi=T

A2Pi=F

B1Pk=T

B2Pk=T

© 2008 TIBCO Software Inc. All Rights Reserved. 16

R1 tuples are: {A1, B1},

{A2, B1}, {A1, B2},

{A2, B2}Condition

result is

{A1, B1}, {A1, B2}

=> A1.Pj = True

RulesetRule R1

ScopeC1, C2

ConditionsC1.Pi

C2.PkActions

C1.Pj=True

# of instances in a class impacts tuple numbers (and action performance is linear)

Page 17: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Rule Cycle

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1Pi=T

A2Pi=F

B1Pk=T

B2Pk=T

© 2008 TIBCO Software Inc. All Rights Reserved. 17

R1 tuples are: {A1, B1},

{A2, B1}, {A1, B2},

{A2, B2}Condition

leaves

{A1, B1}, {A1, B2}

=> A2.Pi is set to True

RulesetRule R1

ScopeC1, C2

ConditionsC1.Pi

C2.PkActions

A2.Pi=True

Rule executioncauses changein data states

Page 18: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Rule Engine Fundamentals: Inferencing

Class C1

Properties Pi, Pj

WorkingMemory

Class C2

Property Pk

Event E1

Ruleset

A1Pi=T

A2Pi=F

B1Pk=T

B2Pk=T

© 2008 TIBCO Software Inc. All Rights Reserved. 18

R1 tuples are: {A1, B1},

{A2, B1}, {A1, B2},

{A2, B2}Condition

leaves

{A1, B1}, {A1, B2}

=> A2.Pi = True

RulesetRule R1

ScopeC1, C2

ConditionsC1.Pi

C2.PkActions

A2.Pi=True

R1 tuples are now:

{A2, B1}, {A2, B2}

Condition result is

{A2, B1},

{A2, B2}

=> A2.Pi = True(again)

Rule engine cycles until all valid tuples

are processed

Page 19: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

TBD: “Advanced Rules”

� Parameterised Rules

� Metarules to adjust these parameters

� Uncertainty

� Scoring

� Generating rules

� Machine learning

© 2008 TIBCO Software Inc. All Rights Reserved. 19

� Machine learning

� Predictive Analytics

� Reasoning + Ontologies

� Other types of rules

� Constraint Logic Programming

� Goal-driven rules

� General high-level Business Rules / constraints / strategies to events and rules

(ie processes / process generation)

Page 20: PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs Rules vs Subscriptions: System and Language Issues The Case for Rules Paul Vincent

Summary

� All EPLs can be considered as consisting of abstract rules

� Various models and execution paradigms existwith different optimisations for different use cases

� Work on abstract CEP pattern list (and best model, execution paradigms) still TBD

© 2008 TIBCO Software Inc. All Rights Reserved. 20

� http://tech.groups.yahoo.com/group/CEP-Interest/message/1953

� http://tech.groups.yahoo.com/group/CEP-Interest/message/1934

� http://tech.groups.yahoo.com/group/CEP-Interest/message/1887

etc etc