Forward Chaining in HALO
An Implementation Strategy for History-based Logic
Pointcuts
@International Conference On Dynamic Languages 2007,
Lugano, August 27th, 2007
Charlotte Herzeel, Kris Gybels, Pascal Costanza, Coen De Roover and Theo D’hondt
Programming Technology Laboratory
Vrije Universiteit Brussel
Overview
• Introduction
• Logic Meta Programming & Aspect-Oriented Programming
• Running example - going shopping
• History-based Aspects using LOgic:
• Aspect-Oriented Programming for Lisp
• meta model = the program execution
• hybrid language (temporal logic programming/CLOS)
• Implementing HALO
• HALO weaver Architecture
• Query Engine based on RETE
• Reducing Memory Overhead
Scattering & tangling
Scattering & tangling
Tyranny of the dominant decomposition
Scattering & tangling
Tyranny of the dominant decomposition
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
CLOS: before, after, around
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
CLOS: before, after, around
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
(defmethod shareAccount :around ((c client), (a account))
(log “sharing account ~s ~s” c a)
(call-next-method))
(defmethod withdraw :around ((c client), (i integer))
...)
(defmethod credit :around ((c client), (i integer))
...)
CLOS: before, after, around
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
CLOS: before, after, around
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
make a log entry”
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
pointcut
make a log entry”
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
(defmethod shareAccount :around ((c client), (a account))
(log “sharing account ~s ~s” c a)
(call-next-method))
(defmethod withdraw :around ((c client), (i integer))
...)
(defmethod credit :around ((c client), (i integer))
...)
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
!
?macros
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
! -- current join point only
?macros
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
CLOS: before, after, around
Aspect
Scattering & tangling
Tyranny of the dominant decomposition
Bank
Client
Account
withdraw(AccountNr, Integer)
credit(AccountNr, Integer)
view(AccountNr)
1 *
*
*
register(Client)
createAccount(Client)
shareAccount(Client, Account)
login(Client)
logout(Client)
withdraw(Client, Integer)
credit(Client, Integer)
transfer(Client, Account)
view(Client)
log sensitive operations = crosscutting concern
tangling & scattering
-- maintainability
-- reusability
-- readability
! -- current join point only
?macros
! history of join points
Aspect-Oriented Programming
pointcut
make a log entry”
advice
“at each sensitive method call,
Declarative Meta Programming & Aspect-Oriented Programming
base)
Declarative Meta Programming & Aspect-Oriented Programming
(base base)
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
meta model
MP
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(defclass account () ((balance)))
(defclass client () ((id)))
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr)
...)
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(defclass account () ((balance)))
(defclass client () ((id)))
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr)
...)
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(defclass account () ((balance)))
(defclass client () ((id)))
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr)
...)
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
method(<account>, <withdraw>)
methodName(<withdraw>, withdraw)
methodArguments(<withdraw>, ())
methodStatements(<withdraw>, ((setf
(balance a) (- (balance a) nr))))
...
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(defclass account () ((balance)))
(defclass client () ((id)))
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr)
...)
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
method(<account>, <withdraw>)
methodName(<withdraw>, withdraw)
methodArguments(<withdraw>, ())
methodStatements(<withdraw>, ((setf
(balance a) (- (balance a) nr))))
...
abstractClassHeuristic() if
forall(abstractClass(?C),baseClass(?C)),
forall(baseClass(?C),abstractClass(?C)).
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(defclass account () ((balance)))
(defclass client () ((id)))
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr)
...)
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
method(<account>, <withdraw>)
methodName(<withdraw>, withdraw)
methodArguments(<withdraw>, ())
methodStatements(<withdraw>, ((setf
(balance a) (- (balance a) nr))))
...
abstractClassHeuristic() if
forall(abstractClass(?C),baseClass(?C)),
forall(baseClass(?C),abstractClass(?C)).
SOUL for DMP:
Base code to facts -> Image querying
Symbiosis (quasiquoting)
Rule abstraction (Libraries)
Generating code
Detecting/Verifying coding patterns
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
compute
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
carma pointcut
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
rule abstraction,
unification,
recursion
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
carma pointcut
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
rule abstraction,
unification,
recursion
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
reusability,
reasoning
CARMA: AOP with a SOUL
modularizing scattered & tangled code
Join point type predicates
Link to shadows
Symbiosis
Loose coupling aspect/base
Pattern-based pointcuts
carma pointcut
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
rule abstraction,
unification,
recursion
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
reusability,
reasoning
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
rule abstraction,
unification,
recursion
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
reusability,
reasoning
HALO: AOP with a memory
Temporal/Stateful pointcuts
Declarative Meta Programming & Aspect-Oriented Programming
(base base)(meta base))
meta language object language
pointcut language
meta model
base language
MP
AOP jp model
rule abstraction,
unification,
recursion
class( account , <account>)
classImplementsMethodNamed
(<account> , withdraw, <withdraw>)
send(<jp>, withdraw, [<account>])
assignment(<jp>, balance, 10, 7)
reference(<jp2>, balance, 7)
1.
2.
(defclass account () ...)
(defmethod withdraw ((a account) nr)
(setf (balance a) (- (balance a) nr)))
(defmethod credit ((a account) nr) ...)
(withdraw *account* 3)
(print (get-value *account* balance))
reusability,
reasoning
HALO: AOP with a memory
Temporal/Stateful pointcuts
record
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
-10%
Running example
VISAMasterCardMasterCard
Boutique
Clothing
-10%
Running example
VISAMasterCardMasterCard
Boutique
Clothing
-10%
Running example
VISAMasterCardMasterCard
Boutique
Clothing
-10%
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
Boutique
Clothing
Running example
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
1
*
Shop Article
Basket
login(shop,name,pwd)
buy(shop,name,pwd)
checkout()
current-rate(article)
set-rate(article, rate)
1
1
1
*
*
* * 1
Basket
User
Promotions
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
1
*
Shop Article
Basket
login(shop,name,pwd)
buy(shop,name,pwd)
checkout()
current-rate(article)
set-rate(article, rate)
1
1
1
*
*
* * 1
Basket
User
Promotions
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
1
*
Shop Article
Basket
login(shop,name,pwd)
buy(shop,name,pwd)
checkout()
current-rate(article)
set-rate(article, rate)
1
1
1
*
*
* * 1
Basket
User
Promotions
VISAMasterCardMasterCard
$
Boutique
Clothing
Running example
1
*
Shop Article
Basket
login(shop,name,pwd)
buy(shop,name,pwd)
checkout()
current-rate(article)
set-rate(article, rate)
1
1
1
*
*
* * 1
Basket
User
Promotions
Stateful!!
Mental Model
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
jp facts
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
?obj
Join Point Type Predicates
?obj ?name ?val
?oval?obj ?name ?val
?obj?gf-name
?gf-name ?obj ?res
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
?obj
Join Point Type Predicates
?obj ?name ?val
?oval?obj ?name ?val
?obj?gf-name
?gf-name ?obj ?res
Extensible ...
(defrule (promotion “25-12-2008”))
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
Hybrid Pointcuts
?obj
Join Point Type Predicates
?obj ?name ?val
?oval?obj ?name ?val
?obj?gf-name
?gf-name ?obj ?res
(escape ?name (password ?user))
Extensible ...
(defrule (promotion “25-12-2008”))
(defrule (date ?date) (escape ?date (get-current-time)))
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
Hybrid Pointcuts
?obj
Join Point Type Predicates
?obj ?name ?val
?oval?obj ?name ?val
?obj?gf-name
?gf-name ?obj ?res
(escape ?name (password ?user))
Extensible ...
(defrule (promotion “25-12-2008”))
(defrule (date ?date) (escape ?date (get-current-time)))
Join Point Model
(make-instance user) (create user <kris>)
(checkout <kris>) (gf-call checkout <kris>)
(end-gf-call checkout <kris> nil)
(get-value <kris> name) (slot-get <kris> name kris )
(setf (get-value <kris> name)
kris )
(slot-set <kris> name kris )
CLOS Join Point Facts
Hybrid Pointcuts
?obj
Join Point Type Predicates
?obj ?name ?val
?oval?obj ?name ?val
?obj?gf-name
?gf-name ?obj ?res
(escape ?name (password ?user))
Extensible ...
(defrule (promotion “25-12-2008”))
(defrule (date ?date) (escape ?date (get-current-time)))
Ad-hoc
context-exposure
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login
2.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buy
2.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buy
2.
3.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
logoutlogin buy
2.
3.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
logoutlogin buy
2.
3.
4.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
loginlogoutlogin buy
2.
3.
4.
1.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
loginlogoutlogin buy
2.
3.
4.
1.
5.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buylogoutlogin buy
2.
3.
4.
1.
5.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buylogoutlogin buy
2.
3.
4.
1.
5.
6.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buy buylogoutlogin buy
2.
3.
4.
1.
5.
6.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buy buylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
2.
3.
4.
1.
5.
6.
7.
Temporal Matching
(login <shop> <kris> kris kros )
(buy <kris> <jacket>)
(logout <kris>)
(login <shop> <kris> kris kros )
(buy <kris> <t-shirt>)
(buy <kris> <socks>)
(checkout <kris>)
((gf-call checkout ?args)
(all-past (gf-call buy ?args2)))
((gf-call checkout ?args)
(most-recent (gf-call buy ?args2)))
T customer
login buy buy checkoutbuy logoutlogin
T customer
login buy checkoutbuylogoutlogin buy
T customer
login buy buy checkoutbuy logoutlogin
((gf-call checkout ?args)
(since (most-recent (gf-call login ?args2))
(all-past (gf-call buy ?args3)
Stateful
context-exposure
2.
3.
4.
1.
5.
6.
7.
Stateful context-exposure
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
Stateful context-exposure
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
T <kris>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
T <kris>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
1.
T <kris>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
1.
T <kris>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
1.
T <kris>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
1.
T <kris>
login
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
T <kris>
login
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
T <kris>
login buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
T <kris>
login buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
login buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(defrule (rate-for ?rate ?article)
(escape ?promo (singleton-instance promotions)
(escape ?rate (discount-rate-for ?promo ?article)))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
<kris> gets a 0.05% discount on <cd>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
<kris> gets a 0.05% discount on <cd>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
<kris> gets a 0.05% discount on <cd>
<kris> gets a 0.00% discount on <cd>
Stateful context-exposure
(at
((gf-call buy ?user ?article)
(most-recent (gf-call login ?user _ _ _)
(rate-for ?rate ?article)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(at
((gf-call buy ?user ?article)
(rate-for ?rate ?article)
(most-recent (gf-call login ?user _ _ _)))
(format t ~s gets a ~s % discount on ~s ?user ?rate ?article))
(let ((promo (singleton-instance promotions)))
(setf (rate-for promo) <cd> 0.05)
(login <kris> <shop> kris kros )
(buy <kris> <cd>)
(setf (rate-for promo) <cd> 0.00)
(buy <kris> <cd>)))
2.
3.
4.
1.
5.
6.
T <kris>
buylogin buy
“<kris> gets a 0.05% discount on <cd>”
“<kris> gets a 0.05% discount on <cd>”
<kris> gets a 0.05% discount on <cd>
<kris> gets a 0.00% discount on <cd>
Stateful
context-exposure
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
* by wrapping class & generic
function protocols in CLOS MOP
* explicit meta class tagging
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
* extension of RETE forward
chaining, supporting temporal
operators + hybrid pointcuts
* copy semantics through static
analysis
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
Weaver Implementation
fact generator
query
engine
jp ctr
(defclass user () ((name))
(defmethod checkout ((u user)) ...)
(defmethod buy ((u user) (a article)) ...)
base
most-recent, all-past, since, cflow
temporal relations
(at
((gf-call checkout ?u)
(most-recent (buy ?u ?a)))
(log user ~s bought ~s ?u ?a))
aspect
(defrule (buy ?u)
(gf-call buy ?u ?a))
rules
TN: (gf-call checkout <user>)
TN-1: (gf-call buy <user> <cd>)
fact base
* reducing the join point history
dynamically
* gbc in RETE based on
semantics of temporal operators
* results presented @ RV 2007
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
1.
2.
3.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
1.
2.
3.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
1.
2.
3.
4.
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
1.
2.
3.
4. (4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>))
)
’’On every checkout, give a discount
based on the rate at login time’’
) Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>))
)
’’On every checkout, give a discount
based on the rate at login time’’
)
) Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>))
)
’’On every checkout, give a discount
based on the rate at login time’’
)
) Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(discount <kris> 0.00)
)
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>))
)
’’On every checkout, give a discount
based on the rate at login time’’
)
) Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
1.
2.
3.
4.
5.
(discount <kris> 0.00)
)
(4 gf-call set-rate <shop> 0.00)
(5 gf-call checkout <kris>)
(2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>))
)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1. (1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(2 gf-call login <kris> <shop>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
(5 gf-call checkout <kris>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
(5 gf-call checkout <kris>)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
Chaining
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
(5 gf-call checkout <kris>)
(discount <kris> 0.05)
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
ChainingStateful
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
(5 gf-call checkout <kris>)
(discount <kris> 0.05)
)
Backward
Chaining
Backward Chaining vs Rete Forward Chaining
(gf-call checkout (?user))
(gf-call login ?user ?shop) (escape ?rate (current-rate ?shop))
and
most-recent
?(discount ?user ?rate)
!
query engine
(set-rate *shop* 0.05)
(login *kris* *shop*)
(buy *kris* *cd*)
(set-rate *shop* 0.00)
(checkout *kris*)
Rete
Forward
ChainingStateful
’’On every checkout, give a discount
based on the rate at login time’’
1.
2.
3.
4.
5.
(1 gf-call set-rate <shop> 0.05)
(2 gf-call login <kris> <shop>)
(3 gf-call buy <kris> <cd>)
(5 gf-call checkout <kris>)
(4 gf-call set-rate <shop> 0.00)
(2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>))
)
(5 gf-call checkout <kris>)
(discount <kris> 0.05)
)
Temporal Extensions
Escape Extension
Reducing Memory Overhead
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))
most-recent
?(discount ?user ?rate)
escape
T1 ?user
T2 ?user ?shop
T2 ?rate ?user ?shop
T1 ?rate ?user ?shop
(login *kris* *shop*)
(buy *kris* *cd*)
(checkout *kris*)
(login *kris* *shop*)
(buy *kris* *dvd*)
(checkout *kris*)
Code
Reducing Memory Overhead
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))
most-recent
?(discount ?user ?rate)
escape
T1 ?user
T2 ?user ?shop
T2 ?rate ?user ?shop
T1 ?rate ?user ?shop
(login *kris* *shop*)
(buy *kris* *cd*)
(checkout *kris*)
(login *kris* *shop*)
(buy *kris* *dvd*)
(checkout *kris*)
1 <kris> <shop>
3 <kris>
4 <kris> <shop>0.05
3 <kris> <shop>0.05
6 <kris> <shop>0.05
4 <kris> <shop>
1 <kris> <shop>0.05
6 <kris>
Code
Reducing Memory Overhead
(at ((gf-call checkout (?user))
(most-recent (gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))))
(discount ?user ?rate))
(gf-call checkout (?user))
(gf-call login ?user ?shop)
(escape ?rate (current-rate ?shop))
most-recent
?(discount ?user ?rate)
escape
T1 ?user
T2 ?user ?shop
T2 ?rate ?user ?shop
T1 ?rate ?user ?shop
(login *kris* *shop*)
(buy *kris* *cd*)
(checkout *kris*)
(login *kris* *shop*)
(buy *kris* *dvd*)
(checkout *kris*)
1 <kris> <shop>
3 <kris>
4 <kris> <shop>0.05
3 <kris> <shop>0.05
6 <kris> <shop>0.05
4 <kris> <shop>
1 <kris> <shop>0.05
6 <kris>
Code LT
[1,1]
[4,4]
LT
[1,4]
[4,..]
LT
[3,3]
[6,6]
LT
[3,3]
[6,6]
DEMO
0 2,000 4,000 6,000 8,000
S3 copy
S3 non copy
S2 copy
S2 non copy
S1 copy
S1 non copy
nr of memory
table entries
still allocated
total nr of
memory table
entries ever
made
nr of
generated join
point facts
Reducing Memory Overhead (2)
Escaping with future variables in HALO
Charlotte Herzeel, Kris Gybels, Pascal Costanza
In "Proc. of the Runtime Verification Workshop", 2007
Modularizing crosscuts in an e-commerce application in Lisp using HALO
Charlotte Herzeel, Kris Gybels, Pascal Costanza, Theo D’Hondt
In "Proc. of the International Lisp Conference", 2007
0 2,000 4,000 6,000 8,000
S3 copy
S3 non copy
S2 copy
S2 non copy
S1 copy
S1 non copy
nr of memory
table entries
still allocated
total nr of
memory table
entries ever
made
nr of
generated join
point facts
Reducing Memory Overhead (2)
It
helps!
Escaping with future variables in HALO
Charlotte Herzeel, Kris Gybels, Pascal Costanza
In "Proc. of the Runtime Verification Workshop", 2007
Modularizing crosscuts in an e-commerce application in Lisp using HALO
Charlotte Herzeel, Kris Gybels, Pascal Costanza, Theo D’Hondt
In "Proc. of the International Lisp Conference", 2007
Summary & Future Work
• Summary:
• history-based AOP for CLOS ; stateful pointcuts
• temporal logic-based: abstraction & logic variables
• Rete forward chaining-based implementation
• memory reduction
• Future Work:
• language design:
• exploit logic-programming (i.e. unification & recursion)
• exploit temporal logic-programming (mixing temporal logic/advice code)
• before/after ... what about around? (roll-back mechanism)
• reducing memory overhead:
• shadow weaving
Summary & Future Work
• Summary:
• history-based AOP for CLOS ; stateful pointcuts
• temporal logic-based: abstraction & logic variables
• Rete forward chaining-based implementation
• memory reduction
• Future Work:
• language design:
• exploit logic-programming (i.e. unification & recursion)
• exploit temporal logic-programming (mixing temporal logic/advice code)
• before/after ... what about around? (roll-back mechanism)
• reducing memory overhead:
• shadow weaving
Thanks for listening!
Questions?
Summary & Future Work
• Summary:
• history-based AOP for CLOS ; stateful pointcuts
• temporal logic-based: abstraction & logic variables
• Rete forward chaining-based implementation
• memory reduction
• Future Work:
• language design:
• exploit logic-programming (i.e. unification & recursion)
• exploit temporal logic-programming (mixing temporal logic/advice code)
• before/after ... what about around? (roll-back mechanism)
• reducing memory overhead:
• shadow weaving
Thanks for listening!
Questions?
http://prog.vub.ac.be/HALO
References
• Supporting Software Development Through Declaratively Codified Programming Patterns, Kim
Mens, Isabel Michiels, Roel Wuyts In "Journal on Expert Systems with Applications, Elsevier
Publications, pages 405-413, number 4, Volume 23, November", 2002
• Arranging language features for more robust pattern-based crosscuts
Kris Gybels, Johan Brichau, In "Proceedings of the Second International Conference on Aspect-
Oriented Software Development", 2003
• Seamless Integration of Rule-Based Knowledge and Object-Oriented Functionality with Linguistic
Symbiosis, Maja D'Hondt, Kris Gybels, Viviane Jonckers, In "Proceedings of the 19th Annual
ACM Symposium on Applied Computing (SAC 2004), Special Track on Object-Oriented
Programming, Languages and Systems. Nicosia, Cyprus. ACM. March 2004.", 2004
• Context-aware Aspects, Eric Tanter, Kris Gybels, Marcus Denker, Alexandre Bergel,
Proceedings of the 5th International Symposium on Software Composition (SC 2006), LNCS
4089, pp.227-249, Springer-Verlag, March 2006, Vienna, Austria
• Expressive Pointcuts for Increased Modularity, Klaus Ostermann and Mira Mezini and
Christoph Bockisch, Proceedings of the European Conference on Object-Oriented
Programming (ECOOP)
• Modularizing Crosscuts in an E-commerce Application in Lisp using HALO , Charlotte
Herzeel, Kris Gybels, Pascal Costanza, Theo D'Hondt , International Lisp Conference 2007
• Escaping with future variables in HALO , Charlotte Herzeel, Kris Gybels, Pascal Costanza,
Proceedings of the Runtime Verification Workshop 2007
<instance>
Text
Code
meta
base
titles
highlight
class
T customer
event
Text
Text
!
Text
box
Title
<instance>
Text
Code
meta
base
titles
highlight
class
T customer
event
Text
Text
!
Text
box
Title

