如:?speed ?sensor ?noun ?color (问号的标识字段之间没有空格)
说明:在规则的LHS上可使用变量保存槽值,这些槽值可与规则的LHS上的其它值想比较,或者可以在规则的RHS上访问这些槽值。
例如:
(deftemplate person
(slot name)
(slot eyes)
(slot hair))
(deffacts people
(person (name jane) (eyes blue) (hair red))
(person (name jack) (eyes blue) (hair black)))
(defrule find-blue-syss
person (name ?name) (eyes blue)
=>
(printout t ?name”has blue eyes.” crlf))
运行结果:jack has blue eyes.
jane has blue eyes.