[rules-users] Negating a result

Wolfgang Laun wolfgang.laun at gmail.com
Wed Feb 17 02:56:51 EST 2010


Surely you know de Morgan's laws? They apply equally to the conditions in
rules which are nothing but conditional expressions.

The Conditional Element "not" provides for negation, i.e., the absence
of any fact with the given properties.

In addition to the implied "and" there is "or", to combine Fact matches.

Conditional operators for field tests have negated forms,
i.e., == and !=, or "contains" and "not contains".

Notice that there is one or two pitfalls in connection with the universal
quantifiers, e.g., "exists" should not be negated as "not exists" but
simply written as "not".

HTH
-W


On Wed, Feb 17, 2010 at 8:22 AM, djb <dbrownell83 at hotmail.com> wrote:

>
> Hi,
>
> I've been playing with Drools for a few weeks now, using rule templates,
> but
> using mostly Java with eval().  I am now trying to re-write my program in
> DRL, (to get that sweet RETE working).
>
>
> I've got a situation where my rules are either "may not be" or "must be" in
> the condition.
>
> In Java, I work out everything assuming "may not be", and in the last line,
> return (negationMod ? result : !result);
>
>
> But in DRL... i'm a bit lost.  I guess I'll have to split up the rule
> templates, one for "may not be" and one for "must be"?  Is there a better
> way?
>
> Regards
> Daniel
>
>
>
>
>
> --
> View this message in context:
> http://n3.nabble.com/Negating-a-result-tp212559p212559.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100217/5cd7530f/attachment.html 


More information about the rules-users mailing list