Member$ application in clips



这是我面临的问题:根据jdbc的类型,编写一个规则来规定当jdbc处于LTB或LTH中时应该做什么。使用成员$

初始化:

(defrule to-do
(declare (salience -20))
(bus (id-jdb ?bus)(type ?type))
(LTB (id-jdb ?ltb))
(LTH (id-jdb ?lth))
(test (member$ ?id-jdb ?bus))
=>
(printout t " the JDB is " crlf))`

我不知道如何应用member$,使它返回LTB或LTH。

如果?bus包含jdbc的类型,您可以这样做:

(defrule to-do
(declare (salience -20))
(bus (id-jdb ?bus) (type ?type))
(LTB (id-jdb ?ltb))
(LTH (id-jdb ?lth))
(test (member$ ?bus (create$ LTB LTH)))
=>
(printout t " the JDB is " crlf))

或者,您可以这样做:

(defrule to-do
(declare (salience -20))
(bus (id-jdb ?bus&LTB|LTH) (type ?type))
(LTB (id-jdb ?ltb))
(LTH (id-jdb ?lth))
=>
(printout t " the JDB is " crlf))

最新更新