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

Forward Chaining in HALO

  • 1.
    Forward Chaining inHALO 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 • LogicMeta 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
  • 3.
  • 4.
    Scattering & tangling Tyrannyof the dominant decomposition
  • 5.
    Scattering & tangling Tyrannyof the dominant decomposition tangling & scattering -- maintainability -- reusability -- readability !
  • 6.
    Scattering & tangling Tyrannyof 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 Tyrannyof 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 Tyrannyof 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
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
    Mental Model fact generator query engine jpctr (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-instanceuser) (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-instanceuser) (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-instanceuser) (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-instanceuser) (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-instanceuser) (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-instanceuser) (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 jpctr (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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 Chainingvs 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 Chainingvs 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 Chainingvs 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 Chainingvs 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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 vsRete 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.
  • 247.
    0 2,000 4,0006,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,0006,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 & FutureWork • 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 & FutureWork • 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 & FutureWork • 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 SoftwareDevelopment 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
  • 253.
  • 254.