PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs...
Transcript of PANEL Streams vs Rules vs Subscriptions System …jacobsen/canoe/ss09/Panel on Rules...Streams vs...
PANELStreams vs Rules vs Subscriptions: System and Language Issues
The Case for Rules
Paul VincentTIBCO Software Inc.
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
C/EP, a “technology”
© 2008 TIBCO Software Inc. All Rights Reserved. 3
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
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
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
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
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.
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
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
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
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
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
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
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
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)
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
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
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)
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