[rules-users] Is it here or not?

Wolfgang Laun wolfgang.laun at gmail.com
Fri Nov 19 06:44:23 EST 2010


Consider these rules:

rule "no Ax Or Ax 1"
when
    EventA(id == "1") and Boolean( $v: booleanValue == true )
    or
    (not EventA(id == "1")) and Boolean( $v: booleanValue == false )
then
    System.out.println( "#1: A(1) is " + $v );
end

rule "no Ax Or Ax 2"
when
    (EventA(id == "1") or not( EventA(id == "1") ))
    List( $size: size ) from collect( EventA(id == "1") )
then
    boolean v = $size > 0;
    System.out.println( "#2: A(1) is " + v );
end

Rules #1 and #2 fire as expected while inserting lots of
EventA(id=="1"), once for each new one.

Rule #1 fires as expected after retracting the last inserted fact.

Rule #2 does not, BUT if I split the rule manually in two, they both fire:
   ...when
      EventA(id == "1")
      List(...
and
   ...when
       not( EventA(id == "1") )
       List(...

Using 5.1.1.
-W



More information about the rules-users mailing list