expert system - How to use not condition in CLIPS programming language properly? -
here code
(deffacts startup (bird canary) (colour-canary yellow) (bird ostrich) (can-not-fly ostrich) ) (defrule r-bird-test (bird ?var) (not (bird ostrich)) => (printout t ?var " ****" crlf) ) now, when (reset) , (run) doesn't print "canary ****". not using not condition properly? can point out missing here? thanks.
as written not conditional element prevents rule executing if fact (bird ostrich) present. since fact present once perform (reset), rule not execute. if want rule execute each bird fact ?var not ostrich, need write rule way:
clips> (deffacts startup (bird canary) (colour-canary yellow) (bird ostrich) (can-not-fly ostrich)) clips> (defrule r-bird-test (bird ?var&~ostrich) => (printout t ?var " ****" crlf)) clips> (reset) clips> (run) canary **** clips>
Comments
Post a Comment