[rules-users] Simple Disjunction Question

Edson Tirelli ed.tirelli at gmail.com
Thu Feb 3 18:35:37 EST 2011


   Unfortunately, no.

   In forward chaining engines, "or" is just syntax sugar to automatically
generate multiple rules (one for each logical branch) that would trigger the
exact same consequence action. If you need different consequence actions,
you need to write different rules. As a side effect of this, all variables
used in the consequence must be defined in all logical branches.

   Edson

2011/2/3 <thomas.polzin at gmail.com>

> Hi there
>
> Assume we have a rule like this:
>
> when
>
> $a : A(a==1)
> or
> ($b : B(b==1) and $c : C(c==1))
>
> then
>
> do($a)
> do($b)
> do($c)
>
> end
>
>
> Assuming also, that for some reason I do not want to split this rule into
> two.
> Then, I get a NullPointer exception because either $a or $b and $c are not
> defined.
> Is there a way to catch or check for this.
>
> Thanks so much for any help
>
> Thomas
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110203/0013f62a/attachment.html 


More information about the rules-users mailing list