Reputation: 3221
I read that
CLIPS also gives you the capability of specifying an explicit not conditional element on the LHS. The absence of a fact is specified as a pattern on the LHS using the “not” conditional element.
Yet, the below code gives me a [PRNTUTIL2] Syntax Error: Check appropriate syntax for the not conditional element.
(not
(object (is-a clips_ASDF)
(name ?some_name)
(property ?my_property_var))
(test (eq ?my_property_var nil)))
This however does not cause an error:
(object (is-a clips_ASDF)
(name ?some_name)
(property ?my_property_var))
(not
(test (eq ?my_property_var nil)))
Why is that? How can I do the first?
Upvotes: 1
Views: 138
Reputation: 10757
The not conditional element can only can a single conditional element. If you want to place more than one, surround them with an and conditional element:
(not (and (object (is-a clips_ASDF)
(name ?some_name)
(property ?my_property_var))
(test (eq ?my_property_var nil))))
Alternately, there's no need for a separate test conditional element:
(not (object (is-a clips_ASDF)
(name ?some_name)
(property nil)))
Upvotes: 2
Reputation: 11367
This should fit your needs:
(defrule my-rule
(object (is-a clips_ASDF) (name ?some_name) (property ?my_property_var)&:(neq ? my_property_var nil))
=>
(printout t "done" crlf))
Upvotes: 1