SlideShare uma empresa Scribd logo
1 de 59
●
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
Mark Proctor
Co-Creator
Project Lead
2
Topics
 Rule engines suck
 Hybrid Rule Engines
● Reaction Rules
● Query Rules
● Functional Support
 Conccurrency and Parallization
3
Because Not Everyone
Is As Smart As He Is
4
Fact of Life
Fact of Life
5
Fact of Life
Rule Engines Suck
6
Problems
 Limitations of expressiveness
● Inability to cleanly say what you want declaratively
● Verbosity, Control/Semaphores, Emulation
 Execution flow and ordering
● Conflict Resolution is not easy
● Modules (Agenda Groups), RuleFlow Groups
● Concurrency
 Ambiguity
● Rule Recursion
● Unwanted rules
 Extensibility and Pluggability
 Transactions and isolation
 Design Patterns
7
Sequencing
select * from Light l where
seq(l.color) { start: "orange" ->
"red" -> end } )
(Light seq( (color, category)
(start: "orange", "x" ->
"green", “y” -> end ) ) )
8
Sequencing
select * from Light l where
seq(l.color, l.category) {
start: "red", "x" ->
("green", "x" ||
"yellow", "y") -> mid
start: "red", "y" -> mid
mid: "blue", "z" -> end} )
(Light seq( (color, category)
(start: "red", "x" ->
("green", "x" ||
"yellow", "y") -> mid
start: "red", "y" -> mid
mid: "blue", "z" -> end) ) )
9
Life Mission
Life Mission
10
Life Mission
HMS Suckage
Destroyer
11
Let Me Count the Ways
12
Let Me Count the Ways
13
Let Me Count the Ways
14
Let Me Count the Ways
15
Archaeology Expedition
16
The Future
 Full Hybrid Engine
● http://community.jboss.org/wiki/DroolsLanguageEnhancements
●Nested Objects
●Casting Nested Objects
●Positional Constraints
●POSL - Positional-Slotted
Language
●Method Calls
●Maps and Arrays
(Collections)
●Collections and XPath like
filtering
●Free form Expressions
●Managed Object Graphs
(MOGS)
●Nested Patterns and Queries
●Queries and Unification
●Ontologies and Relations via
●Query Based Backward
Chaining with POSL
●Triples with Hybrid POJO Graph
Notation.
●Escapes for Dialects
●Accumulate Improvements to
Support Haskell map/fold/filter
and MVEL projection/fold
● Otherwise
● Branch (Labelled Else)
● Rule Execution Groups
● Rule Dependency Meta-Rule
Language
●Parallel Meta-Rule Language
● Field Versioning
●Logical Closures/OnFalse
●Opportunistic Backward
Chaining, Lazy Field/Object
Values
●...
Hybrid Rule Engine
18
Hyrbid Rule Engine
 Rule Based Programming
● Reactive rules
● Forward Chaining
● Production Rules: Drools, Clips, OPSJ, Jess, JRules
● Query rules
● Backward Chaining
● Prolog: Prova, Open Prolog, SWI Prolog, Visual Prolog
 Functional Programming
● Haskell/Lisp
Reactive Rules
20
D a te d a te
d o u b le a m o u n t
in t ty p e
lo n g a c c o u n tN o
C a s h flo w
lo n g a c c o u n tN o
d o u b le b a la n c e
A c c o u n t
D a te s ta r t
D a te e n d
A c c o u n tin g P e r io d
Tables
21
Account
accountNo balance
1 0
increase balance for AccountPeriod Credits decrease balance for AccountPeriod Debits
AccountingPeriod
start end
01-Jan-07 31-Mar-07
trigger : acc.balance += cf.amount
Account
balance
1 -25
accountNo
Creating Views with Triggers
date amount type
12-Jan-07 100 CREDIT 1
2-Feb-07 200 DEBIT 1
18-May-07 50 CREDIT 1
9-Mar-07 75 CREDIT 1
CashFlow
accountNo
date amount type
12-Jan-07 100 CREDIT
9-Mar-07 75 CREDIT
CashFlow
date amount type
2-Feb-07 200 DEBIT
CashFlow
trigger : acc.balance -= cf.amounttrigger : acc.balance += cf.amount
select * from Account acc,
Cashflow cf, AccountPeriod ap
where acc.accountNo == cf.accountNo
and
cf.type == CREDIT
cf.date >= ap.start and
cf.date <= ap.end
trigger : acc.balance -= cf.amount
select * from Account acc,
Cashflow cf, AccountPeriod ap
where acc.accountNo == cf.accountNo
and
cf.type == DEBIT
cf.date >= ap.start and
cf.date <= ap.end
22
date amount type
12-Jan-07 100 CREDIT 1
2-Feb-07 200 DEBIT 1
18-May-07 50 CREDIT 1
9-Mar-07 75 CREDIT 1
CashFlow
accountNo
Account
accountNo balance
1 0
start end
01-Apr-07 30-Jun-07
AccountingPeriod
date amount type
18-May-07 50 CREDIT
CashFlow
date amount type
CashFlow
balance
1 25
accountNo
Creating Views with Triggers
increase balance for AccountPeriod Credits decrease balance for AccountPeriod Debits
trigger : acc.balance += cf.amount
select * from Account acc,
Cashflow cf, AccountPeriod ap
where acc.accountNo == cf.accountNo
and
cf.type == CREDIT
cf.date >= ap.start and
cf.date <= ap.end
trigger : acc.balance -= cf.amount
select * from Account acc,
Cashflow cf, AccountPeriod ap
where acc.accountNo == cf.accountNo
and
cf.type == DEBIT
cf.date >= ap.start and
cf.date <= ap.end
23
A c c o u n t A c c o u n tin g P e r io d C a s h flo w
v ie w 1 v ie w 2
m a in v ie w
T a b le s
V ie w s
V ie w
A c c o u n t A c c o u n tin g P e r io d C a s h flo w
r u le 1 r u le 2
a g e n d a
O b je c t T y p e s
R u le s
a g e n d a
Rules as Views
24
(rule “increase balance for AccountPeriod Credits”
?ap <- (AccountPeriod)
?acc <- (Account (?accountNo accountNo ) )
(CashFlow { type == CREDIT,
accountNo == ?accountNo,
date >= ?ap.start && <= ?ap.end }
(?amount amount ) )
->
(bind ?acc (balance (+ 1 ?amount) ) )
)
select * from Account acc,
Cashflow cf, AccountPeriod ap
where acc.accountNo == cf.accountNo and
cf.type == CREDIT
cf.date >= ap.start and
cf.date <= ap.end
trigger : acc.balance += cf.amount
SQL / S-Expression Rule
25
rule “increase balance for AccountPeriod Credits”
when
ap : AccountPeriod()
acc : Account( $accountNo : accountNo )
CashFlow( type == CREDIT,
accountNo == $accountNo,
date >= ap.start && date <= ap.end,
$amount : amount )
then
acc.balance += $amount;
end
DRL
26
rule “Print blance for AccountPeriod”
salience -50
when
ap : AccountPeriod()
acc : Account()
then
System.out.println( acc.accountNo + “ : “ acc.balance );
end
Salience
Agenda
1 increase balance
arbitrary2 decrease balance
3 increase balance
4 print balance
Conflict Resolution with Salience
Query Rules
28
Same Author Rule
rule sameAuthor
$i1 : Item( )
$i2 : Item( author == $i1.author )
end
select * from
Item i1, Item i2,
where
i1.author == i2.author
i1 != i2
create query(String author)
select * from
Item i1, Item i2,
where
i1.author == author
i1.author == i2.author
i1 != i2
29
Same Author Query
query sameAuthor (Item $i1, Item $i2)
$i1 : Item( )
$i2 : Item( this != $i1, author == $i1.author )
end
Book Author
Poems Tom
Songs Tom
Cars Bob
Largs Cars Jane
 sameAuthor( item1, item2 )
● both are output vars
● returns full cross product
 sameAuthor(new Item( new Book( Poems), item )
● Item1 is input var
● Item2 is output var
● Returns Songs by Tom
30
Recommendations
query sameSubject (Item $i1, Item $i2)
$i1 : Item( )
$i2 : Item( this != $i1 )
exists( $s1 : ItemSubject(item == $i1)
ItemSubject(item == $i2, subject == $s1.subject)
)
end
query recommended (Item $i1, Item $i2)
$i1 : Item( )
$p1 : Purchase( item == $i1 )
$c : Customer( this == $p.customer )
$p2 : Purchase( customer == $c, item != $i1 )
$i2 : Item( this == $p2.item )
( ?sameAuthor( $i1, $i2 ) or ?sameSubject( $i1, $i2 ) )
end
query sameAuthor (Item $i1, Item $i2)
$i1 : Item( )
$i2 : Item( this != $i1, author == $i1.author )
end
'?' incalls the query.
Bound vars are inputs.
Unbound vars are outputs.
Functional Programming
32
Functional Programming
Basic Haskel Groups
 List Processing
 Arithmetic, Higher Order Functions
 Tuples
Arithmatic
 Average
● avg [12, 4, 5, 9]
● 7.5
33
Functional Programming
Higher Order Functions
Map, Fold and Filter
 Fold
● Fold (+) 0 [1, 2, 3, 4]
● 10
 Map
● map (*2) [1, 2, 3]
● [2, 4, 6, 8]
 Filter
● Filter (>2) [3, 4, 5]
34
rule "init" when
then
insert( new Acc( "sum red buses",
STAGE.ACC_START ) );
end
rule "action" when
$b : Bus( colour == "red" )
$acc : Acc( name == "sum red buses",
stage == STAGE.ACC_START )
then
$acc.sum( $b.takings ); // do not notify the engine
end
Accumulate CE
35
Accumulate CE
rule "result" when
salience -5
$acc : Acc( name == "sum red buses",
stage == STAGE.ACC_START )
then
modify( $acc ) { stage = STAGE.ACC_END };
End
rule "evaluate result" when
$acc : Acc( sum > 100,
stage == STAGE.ACC_END )
then
print "sum is “ + $acc.sum;
end
36
Functional Support
select
c, sum(bi.price) t
from
Customer c, BaskteItem bi
where
bi.customer == c
group by
c
?c <- (Customer )
acc( ?bi <- (BasketItem {customer == ?c} )
?t <- (sum ?bi.price) )
37
Functional Support
select
c, bi.type type, sum(bi.price) t
from
Customer c, BaskteItem bi
where
bi.customer == c
group
by c , bi.type
?c <- (Customer)
acc( ?bi <- (BasketItem {customer == ?c} )
?type <- (distinct ?bi.price) )
acc( ?bi <- (BasketItem {customer == ?c,
type == ?type} )
?t <- (sum ?bi.price) )
38
DRL
select
c, sum(bi.price) t
from
Customer c, BaskteItem bi
where
bi.customer == c
group by
c
$c : Customer()
acc( $bi : BasketItem( customer == $c );
$t : sum( $bi.price) )
39
Nested
acc( acc( $c : Customer()
$bi : BasketItem( customer == $c );
$t : sum( $bi.price) );
$a : avg( $t ) )
 Average the summed expenditure for all customers
40
Nested
$c : Customer()
acc( $bi : BasketItem() from
acc( $bi : BasketItem( customer == $c );
filter( $bi, $bi.price > 100) );
$a : avg( $bi.price ) )
 Average price for all item with a price over 100
Patterns can also filter “from”
an acc result.
All Together Now
42
Shopping Basket
43
Discount Alert
rule "alert customer to potential band change"
$c : Customer()
acc( $bi : BasketItem(customer == $c )
$s : sum( $bi.price ) )
acc( $bi : BasketItem(customer == $c )
?recommended( $bi.item, $rec )
$rs : sum( $rec.price ) )
$b : Band( this != $c.band, min >= ($s + $rs),
max <= ($s + $rs) )
then
println( “If you buy all items and all recommendations,
you move up a band with a new
discount of “ + $b.discount );
end
'$rec' is unbound
and thusan output var
Concurrency and Parallelization
45
C : Customer
[John,
Sally]
B : BasketItem
b.customer == c
[John,
Sally]
Simple Rete Rule
46
Simple Rete Rule
 insert “sally”
● propagate to join
● Return as right memory is empty
 insert “john”
● propagate to join
● Return as right memory is empty
47
Simple Rete Rule
C : Customer
[John,
Sally]
[BasktItem( John, Book, Cars ),]
[John,
Sally]
[ [John,BasktItem( John, Book, Cars )] ]
B : BasketItem
b.customer == c
[BasktItem( John, Book, Cars )]
Token
Node node
Token leftParent
Token rightParent
List<Token> children
48
Simple Rete Rule
 Insert BasktItem( John, Book, Cars )
● propagate to join
● foreach( l-token : left-memory )
if ( r-token.customer == l-token )
create new Token and propagate
[John, BasktItem( John, Book, Cars )]
Token
Node node
Token leftParent
Token rightParent
List<Token> children
49
Simple Rete Rule
C : Customer
[John,
Sally]
[BasktItem( John, Book, Cars ),
BasktItem( John, Book, Poems ),
BasktItem( Sally, Book, Cinema )]
[John,
Sally]
[ [John,BasktItem( John, Book, Cars )],
[John, BasktItem( John, Book, Poems ) ],
[Sally, BasktItem( Sally, Book, Cinema ) ] ]
B : BasketItem
b.customer == c
[BasktItem( John, Book, Cars ),
BasktItem( John, Book, Poems ),
BasktItem( Sally, Book, Cinema )]
50
1 Rule 3 Joins
51
3 Rules 3 Joins
52
Gator Networks
53
Partitioning for Parellelization
54
Task Oriented
 Submit each Token propagation to Executor pool
● The join node is now an executable job
 Wins
● Only the node is locked, allowing a “pipeline”
● Possible to lock only the current index bucket
● Solves recursive query problem of large stack frames
 Loses
● Only a small amount of time in each node
● Each node repeatedly locked and scheduled, for a single WM
action, due to tree “to leaf” traversal
● Previous papers show increases for only some use cases
● Network thrashing for subnetworks on accumulate
55
Subnetwork Thrashing
$c : Customer()
acc( $b : BasketItem(customer == $c )
$d : Discount( type == $b.type);
$s : sum( $b.price * $d.multiplier ) )
Band( this != $c.band, min >= $s, max <= $s )
56
Set Oriented
 Propagate Collections instead of Tokens
● Left Input trigger
● Iterate right memory create a collection of all matching right
tokens
● Note multi-dimesional array of 1
● [[l1[r1, r2, r3]]]
● Right Input trigger
● Iterate left memory create a collection of all left joins
● Note multi-dimensional array for each left token
● [ [l1, r1],
[l2, r1]
[l3, r1] ]
Token
Node node
Token leftParent
Token rightParent
List<Token> children
57
Set Oriented
 Wins
● More work done in a node
● scalable task scheduling
● Less indirection so better statement execution
● All the work for that node done for that WM action in one task
● Single network pass, so nodes locked just once per WM action
● Avoids repeatedly creating and destroying method stack
frames
● Avoids sub network thrashing
 Loses
● More complex algorithm
● Especially on “collection” merging
58
MVCC
 Modifies
● Clone + new values and current transaction id
● Existing instance still there with older transaction id
● Node uses constraint to join with correct version
 Isolation
● Scoped to rule or rule-group
● Scoped rule(s) see new data, others old
● Non blocking so reads (joins) can still continue
 Fully Concurrent safe Queries
● Queries leave no state in join
● Node joins with correct instance, based on transaction id
59
Questions?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?

Mais conteúdo relacionado

Mais procurados

Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoJustjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoPaulo Silveira
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Droolsgiurca
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns ReconsideredAlex Miller
 
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRT3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRDavid Gómez García
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...go_oh
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018artgillespie
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lockKaram Munir Butt
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & preventionIkhtiarUddinShaHin
 
MongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Lucidworks
 
V8 hidden class and inline cache
V8 hidden class and inline cacheV8 hidden class and inline cache
V8 hidden class and inline cacheFanis Prodromou
 

Mais procurados (20)

Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoJustjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Drools
 
Design Patterns Reconsidered
Design Patterns ReconsideredDesign Patterns Reconsidered
Design Patterns Reconsidered
 
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRT3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
 
Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...Singletons in PHP - Why they are bad and how you can eliminate them from your...
Singletons in PHP - Why they are bad and how you can eliminate them from your...
 
OS_Ch8
OS_Ch8OS_Ch8
OS_Ch8
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
Operating system Dead lock
Operating system Dead lockOperating system Dead lock
Operating system Dead lock
 
Data Binding in qooxdoo
Data Binding in qooxdooData Binding in qooxdoo
Data Binding in qooxdoo
 
Deadlock detection & prevention
Deadlock detection & preventionDeadlock detection & prevention
Deadlock detection & prevention
 
MongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() Output
 
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
 
V8 hidden class and inline cache
V8 hidden class and inline cacheV8 hidden class and inline cache
V8 hidden class and inline cache
 
Deadlocks
 Deadlocks Deadlocks
Deadlocks
 
7 Deadlocks
7 Deadlocks7 Deadlocks
7 Deadlocks
 
groovy & grails - lecture 2
groovy & grails - lecture 2groovy & grails - lecture 2
groovy & grails - lecture 2
 
Ch8
Ch8Ch8
Ch8
 
Living with garbage
Living with garbageLiving with garbage
Living with garbage
 
Why Sifu
Why SifuWhy Sifu
Why Sifu
 

Semelhante a Hybrid rule engines (rulesfest 2010)

What's new in Drools 6 - London JBUG 2013
What's new in Drools 6 - London JBUG 2013What's new in Drools 6 - London JBUG 2013
What's new in Drools 6 - London JBUG 2013Mark Proctor
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Mark Proctor
 
Advanced SQL For Data Scientists
Advanced SQL For Data ScientistsAdvanced SQL For Data Scientists
Advanced SQL For Data ScientistsDatabricks
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJSKyung Yeol Kim
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017gisborne
 
Drooling for drools (JBoss webex)
Drooling for drools (JBoss webex)Drooling for drools (JBoss webex)
Drooling for drools (JBoss webex)Geoffrey De Smet
 
Refactoring at Large
Refactoring at LargeRefactoring at Large
Refactoring at LargeDanilo Sato
 
Query Optimization & How to interpret query execution plan
Query Optimization & How to interpret query  execution planQuery Optimization & How to interpret query  execution plan
Query Optimization & How to interpret query execution planAmol Barewar
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuningAOE
 
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...Julian Hyde
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0Petr Zapletal
 
So S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeSo S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
 
Drools 6.0 (CamelOne 2013)
Drools 6.0 (CamelOne 2013)Drools 6.0 (CamelOne 2013)
Drools 6.0 (CamelOne 2013)Mark Proctor
 
Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015Johann de Boer
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuningAOE
 
Paper Reading: Pessimistic Cardinality Estimation
Paper Reading: Pessimistic Cardinality EstimationPaper Reading: Pessimistic Cardinality Estimation
Paper Reading: Pessimistic Cardinality EstimationPingCAP
 
Agile data presentation 3 - cambridge
Agile data   presentation 3 - cambridgeAgile data   presentation 3 - cambridge
Agile data presentation 3 - cambridgeRomans Malinovskis
 

Semelhante a Hybrid rule engines (rulesfest 2010) (20)

What's new in Drools 6 - London JBUG 2013
What's new in Drools 6 - London JBUG 2013What's new in Drools 6 - London JBUG 2013
What's new in Drools 6 - London JBUG 2013
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Advanced SQL For Data Scientists
Advanced SQL For Data ScientistsAdvanced SQL For Data Scientists
Advanced SQL For Data Scientists
 
Compose Async with RxJS
Compose Async with RxJSCompose Async with RxJS
Compose Async with RxJS
 
Love Your Database Railsconf 2017
Love Your Database Railsconf 2017Love Your Database Railsconf 2017
Love Your Database Railsconf 2017
 
Drooling for drools (JBoss webex)
Drooling for drools (JBoss webex)Drooling for drools (JBoss webex)
Drooling for drools (JBoss webex)
 
Refactoring at Large
Refactoring at LargeRefactoring at Large
Refactoring at Large
 
Query Optimization & How to interpret query execution plan
Query Optimization & How to interpret query  execution planQuery Optimization & How to interpret query  execution plan
Query Optimization & How to interpret query execution plan
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...
Smarter Together - Bringing Relational Algebra, Powered by Apache Calcite, in...
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
 
So S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better CodeSo S.O.L.I.D Fu - Designing Better Code
So S.O.L.I.D Fu - Designing Better Code
 
Drools 6.0 (CamelOne 2013)
Drools 6.0 (CamelOne 2013)Drools 6.0 (CamelOne 2013)
Drools 6.0 (CamelOne 2013)
 
ORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdfORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdf
 
Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
Paper Reading: Pessimistic Cardinality Estimation
Paper Reading: Pessimistic Cardinality EstimationPaper Reading: Pessimistic Cardinality Estimation
Paper Reading: Pessimistic Cardinality Estimation
 
Dafunctor
DafunctorDafunctor
Dafunctor
 
Agile data presentation 3 - cambridge
Agile data   presentation 3 - cambridgeAgile data   presentation 3 - cambridge
Agile data presentation 3 - cambridge
 

Mais de Geoffrey De Smet

Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Geoffrey De Smet
 
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev ConferenceWhat is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev ConferenceGeoffrey De Smet
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools plannerGeoffrey De Smet
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleGeoffrey De Smet
 
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planningDrools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planningGeoffrey De Smet
 
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011Geoffrey De Smet
 
Drools New York City workshop 2011
Drools New York City workshop 2011Drools New York City workshop 2011
Drools New York City workshop 2011Geoffrey De Smet
 
2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)Geoffrey De Smet
 
