(deftemplate shrub "Shrub information" (slot name) (multislot characteristics)) (deftemplate char "Shrub characteristic" (slot name) (slot value)) (deftemplate desired-char "Location characteristic" (slot name) (slot value)) (deffacts init "Set things up" (shrub (name oleander)) (char (name pot) (value TRUE)) (char (name city) (value FALSE)) (desired-char (name pot) (value TRUE))) (defrule bind-chars "Connect characteristics to a shrub" ?sf <- (shrub (name oleander)) ?c1 <- (char (name pot)) ?c2 <- (char (name city)) => (modify ?sf (characteristics ?c1 ?c2))) (defrule check-char (desired-char (name ?cn) (value ?v)) (shrub (name ?sn) (characteristics $? ?c $?)) (test (and (eq (fact-slot-value ?c name) ?cn) (eq (fact-slot-value ?c value) ?v))) => (printout t "Found that shrub " ?sh " meets desired characteristic " ?cn))