I think Eric Jain wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I have some rules for validating data, e.g.
>
> (defrule warn-if-no-name
> ?taxon <- (taxon (name nil))
> =>
> (assert (warning (message "No name set") (resource ?taxon))))
>
> Now, if a value is set for the 'name' slot, the 'warning' should be
> retracted. Is there any way to accomplish this with a single rule, or do
> I have to duplicate and negate the complete rule?
>
> (defrule remove-warning-if-name
> ?taxon <- (taxon (name ~nil))
> ?fact <- (warning (message "No name set") (resource ?taxon))
> =>
> (retract ?fact))
>
> It's quite possible that my approach to the problem is flawed,
> neverthless I hope you can see what I am trying to do here.
>
You can use the (logical) CE
(defrule warn-if-no-name
?taxon <- (logical (taxon (name nil)))
=>
(assert (warning (message "No name set") (resource ?taxon))))
The warning will be retracted automatically if the taxon is modified.
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------