2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?Geoffrey De Smet
 
2011-03-09 London - Drools Planner in a nutshell
2011-03-09 London - Drools Planner in a nutshell2011-03-09 London - Drools Planner in a nutshell
2011-03-09 London - Drools Planner in a nutshellGeoffrey De Smet
 
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)Geoffrey De Smet
 
Open source and business rules
Open source and business rulesOpen source and business rules
Open source and business rulesGeoffrey De Smet
 
st - demystifying complext event processing
st - demystifying complext event processingst - demystifying complext event processing
st - demystifying complext event processingGeoffrey De Smet
 
jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)Geoffrey De Smet
 
Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)Geoffrey De Smet
 
Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)Geoffrey De Smet
 
2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use casesGeoffrey De Smet
 

Mais de Geoffrey De Smet (18)

Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012Drools planner - 2012-10-23 IntelliFest 2012
Drools planner - 2012-10-23 IntelliFest 2012
 
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev ConferenceWhat is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
What is Drools, Guvnor and Planner? 2012 02-17 Brno Dev Conference
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by example
 
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planningDrools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
Drools Planner webinar (2011-06-15): Drools Planner optimizes automated planning
 
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
Applying CEP Drools Fusion - Drools jBPM Bootcamps 2011
 
Drools New York City workshop 2011
Drools New York City workshop 2011Drools New York City workshop 2011
Drools New York City workshop 2011
 
