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

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -