in the Basic Programmers Guide, you write about the way, an OR-condition is handled. An OR-condition will be translated to several new rules and thereby, the OR-condition itself will be replaced by one of the conditions inside the OR. Okay, i understand, why that work in simple cases. But, when my OR-condition is nested e.g. in a NOT-condition, like here:
If an or CE immediately follows a not CE, then the not/or CE combination is replaced with an
and/not CE combination where each of the CEs contained in the original or CE is enclosed
within a not CE and then all of the not CEs are enclosed within a single and CE. For example,
the following rule
(defrule example
(a ?x)
(not (or (b ?x)
(c ?x)))
=>)
would be changed as follows.
(defrule example
(a ?x)
(and (not (b ?x))
(not (c ?x)))
=>)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
in the Basic Programmers Guide, you write about the way, an OR-condition is handled. An OR-condition will be translated to several new rules and thereby, the OR-condition itself will be replaced by one of the conditions inside the OR. Okay, i understand, why that work in simple cases. But, when my OR-condition is nested e.g. in a NOT-condition, like here:
CLIPS> (deftemplate wurst (slot name) (slot gewicht) )
CLIPS> (assert (wurst (name "bockwurst") (gewicht 100) ))
<Fact-0>
CLIPS> (assert (wurst (name "bratwurst") (gewicht 200) ))
<Fact-1>
CLIPS> (assert (wurst (name "grillwurst") (gewicht 300) ))
<Fact-2>
CLIPS> (defrule rarara
(not
(or
(wurst (name "hanswurst"))
(wurst (gewicht 200))
)
)
=>
(printout t "fofo" crlf)
)
it is not as simple as that, is it? how is an OR-condition handled in this and in similar cases?
Thank you,
Josef Hahn
From the Basic Programming Guide:
5.4.9.4 Or CEs Following Not CEs
If an or CE immediately follows a not CE, then the not/or CE combination is replaced with an
and/not CE combination where each of the CEs contained in the original or CE is enclosed
within a not CE and then all of the not CEs are enclosed within a single and CE. For example,
the following rule
(defrule example
(a ?x)
(not (or (b ?x)
(c ?x)))
=>)
would be changed as follows.
(defrule example
(a ?x)
(and (not (b ?x))
(not (c ?x)))
=>)