More Related Content

PDF
Helvetia
PDF
Gemstone Notifications
PDF
Google Summer of Code & Summertalk
PDF
AIDA/Scribo
PDF
Migration from VSE to VW with Pollock
PDF
Promoting Smalltalk
PDF
Vg 2007 catalog 11 20
PDF
Vg 2007 catalog 90 99
Helvetia
Gemstone Notifications
Google Summer of Code & Summertalk
AIDA/Scribo
Migration from VSE to VW with Pollock
Promoting Smalltalk
Vg 2007 catalog 11 20
Vg 2007 catalog 90 99

Similar to Forward Chaining in HALO (20)

PDF
GoshawkDB: Making Time with Vector Clocks
PDF
Why async and functional programming in PHP7 suck and how to get overr it?
PPTX
Aspect Oriented Programming
PDF
CQRS and Event Sourcing
PDF
consistency without borders
PDF
What could possibly go wrong
PDF
durability, durability, durability
ODP
Hybrid rule engines (rulesfest 2010)
PDF
Fraud Detection and Neo4j
PPTX
Aspect Oriented Programming - AOP/AOSD
PDF
Accelerating OpenERP accounting: Precalculated period sums
PDF
PHPCon 2016: PHP7 by Witek Adamus / XSolve
PDF
Modeling Aspects with AP&P Components
ODP
Objects arent records with byte codes on the side
PPTX
Distributed System Security Aspects
PDF
Rubyslava slides-26.09.2013
PDF
NoSQL Rollercoaster
PDF
Real-world consistency explained
PPTX
Basics of Distributed Systems - Distributed Storage
PDF
Aspect Oriented Development
GoshawkDB: Making Time with Vector Clocks
Why async and functional programming in PHP7 suck and how to get overr it?
Aspect Oriented Programming
CQRS and Event Sourcing
consistency without borders
What could possibly go wrong
durability, durability, durability
Hybrid rule engines (rulesfest 2010)
Fraud Detection and Neo4j
Aspect Oriented Programming - AOP/AOSD
Accelerating OpenERP accounting: Precalculated period sums
PHPCon 2016: PHP7 by Witek Adamus / XSolve
Modeling Aspects with AP&P Components
Objects arent records with byte codes on the side
Distributed System Security Aspects
Rubyslava slides-26.09.2013
NoSQL Rollercoaster
Real-world consistency explained
Basics of Distributed Systems - Distributed Storage
Aspect Oriented Development
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Tartificialntelligence_presentation.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPT
What is a Computer? Input Devices /output devices
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Unlock new opportunities with location data.pdf
PPTX
Chapter 5: Probability Theory and Statistics
NewMind AI Weekly Chronicles – August ’25 Week III
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Zenith AI: Advanced Artificial Intelligence
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
CloudStack 4.21: First Look Webinar slides
Assigned Numbers - 2025 - Bluetooth® Document
Tartificialntelligence_presentation.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Group 1 Presentation -Planning and Decision Making .pptx
Developing a website for English-speaking practice to English as a foreign la...
A comparative study of natural language inference in Swahili using monolingua...
Benefits of Physical activity for teenagers.pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
What is a Computer? Input Devices /output devices
1 - Historical Antecedents, Social Consideration.pdf
Unlock new opportunities with location data.pdf
Chapter 5: Probability Theory and Statistics

Forward Chaining in HALO

  • 1. Forward Chaining in HALO An Implementation Strategy for History-based Logic Pointcuts @International Conference On Dynamic Languages 2007, Lugano, August 27th, 2007 Charlotte Herzeel, Kris Gybels, Pascal Costanza, Coen De Roover and Theo D’hondt Programming Technology Laboratory Vrije Universiteit Brussel
  • 2. Overview • Introduction • Logic Meta Programming & Aspect-Oriented Programming • Running example - going shopping • History-based Aspects using LOgic: • Aspect-Oriented Programming for Lisp • meta model = the program execution • hybrid language (temporal logic programming/CLOS) • Implementing HALO • HALO weaver Architecture • Query Engine based on RETE • Reducing Memory Overhead
  • 4. Scattering & tangling Tyranny of the dominant decomposition
  • 5. Scattering & tangling Tyranny of the dominant decomposition tangling & scattering -- maintainability -- reusability -- readability !
  • 6. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) tangling & scattering -- maintainability -- reusability -- readability !
  • 7. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) tangling & scattering -- maintainability -- reusability -- readability !
  • 8. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability !
  • 9. CLOS: before, after, around Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability !
  • 10. CLOS: before, after, around Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! (defmethod shareAccount :around ((c client), (a account)) (log “sharing account ~s ~s” c a) (call-next-method)) (defmethod withdraw :around ((c client), (i integer)) ...) (defmethod credit :around ((c client), (i integer)) ...)
  • 11. CLOS: before, after, around Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability !
  • 12. CLOS: before, after, around Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming
  • 13. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming
  • 14. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming “at each sensitive method call,
  • 15. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming make a log entry” “at each sensitive method call,
  • 16. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming pointcut make a log entry” “at each sensitive method call,
  • 17. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call,
  • 18. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call, (defmethod shareAccount :around ((c client), (a account)) (log “sharing account ~s ~s” c a) (call-next-method)) (defmethod withdraw :around ((c client), (i integer)) ...) (defmethod credit :around ((c client), (i integer)) ...)
  • 19. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call,
  • 20. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! ?macros Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call,
  • 21. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! -- current join point only ?macros Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call,
  • 22. CLOS: before, after, around Aspect Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability ! -- current join point only ?macros ! history of join points Aspect-Oriented Programming pointcut make a log entry” advice “at each sensitive method call,
  • 23. Declarative Meta Programming & Aspect-Oriented Programming base)
  • 24. Declarative Meta Programming & Aspect-Oriented Programming (base base)
  • 25. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base))
  • 26. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language meta model MP
  • 27. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 28. Declarative Meta Programming & Aspect-Oriented Programming SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 29. Declarative Meta Programming & Aspect-Oriented Programming (defclass account () ((balance))) (defclass client () ((id))) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 30. Declarative Meta Programming & Aspect-Oriented Programming (defclass account () ((balance))) (defclass client () ((id))) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 31. Declarative Meta Programming & Aspect-Oriented Programming (defclass account () ((balance))) (defclass client () ((id))) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) method(<account>, <withdraw>) methodName(<withdraw>, withdraw) methodArguments(<withdraw>, ()) methodStatements(<withdraw>, ((setf (balance a) (- (balance a) nr)))) ... SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 32. Declarative Meta Programming & Aspect-Oriented Programming (defclass account () ((balance))) (defclass client () ((id))) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) method(<account>, <withdraw>) methodName(<withdraw>, withdraw) methodArguments(<withdraw>, ()) methodStatements(<withdraw>, ((setf (balance a) (- (balance a) nr)))) ... abstractClassHeuristic() if forall(abstractClass(?C),baseClass(?C)), forall(baseClass(?C),abstractClass(?C)). SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 33. Declarative Meta Programming & Aspect-Oriented Programming (defclass account () ((balance))) (defclass client () ((id))) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) method(<account>, <withdraw>) methodName(<withdraw>, withdraw) methodArguments(<withdraw>, ()) methodStatements(<withdraw>, ((setf (balance a) (- (balance a) nr)))) ... abstractClassHeuristic() if forall(abstractClass(?C),baseClass(?C)), forall(baseClass(?C),abstractClass(?C)). SOUL for DMP: Base code to facts -> Image querying Symbiosis (quasiquoting) Rule abstraction (Libraries) Generating code Detecting/Verifying coding patterns (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model compute
  • 34. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model
  • 35. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts
  • 36. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts
  • 37. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts
  • 38. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts
  • 39. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts carma pointcut
  • 40. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model rule abstraction, unification, recursion class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts carma pointcut
  • 41. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model rule abstraction, unification, recursion class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) reusability, reasoning CARMA: AOP with a SOUL modularizing scattered & tangled code Join point type predicates Link to shadows Symbiosis Loose coupling aspect/base Pattern-based pointcuts carma pointcut
  • 42. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model rule abstraction, unification, recursion class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) reusability, reasoning
  • 43. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model rule abstraction, unification, recursion class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) reusability, reasoning HALO: AOP with a memory Temporal/Stateful pointcuts
  • 44. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language pointcut language meta model base language MP AOP jp model rule abstraction, unification, recursion class( account , <account>) classImplementsMethodNamed (<account> , withdraw, <withdraw>) send(<jp>, withdraw, [<account>]) assignment(<jp>, balance, 10, 7) reference(<jp2>, balance, 7) 1. 2. (defclass account () ...) (defmethod withdraw ((a account) nr) (setf (balance a) (- (balance a) nr))) (defmethod credit ((a account) nr) ...) (withdraw *account* 3) (print (get-value *account* balance)) reusability, reasoning HALO: AOP with a memory Temporal/Stateful pointcuts record
  • 62. Mental Model fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) jp facts
  • 63. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts
  • 64. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res
  • 65. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res Extensible ... (defrule (promotion “25-12-2008”))
  • 66. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time)))
  • 67. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time)))
  • 68. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time))) Ad-hoc context-exposure
  • 69. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>)
  • 70. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer
  • 71. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer 1.
  • 72. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login 1.
  • 73. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login 2. 1.
  • 74. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buy 2. 1.
  • 75. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buy 2. 3. 1.
  • 76. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer logoutlogin buy 2. 3. 1.
  • 77. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer logoutlogin buy 2. 3. 4. 1.
  • 78. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer loginlogoutlogin buy 2. 3. 4. 1.
  • 79. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer loginlogoutlogin buy 2. 3. 4. 1. 5.
  • 80. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buylogoutlogin buy 2. 3. 4. 1. 5.
  • 81. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buylogoutlogin buy 2. 3. 4. 1. 5. 6.
  • 82. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buy buylogoutlogin buy 2. 3. 4. 1. 5. 6.
  • 83. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buy buylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 84. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 85. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 86. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 87. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 88. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 89. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 90. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 91. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 92. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 93. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy 2. 3. 4. 1. 5. 6. 7.
  • 94. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin 2. 3. 4. 1. 5. 6. 7.
  • 95. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) 2. 3. 4. 1. 5. 6. 7.
  • 96. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) 2. 3. 4. 1. 5. 6. 7.
  • 97. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) 2. 3. 4. 1. 5. 6. 7.
  • 98. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) 2. 3. 4. 1. 5. 6. 7.
  • 99. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) 2. 3. 4. 1. 5. 6. 7.
  • 100. Temporal Matching (login <shop> <kris> kris kros ) (buy <kris> <jacket>) (logout <kris>) (login <shop> <kris> kris kros ) (buy <kris> <t-shirt>) (buy <kris> <socks>) (checkout <kris>) ((gf-call checkout ?args) (all-past (gf-call buy ?args2))) ((gf-call checkout ?args) (most-recent (gf-call buy ?args2))) T customer login buy buy checkoutbuy logoutlogin T customer login buy checkoutbuylogoutlogin buy T customer login buy buy checkoutbuy logoutlogin ((gf-call checkout ?args) (since (most-recent (gf-call login ?args2)) (all-past (gf-call buy ?args3) Stateful context-exposure 2. 3. 4. 1. 5. 6. 7.
  • 101. Stateful context-exposure (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>)))
  • 102. Stateful context-exposure (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) T <kris>
  • 103. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) T <kris>
  • 104. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 1. T <kris>
  • 105. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 1. T <kris>
  • 106. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 1. T <kris>
  • 107. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 1. T <kris> login
  • 108. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. T <kris> login
  • 109. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. T <kris> login buy
  • 110. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. T <kris> login buy
  • 111. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> login buy
  • 112. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 113. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 114. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 115. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 116. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 117. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 118. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (defrule (rate-for ?rate ?article) (escape ?promo (singleton-instance promotions) (escape ?rate (discount-rate-for ?promo ?article))) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 119. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 120. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 121. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy
  • 122. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>”
  • 123. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>”
  • 124. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>”
  • 125. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>”
  • 126. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>”
  • 127. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>”
  • 128. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>”
  • 129. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>” <kris> gets a 0.05% discount on <cd>
  • 130. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>” <kris> gets a 0.05% discount on <cd>
  • 131. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>” <kris> gets a 0.05% discount on <cd> <kris> gets a 0.00% discount on <cd>
  • 132. Stateful context-exposure (at ((gf-call buy ?user ?article) (most-recent (gf-call login ?user _ _ _) (rate-for ?rate ?article))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (at ((gf-call buy ?user ?article) (rate-for ?rate ?article) (most-recent (gf-call login ?user _ _ _))) (format t ~s gets a ~s % discount on ~s ?user ?rate ?article)) (let ((promo (singleton-instance promotions))) (setf (rate-for promo) <cd> 0.05) (login <kris> <shop> kris kros ) (buy <kris> <cd>) (setf (rate-for promo) <cd> 0.00) (buy <kris> <cd>))) 2. 3. 4. 1. 5. 6. T <kris> buylogin buy “<kris> gets a 0.05% discount on <cd>” “<kris> gets a 0.05% discount on <cd>” <kris> gets a 0.05% discount on <cd> <kris> gets a 0.00% discount on <cd> Stateful context-exposure
  • 133. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 134. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 135. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * by wrapping class & generic function protocols in CLOS MOP * explicit meta class tagging
  • 136. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 137. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 138. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * extension of RETE forward chaining, supporting temporal operators + hybrid pointcuts * copy semantics through static analysis
  • 139. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 140. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  • 141. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * reducing the join point history dynamically * gbc in RETE based on semantics of temporal operators * results presented @ RV 2007
  • 142. Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate))
  • 143. Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate)query engine
  • 144. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 145. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 146. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 147. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 148. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 149. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 150. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 151. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 152. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 153. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 154. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 155. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 156. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 157. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  • 158. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine ’’On every checkout, give a discount based on the rate at login time’’
  • 159. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) ’’On every checkout, give a discount based on the rate at login time’’
  • 160. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) 1. ’’On every checkout, give a discount based on the rate at login time’’
  • 161. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 162. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 163. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 164. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 165. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 166. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 167. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  • 168. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 169. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 170. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 171. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 172. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 173. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 174. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 175. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  • 176. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. 3. ’’On every checkout, give a discount based on the rate at login time’’
  • 177. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. ’’On every checkout, give a discount based on the rate at login time’’
  • 178. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. ’’On every checkout, give a discount based on the rate at login time’’
  • 179. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 180. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 181. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 182. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 183. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 184. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 185. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 186. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 187. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  • 188. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  • 189. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  • 190. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  • 191. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  • 192. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  • 193. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  • 194. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  • 195. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  • 196. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  • 197. ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  • 198. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  • 199. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (discount <kris> 0.00) ) (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  • 200. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (discount <kris> 0.00) ) (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  • 201. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) ’’On every checkout, give a discount based on the rate at login time’’
  • 202. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 203. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 204. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 205. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 206. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 207. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 208. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 209. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 210. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 211. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 212. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 213. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 214. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  • 215. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1.
  • 216. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 217. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 218. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 219. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 220. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 221. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 222. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. (1 gf-call set-rate <shop> 0.05)
  • 223. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05)
  • 224. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>)
  • 225. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>)
  • 226. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>)
  • 227. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>)
  • 228. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>)
  • 229. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (2 gf-call login <kris> <shop>)
  • 230. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 231. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 232. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 233. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 234. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 235. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 236. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 237. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) )
  • 238. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) ) (5 gf-call checkout <kris>)
  • 239. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) ) (5 gf-call checkout <kris>)
  • 240. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) ) (5 gf-call checkout <kris>) (discount <kris> 0.05) )
  • 241. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward ChainingStateful ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) ) (5 gf-call checkout <kris>) (discount <kris> 0.05) )
  • 242. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward ChainingStateful ’’On every checkout, give a discount based on the rate at login time’’ 1. 2. 3. 4. 5. (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) (4 gf-call set-rate <shop> 0.00) (2 gf-call login <kris> <shop>) (escape 0.05 (current-rate <shop>)) ) (5 gf-call checkout <kris>) (discount <kris> 0.05) ) Temporal Extensions Escape Extension
  • 243. Reducing Memory Overhead (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) most-recent ?(discount ?user ?rate) escape T1 ?user T2 ?user ?shop T2 ?rate ?user ?shop T1 ?rate ?user ?shop (login *kris* *shop*) (buy *kris* *cd*) (checkout *kris*) (login *kris* *shop*) (buy *kris* *dvd*) (checkout *kris*) Code
  • 244. Reducing Memory Overhead (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) most-recent ?(discount ?user ?rate) escape T1 ?user T2 ?user ?shop T2 ?rate ?user ?shop T1 ?rate ?user ?shop (login *kris* *shop*) (buy *kris* *cd*) (checkout *kris*) (login *kris* *shop*) (buy *kris* *dvd*) (checkout *kris*) 1 <kris> <shop> 3 <kris> 4 <kris> <shop>0.05 3 <kris> <shop>0.05 6 <kris> <shop>0.05 4 <kris> <shop> 1 <kris> <shop>0.05 6 <kris> Code
  • 245. Reducing Memory Overhead (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) most-recent ?(discount ?user ?rate) escape T1 ?user T2 ?user ?shop T2 ?rate ?user ?shop T1 ?rate ?user ?shop (login *kris* *shop*) (buy *kris* *cd*) (checkout *kris*) (login *kris* *shop*) (buy *kris* *dvd*) (checkout *kris*) 1 <kris> <shop> 3 <kris> 4 <kris> <shop>0.05 3 <kris> <shop>0.05 6 <kris> <shop>0.05 4 <kris> <shop> 1 <kris> <shop>0.05 6 <kris> Code LT [1,1] [4,4] LT [1,4] [4,..] LT [3,3] [6,6] LT [3,3] [6,6]
  • 246. DEMO
  • 247. 0 2,000 4,000 6,000 8,000 S3 copy S3 non copy S2 copy S2 non copy S1 copy S1 non copy nr of memory table entries still allocated total nr of memory table entries ever made nr of generated join point facts Reducing Memory Overhead (2) Escaping with future variables in HALO Charlotte Herzeel, Kris Gybels, Pascal Costanza In "Proc. of the Runtime Verification Workshop", 2007 Modularizing crosscuts in an e-commerce application in Lisp using HALO Charlotte Herzeel, Kris Gybels, Pascal Costanza, Theo D’Hondt In "Proc. of the International Lisp Conference", 2007
  • 248. 0 2,000 4,000 6,000 8,000 S3 copy S3 non copy S2 copy S2 non copy S1 copy S1 non copy nr of memory table entries still allocated total nr of memory table entries ever made nr of generated join point facts Reducing Memory Overhead (2) It helps! Escaping with future variables in HALO Charlotte Herzeel, Kris Gybels, Pascal Costanza In "Proc. of the Runtime Verification Workshop", 2007 Modularizing crosscuts in an e-commerce application in Lisp using HALO Charlotte Herzeel, Kris Gybels, Pascal Costanza, Theo D’Hondt In "Proc. of the International Lisp Conference", 2007
  • 249. Summary & Future Work • Summary: • history-based AOP for CLOS ; stateful pointcuts • temporal logic-based: abstraction & logic variables • Rete forward chaining-based implementation • memory reduction • Future Work: • language design: • exploit logic-programming (i.e. unification & recursion) • exploit temporal logic-programming (mixing temporal logic/advice code) • before/after ... what about around? (roll-back mechanism) • reducing memory overhead: • shadow weaving
  • 250. Summary & Future Work • Summary: • history-based AOP for CLOS ; stateful pointcuts • temporal logic-based: abstraction & logic variables • Rete forward chaining-based implementation • memory reduction • Future Work: • language design: • exploit logic-programming (i.e. unification & recursion) • exploit temporal logic-programming (mixing temporal logic/advice code) • before/after ... what about around? (roll-back mechanism) • reducing memory overhead: • shadow weaving Thanks for listening! Questions?
  • 251. Summary & Future Work • Summary: • history-based AOP for CLOS ; stateful pointcuts • temporal logic-based: abstraction & logic variables • Rete forward chaining-based implementation • memory reduction • Future Work: • language design: • exploit logic-programming (i.e. unification & recursion) • exploit temporal logic-programming (mixing temporal logic/advice code) • before/after ... what about around? (roll-back mechanism) • reducing memory overhead: • shadow weaving Thanks for listening! Questions? http://prog.vub.ac.be/HALO
  • 252. References • Supporting Software Development Through Declaratively Codified Programming Patterns, Kim Mens, Isabel Michiels, Roel Wuyts In "Journal on Expert Systems with Applications, Elsevier Publications, pages 405-413, number 4, Volume 23, November", 2002 • Arranging language features for more robust pattern-based crosscuts Kris Gybels, Johan Brichau, In "Proceedings of the Second International Conference on Aspect- Oriented Software Development", 2003 • Seamless Integration of Rule-Based Knowledge and Object-Oriented Functionality with Linguistic Symbiosis, Maja D'Hondt, Kris Gybels, Viviane Jonckers, In "Proceedings of the 19th Annual ACM Symposium on Applied Computing (SAC 2004), Special Track on Object-Oriented Programming, Languages and Systems. Nicosia, Cyprus. ACM. March 2004.", 2004 • Context-aware Aspects, Eric Tanter, Kris Gybels, Marcus Denker, Alexandre Bergel, Proceedings of the 5th International Symposium on Software Composition (SC 2006), LNCS 4089, pp.227-249, Springer-Verlag, March 2006, Vienna, Austria • Expressive Pointcuts for Increased Modularity, Klaus Ostermann and Mira Mezini and Christoph Bockisch, Proceedings of the European Conference on Object-Oriented Programming (ECOOP) • Modularizing Crosscuts in an E-commerce Application in Lisp using HALO , Charlotte Herzeel, Kris Gybels, Pascal Costanza, Theo D'Hondt , International Lisp Conference 2007 • Escaping with future variables in HALO , Charlotte Herzeel, Kris Gybels, Pascal Costanza, Proceedings of the Runtime Verification Workshop 2007