2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)2011-03-29 London - Decision tables in depth (Michael Anstis)
2011-03-29 London - Decision tables in depth (Michael Anstis)
 
2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?2011-03-29 London - Why do I need the guvnor BRMS?
2011-03-29 London - Why do I need the guvnor BRMS?
 
2011-03-09 London - Drools Planner in a nutshell
2011-03-09 London - Drools Planner in a nutshell2011-03-09 London - Drools Planner in a nutshell
2011-03-09 London - Drools Planner in a nutshell
 
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
2011-03-24 IDC - Adaptive and flexible processes (Mark Proctor)
 
Open source and business rules
Open source and business rulesOpen source and business rules
Open source and business rules
 
st - demystifying complext event processing
st - demystifying complext event processingst - demystifying complext event processing
st - demystifying complext event processing
 
jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)jBPM 5 (JUDCon 2010-10-08)
jBPM 5 (JUDCon 2010-10-08)
 
Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)Applying complex event processing (2010-10-11)
Applying complex event processing (2010-10-11)
 
Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)Towards unified knowledge management platform (rulefest 2010)
Towards unified knowledge management platform (rulefest 2010)
 
2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases
 
Drools BeJUG 2010
Drools BeJUG 2010Drools BeJUG 2010
Drools BeJUG 2010
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Hybrid rule engines (rulesfest 2010)

  • 1. ● 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 Mark Proctor Co-Creator Project Lead
  • 2. 2 Topics  Rule engines suck  Hybrid Rule Engines ● Reaction Rules ● Query Rules ● Functional Support  Conccurrency and Parallization
  • 3. 3 Because Not Everyone Is As Smart As He Is
  • 5. 5 Fact of Life Rule Engines Suck
  • 6. 6 Problems  Limitations of expressiveness ● Inability to cleanly say what you want declaratively ● Verbosity, Control/Semaphores, Emulation  Execution flow and ordering ● Conflict Resolution is not easy ● Modules (Agenda Groups), RuleFlow Groups ● Concurrency  Ambiguity ● Rule Recursion ● Unwanted rules  Extensibility and Pluggability  Transactions and isolation  Design Patterns
  • 7. 7 Sequencing select * from Light l where seq(l.color) { start: "orange" -> "red" -> end } ) (Light seq( (color, category) (start: "orange", "x" -> "green", “y” -> end ) ) )
  • 8. 8 Sequencing select * from Light l where seq(l.color, l.category) { start: "red", "x" -> ("green", "x" || "yellow", "y") -> mid start: "red", "y" -> mid mid: "blue", "z" -> end} ) (Light seq( (color, category) (start: "red", "x" -> ("green", "x" || "yellow", "y") -> mid start: "red", "y" -> mid mid: "blue", "z" -> end) ) )
  • 11. 11 Let Me Count the Ways
  • 12. 12 Let Me Count the Ways
  • 13. 13 Let Me Count the Ways
  • 14. 14 Let Me Count the Ways
  • 16. 16 The Future  Full Hybrid Engine ● http://community.jboss.org/wiki/DroolsLanguageEnhancements ●Nested Objects ●Casting Nested Objects ●Positional Constraints ●POSL - Positional-Slotted Language ●Method Calls ●Maps and Arrays (Collections) ●Collections and XPath like filtering ●Free form Expressions ●Managed Object Graphs (MOGS) ●Nested Patterns and Queries ●Queries and Unification ●Ontologies and Relations via ●Query Based Backward Chaining with POSL ●Triples with Hybrid POJO Graph Notation. ●Escapes for Dialects ●Accumulate Improvements to Support Haskell map/fold/filter and MVEL projection/fold ● Otherwise ● Branch (Labelled Else) ● Rule Execution Groups ● Rule Dependency Meta-Rule Language ●Parallel Meta-Rule Language ● Field Versioning ●Logical Closures/OnFalse ●Opportunistic Backward Chaining, Lazy Field/Object Values ●...
  • 18. 18 Hyrbid Rule Engine  Rule Based Programming ● Reactive rules ● Forward Chaining ● Production Rules: Drools, Clips, OPSJ, Jess, JRules ● Query rules ● Backward Chaining ● Prolog: Prova, Open Prolog, SWI Prolog, Visual Prolog  Functional Programming ● Haskell/Lisp
  • 20. 20 D a te d a te d o u b le a m o u n t in t ty p e lo n g a c c o u n tN o C a s h flo w lo n g a c c o u n tN o d o u b le b a la n c e A c c o u n t D a te s ta r t D a te e n d A c c o u n tin g P e r io d Tables
  • 21. 21 Account accountNo balance 1 0 increase balance for AccountPeriod Credits decrease balance for AccountPeriod Debits AccountingPeriod start end 01-Jan-07 31-Mar-07 trigger : acc.balance += cf.amount Account balance 1 -25 accountNo Creating Views with Triggers date amount type 12-Jan-07 100 CREDIT 1 2-Feb-07 200 DEBIT 1 18-May-07 50 CREDIT 1 9-Mar-07 75 CREDIT 1 CashFlow accountNo date amount type 12-Jan-07 100 CREDIT 9-Mar-07 75 CREDIT CashFlow date amount type 2-Feb-07 200 DEBIT CashFlow trigger : acc.balance -= cf.amounttrigger : acc.balance += cf.amount select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance -= cf.amount select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == DEBIT cf.date >= ap.start and cf.date <= ap.end
  • 22. 22 date amount type 12-Jan-07 100 CREDIT 1 2-Feb-07 200 DEBIT 1 18-May-07 50 CREDIT 1 9-Mar-07 75 CREDIT 1 CashFlow accountNo Account accountNo balance 1 0 start end 01-Apr-07 30-Jun-07 AccountingPeriod date amount type 18-May-07 50 CREDIT CashFlow date amount type CashFlow balance 1 25 accountNo Creating Views with Triggers increase balance for AccountPeriod Credits decrease balance for AccountPeriod Debits trigger : acc.balance += cf.amount select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance -= cf.amount select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == DEBIT cf.date >= ap.start and cf.date <= ap.end
  • 23. 23 A c c o u n t A c c o u n tin g P e r io d C a s h flo w v ie w 1 v ie w 2 m a in v ie w T a b le s V ie w s V ie w A c c o u n t A c c o u n tin g P e r io d C a s h flo w r u le 1 r u le 2 a g e n d a O b je c t T y p e s R u le s a g e n d a Rules as Views
  • 24. 24 (rule “increase balance for AccountPeriod Credits” ?ap <- (AccountPeriod) ?acc <- (Account (?accountNo accountNo ) ) (CashFlow { type == CREDIT, accountNo == ?accountNo, date >= ?ap.start && <= ?ap.end } (?amount amount ) ) -> (bind ?acc (balance (+ 1 ?amount) ) ) ) select * from Account acc, Cashflow cf, AccountPeriod ap where acc.accountNo == cf.accountNo and cf.type == CREDIT cf.date >= ap.start and cf.date <= ap.end trigger : acc.balance += cf.amount SQL / S-Expression Rule
  • 25. 25 rule “increase balance for AccountPeriod Credits” when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && date <= ap.end, $amount : amount ) then acc.balance += $amount; end DRL
  • 26. 26 rule “Print blance for AccountPeriod” salience -50 when ap : AccountPeriod() acc : Account() then System.out.println( acc.accountNo + “ : “ acc.balance ); end Salience Agenda 1 increase balance arbitrary2 decrease balance 3 increase balance 4 print balance Conflict Resolution with Salience
  • 28. 28 Same Author Rule rule sameAuthor $i1 : Item( ) $i2 : Item( author == $i1.author ) end select * from Item i1, Item i2, where i1.author == i2.author i1 != i2 create query(String author) select * from Item i1, Item i2, where i1.author == author i1.author == i2.author i1 != i2
  • 29. 29 Same Author Query query sameAuthor (Item $i1, Item $i2) $i1 : Item( ) $i2 : Item( this != $i1, author == $i1.author ) end Book Author Poems Tom Songs Tom Cars Bob Largs Cars Jane  sameAuthor( item1, item2 ) ● both are output vars ● returns full cross product  sameAuthor(new Item( new Book( Poems), item ) ● Item1 is input var ● Item2 is output var ● Returns Songs by Tom
  • 30. 30 Recommendations query sameSubject (Item $i1, Item $i2) $i1 : Item( ) $i2 : Item( this != $i1 ) exists( $s1 : ItemSubject(item == $i1) ItemSubject(item == $i2, subject == $s1.subject) ) end query recommended (Item $i1, Item $i2) $i1 : Item( ) $p1 : Purchase( item == $i1 ) $c : Customer( this == $p.customer ) $p2 : Purchase( customer == $c, item != $i1 ) $i2 : Item( this == $p2.item ) ( ?sameAuthor( $i1, $i2 ) or ?sameSubject( $i1, $i2 ) ) end query sameAuthor (Item $i1, Item $i2) $i1 : Item( ) $i2 : Item( this != $i1, author == $i1.author ) end '?' incalls the query. Bound vars are inputs. Unbound vars are outputs.
  • 32. 32 Functional Programming Basic Haskel Groups  List Processing  Arithmetic, Higher Order Functions  Tuples Arithmatic  Average ● avg [12, 4, 5, 9] ● 7.5
  • 33. 33 Functional Programming Higher Order Functions Map, Fold and Filter  Fold ● Fold (+) 0 [1, 2, 3, 4] ● 10  Map ● map (*2) [1, 2, 3] ● [2, 4, 6, 8]  Filter ● Filter (>2) [3, 4, 5]
  • 34. 34 rule "init" when then insert( new Acc( "sum red buses", STAGE.ACC_START ) ); end rule "action" when $b : Bus( colour == "red" ) $acc : Acc( name == "sum red buses", stage == STAGE.ACC_START ) then $acc.sum( $b.takings ); // do not notify the engine end Accumulate CE
  • 35. 35 Accumulate CE rule "result" when salience -5 $acc : Acc( name == "sum red buses", stage == STAGE.ACC_START ) then modify( $acc ) { stage = STAGE.ACC_END }; End rule "evaluate result" when $acc : Acc( sum > 100, stage == STAGE.ACC_END ) then print "sum is “ + $acc.sum; end
  • 36. 36 Functional Support select c, sum(bi.price) t from Customer c, BaskteItem bi where bi.customer == c group by c ?c <- (Customer ) acc( ?bi <- (BasketItem {customer == ?c} ) ?t <- (sum ?bi.price) )
  • 37. 37 Functional Support select c, bi.type type, sum(bi.price) t from Customer c, BaskteItem bi where bi.customer == c group by c , bi.type ?c <- (Customer) acc( ?bi <- (BasketItem {customer == ?c} ) ?type <- (distinct ?bi.price) ) acc( ?bi <- (BasketItem {customer == ?c, type == ?type} ) ?t <- (sum ?bi.price) )
  • 38. 38 DRL select c, sum(bi.price) t from Customer c, BaskteItem bi where bi.customer == c group by c $c : Customer() acc( $bi : BasketItem( customer == $c ); $t : sum( $bi.price) )
  • 39. 39 Nested acc( acc( $c : Customer() $bi : BasketItem( customer == $c ); $t : sum( $bi.price) ); $a : avg( $t ) )  Average the summed expenditure for all customers
  • 40. 40 Nested $c : Customer() acc( $bi : BasketItem() from acc( $bi : BasketItem( customer == $c ); filter( $bi, $bi.price > 100) ); $a : avg( $bi.price ) )  Average price for all item with a price over 100 Patterns can also filter “from” an acc result.
  • 43. 43 Discount Alert rule "alert customer to potential band change" $c : Customer() acc( $bi : BasketItem(customer == $c ) $s : sum( $bi.price ) ) acc( $bi : BasketItem(customer == $c ) ?recommended( $bi.item, $rec ) $rs : sum( $rec.price ) ) $b : Band( this != $c.band, min >= ($s + $rs), max <= ($s + $rs) ) then println( “If you buy all items and all recommendations, you move up a band with a new discount of “ + $b.discount ); end '$rec' is unbound and thusan output var
  • 45. 45 C : Customer [John, Sally] B : BasketItem b.customer == c [John, Sally] Simple Rete Rule
  • 46. 46 Simple Rete Rule  insert “sally” ● propagate to join ● Return as right memory is empty  insert “john” ● propagate to join ● Return as right memory is empty
  • 47. 47 Simple Rete Rule C : Customer [John, Sally] [BasktItem( John, Book, Cars ),] [John, Sally] [ [John,BasktItem( John, Book, Cars )] ] B : BasketItem b.customer == c [BasktItem( John, Book, Cars )] Token Node node Token leftParent Token rightParent List<Token> children
  • 48. 48 Simple Rete Rule  Insert BasktItem( John, Book, Cars ) ● propagate to join ● foreach( l-token : left-memory ) if ( r-token.customer == l-token ) create new Token and propagate [John, BasktItem( John, Book, Cars )] Token Node node Token leftParent Token rightParent List<Token> children
  • 49. 49 Simple Rete Rule C : Customer [John, Sally] [BasktItem( John, Book, Cars ), BasktItem( John, Book, Poems ), BasktItem( Sally, Book, Cinema )] [John, Sally] [ [John,BasktItem( John, Book, Cars )], [John, BasktItem( John, Book, Poems ) ], [Sally, BasktItem( Sally, Book, Cinema ) ] ] B : BasketItem b.customer == c [BasktItem( John, Book, Cars ), BasktItem( John, Book, Poems ), BasktItem( Sally, Book, Cinema )]
  • 50. 50 1 Rule 3 Joins
  • 51. 51 3 Rules 3 Joins
  • 54. 54 Task Oriented  Submit each Token propagation to Executor pool ● The join node is now an executable job  Wins ● Only the node is locked, allowing a “pipeline” ● Possible to lock only the current index bucket ● Solves recursive query problem of large stack frames  Loses ● Only a small amount of time in each node ● Each node repeatedly locked and scheduled, for a single WM action, due to tree “to leaf” traversal ● Previous papers show increases for only some use cases ● Network thrashing for subnetworks on accumulate
  • 55. 55 Subnetwork Thrashing $c : Customer() acc( $b : BasketItem(customer == $c ) $d : Discount( type == $b.type); $s : sum( $b.price * $d.multiplier ) ) Band( this != $c.band, min >= $s, max <= $s )
  • 56. 56 Set Oriented  Propagate Collections instead of Tokens ● Left Input trigger ● Iterate right memory create a collection of all matching right tokens ● Note multi-dimesional array of 1 ● [[l1[r1, r2, r3]]] ● Right Input trigger ● Iterate left memory create a collection of all left joins ● Note multi-dimensional array for each left token ● [ [l1, r1], [l2, r1] [l3, r1] ] Token Node node Token leftParent Token rightParent List<Token> children
  • 57. 57 Set Oriented  Wins ● More work done in a node ● scalable task scheduling ● Less indirection so better statement execution ● All the work for that node done for that WM action in one task ● Single network pass, so nodes locked just once per WM action ● Avoids repeatedly creating and destroying method stack frames ● Avoids sub network thrashing  Loses ● More complex algorithm ● Especially on “collection” merging
  • 58. 58 MVCC  Modifies ● Clone + new values and current transaction id ● Existing instance still there with older transaction id ● Node uses constraint to join with correct version  Isolation ● Scoped to rule or rule-group ● Scoped rule(s) see new data, others old ● Non blocking so reads (joins) can still continue  Fully Concurrent safe Queries ● Queries leave no state in join ● Node joins with correct instance, based on transaction id
  • 59. 59 Questions?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?