Forward Chaining in HALO

612 views

Published on

Forward Chaining in HALO
An Implementation Strategy for History-based Logic Pointcuts.
Charlotte Herzeel, Kris Gybels, Pascal Costanza, Coen De Roover and Theo D’hondt.

ESUG 2007, Lugano

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
612
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Forward Chaining in HALO

  1. 1. Forward Chaining in HALO An Implementation Strategy for History-based Logic Pointcuts @International Conference On Dynamic Languages 2007, Lugano, August 27th, 2007 Charlotte Herzeel, Kris Gybels, Pascal Costanza, Coen De Roover and Theo D’hondt Programming Technology Laboratory Vrije Universiteit Brussel
  2. 2. Overview • Introduction • Logic Meta Programming & Aspect-Oriented Programming • Running example - going shopping • History-based Aspects using LOgic: • Aspect-Oriented Programming for Lisp • meta model = the program execution • hybrid language (temporal logic programming/CLOS) • Implementing HALO • HALO weaver Architecture • Query Engine based on RETE • Reducing Memory Overhead
  3. 3. Scattering & tangling
  4. 4. Scattering & tangling Tyranny of the dominant decomposition
  5. 5. Scattering & tangling Tyranny of the dominant decomposition tangling & scattering -- maintainability -- reusability -- readability !
  6. 6. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) tangling & scattering -- maintainability -- reusability -- readability !
  7. 7. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) tangling & scattering -- maintainability -- reusability -- readability !
  8. 8. Scattering & tangling Tyranny of the dominant decomposition Bank Client Account withdraw(AccountNr, Integer) credit(AccountNr, Integer) view(AccountNr) 1 * * * register(Client) createAccount(Client) shareAccount(Client, Account) login(Client) logout(Client) withdraw(Client, Integer) credit(Client, Integer) transfer(Client, Account) view(Client) log sensitive operations = crosscutting concern tangling & scattering -- maintainability -- reusability -- readability !
  9. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 23. Declarative Meta Programming & Aspect-Oriented Programming base)
  24. 24. Declarative Meta Programming & Aspect-Oriented Programming (base base)
  25. 25. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base))
  26. 26. Declarative Meta Programming & Aspect-Oriented Programming (base base)(meta base)) meta language object language meta model MP
  27. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 45. VISAMasterCardMasterCard Boutique Clothing Running example
  46. 46. VISAMasterCardMasterCard Boutique Clothing Running example
  47. 47. VISAMasterCardMasterCard Boutique Clothing Running example
  48. 48. VISAMasterCardMasterCard Boutique Clothing Running example
  49. 49. VISAMasterCardMasterCard Boutique Clothing -10% Running example
  50. 50. VISAMasterCardMasterCard Boutique Clothing -10% Running example
  51. 51. VISAMasterCardMasterCard Boutique Clothing -10% Running example
  52. 52. VISAMasterCardMasterCard Boutique Clothing -10% Running example
  53. 53. VISAMasterCardMasterCard Boutique Clothing Running example
  54. 54. VISAMasterCardMasterCard Boutique Clothing Running example
  55. 55. VISAMasterCardMasterCard Boutique Clothing Running example
  56. 56. VISAMasterCardMasterCard $ Boutique Clothing Running example
  57. 57. VISAMasterCardMasterCard $ Boutique Clothing Running example
  58. 58. 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
  59. 59. 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
  60. 60. 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
  61. 61. 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!!
  62. 62. Mental Model fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) jp facts
  63. 63. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts
  64. 64. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res
  65. 65. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res Extensible ... (defrule (promotion “25-12-2008”))
  66. 66. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time)))
  67. 67. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time)))
  68. 68. Join Point Model (make-instance user) (create user <kris>) (checkout <kris>) (gf-call checkout <kris>) (end-gf-call checkout <kris> nil) (get-value <kris> name) (slot-get <kris> name kris ) (setf (get-value <kris> name) kris ) (slot-set <kris> name kris ) CLOS Join Point Facts Hybrid Pointcuts ?obj Join Point Type Predicates ?obj ?name ?val ?oval?obj ?name ?val ?obj?gf-name ?gf-name ?obj ?res (escape ?name (password ?user)) Extensible ... (defrule (promotion “25-12-2008”)) (defrule (date ?date) (escape ?date (get-current-time))) Ad-hoc context-exposure
  69. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 133. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  134. 134. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  135. 135. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * by wrapping class & generic function protocols in CLOS MOP * explicit meta class tagging
  136. 136. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  137. 137. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  138. 138. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * extension of RETE forward chaining, supporting temporal operators + hybrid pointcuts * copy semantics through static analysis
  139. 139. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  140. 140. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base
  141. 141. Weaver Implementation fact generator query engine jp ctr (defclass user () ((name)) (defmethod checkout ((u user)) ...) (defmethod buy ((u user) (a article)) ...) base most-recent, all-past, since, cflow temporal relations (at ((gf-call checkout ?u) (most-recent (buy ?u ?a))) (log user ~s bought ~s ?u ?a)) aspect (defrule (buy ?u) (gf-call buy ?u ?a)) rules TN: (gf-call checkout <user>) TN-1: (gf-call buy <user> <cd>) fact base * reducing the join point history dynamically * gbc in RETE based on semantics of temporal operators * results presented @ RV 2007
  142. 142. Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate))
  143. 143. Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate)query engine
  144. 144. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  145. 145. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  146. 146. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  147. 147. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  148. 148. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  149. 149. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  150. 150. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  151. 151. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  152. 152. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  153. 153. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  154. 154. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  155. 155. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  156. 156. Backward Chaining Backward Chaining vs Rete Forward Chaining (at ((gf-call checkout (?user)) (most-recent (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)))) (discount ?user ?rate)) (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  157. 157. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine
  158. 158. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine ’’On every checkout, give a discount based on the rate at login time’’
  159. 159. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) ’’On every checkout, give a discount based on the rate at login time’’
  160. 160. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) 1. ’’On every checkout, give a discount based on the rate at login time’’
  161. 161. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  162. 162. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  163. 163. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  164. 164. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  165. 165. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  166. 166. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  167. 167. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. ’’On every checkout, give a discount based on the rate at login time’’
  168. 168. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05)1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  169. 169. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  170. 170. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  171. 171. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  172. 172. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  173. 173. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  174. 174. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  175. 175. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. ’’On every checkout, give a discount based on the rate at login time’’
  176. 176. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) 1. 2. 3. ’’On every checkout, give a discount based on the rate at login time’’
  177. 177. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. ’’On every checkout, give a discount based on the rate at login time’’
  178. 178. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. ’’On every checkout, give a discount based on the rate at login time’’
  179. 179. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  180. 180. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  181. 181. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  182. 182. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  183. 183. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  184. 184. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  185. 185. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  186. 186. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  187. 187. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) ’’On every checkout, give a discount based on the rate at login time’’
  188. 188. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  189. 189. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  190. 190. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  191. 191. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  192. 192. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) ’’On every checkout, give a discount based on the rate at login time’’
  193. 193. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  194. 194. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  195. 195. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) ’’On every checkout, give a discount based on the rate at login time’’
  196. 196. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  197. 197. ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  198. 198. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  199. 199. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (discount <kris> 0.00) ) (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  200. 200. ) ) Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) (1 gf-call set-rate <shop> 0.05) (2 gf-call login <kris> <shop>) (3 gf-call buy <kris> <cd>) (5 gf-call checkout <kris>) 1. 2. 3. 4. 5. (discount <kris> 0.00) ) (4 gf-call set-rate <shop> 0.00) (5 gf-call checkout <kris>) (2 gf-call login <kris> <shop>) (escape 0.00 (current-rate <shop>)) ) ’’On every checkout, give a discount based on the rate at login time’’
  201. 201. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) ’’On every checkout, give a discount based on the rate at login time’’
  202. 202. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  203. 203. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  204. 204. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  205. 205. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  206. 206. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  207. 207. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  208. 208. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’
  209. 209. Backward Chaining Backward Chaining vs Rete Forward Chaining (gf-call checkout (?user)) (gf-call login ?user ?shop) (escape ?rate (current-rate ?shop)) and most-recent ?(discount ?user ?rate) ! query engine (set-rate *shop* 0.05) (login *kris* *shop*) (buy *kris* *cd*) (set-rate *shop* 0.00) (checkout *kris*) Rete Forward Chaining ’’On every checkout, give a discount based on the rate at login time’’

×