不使用 declare salience 执行订单规则

Order rules execution without using declare salience

那就是问题所在,假设我有 2 条规则。第二条规则依赖于第一条规则。 例如:

 (deftemplate person 
(slot name (type STRING))
(slot age (type STRING))
)

(deffacts start
 (person(name "Mike")(age "20"))
 (person(name "Laura")(age "22"))
 (person(name "Dean")(age "22"))
 (person(name "Charlie")(age "22"))
 )

 (defrule filterage
 (person (name ?n)(age ?a))
 (test (eq ?a "22"))
 =>
 (assert (is-equal-to-22 ?n))
 )

 (defrule creategroup
 (is-equal-to-22 ?c)
 =>
 (assert (is-in-22-years-old-group ?c))
 )

正如预期的那样,只要有来自规则 1 的内容,第二条规则就会触发。

那么,我怎样才能让第二条规则等到所有人都被创建,而不使用 declare salience

         CLIPS (6.31 2/3/18)
CLIPS> (defmodule MAIN (export ?ALL))
CLIPS> (defmodule FILTER (import MAIN ?ALL))
CLIPS> (defmodule CREATE (import MAIN ?ALL))
CLIPS> 
(deftemplate MAIN::av ; attribute value
  (slot a)
  (slot v))
CLIPS>   
(deftemplate MAIN::person 
  (slot name)
  (slot age))
CLIPS> 
(deffacts MAIN::start
  (person (name "Mike") (age 20))
  (person (name "Laura") (age 22))
  (person (name "Dean") (age 22))
  (person (name "Charlie") (age 22)))
CLIPS>   
(defrule MAIN::start
  =>
  (focus FILTER CREATE))
CLIPS> 
(defrule FILTER::filterage
  (person (name ?n) (age 22))
  =>
  (assert (av (a is-equal-to-22) (v ?n))))
CLIPS> 
(defrule CREATE::creategroup
  (av (a is-equal-to-22) (v ?c))
  =>
  (assert (av (a is-in-22-years-old-group) (v ?c))))
CLIPS> (watch rules)
CLIPS> (reset)
CLIPS> (run)  
FIRE    1 start: *
FIRE    2 filterage: f-4
FIRE    3 filterage: f-3
FIRE    4 filterage: f-2
FIRE    5 creategroup: f-7
FIRE    6 creategroup: f-6
FIRE    7 creategroup: f-5
CLIPS>