[rules-users] How can I nested rules

Mattias Nilsson Grip mattias.nilsson.grip at redpill-linpro.com
Mon Nov 5 12:38:15 EST 2012


Hi Leo,

another option could be to add some extra fact classes or declared types and do logical inserts. E.g. you could do:

rule "Age and gender women"
    when
        $p : Person(p1 >= 12 && p2 = 1)
    then
        insertLogical( new CouldHaveBeenPregnant($p) );
end 

rule "Pregnant"
    when
        $p : Person(p3 > 1)
        CouldHaveBeenPregnant( person == $p )
    then
        insertLogical( new HasBeenPregnant($p) );
end

rule "Pregnant2"
    no-loop
    when
        $p : Person(p4 <= P3)
        HasBeenPregnant( person == $p )
    then
        $p.setStatus("OK");
        update($p);
end 

Regards,
Mattias

----- Original Message -----
From: "salt" <writemesaltworth at gmail.com>
To: rules-users at lists.jboss.org
Sent: Friday, 2 November, 2012 7:09:14 PM
Subject: Re: [rules-users] How can I nested rules

Leo,

This can be achieved by using agendagroup. By drools.setFocus you can jump
from one rule to another.
Pls try that.





--
View this message in context: http://drools.46999.n3.nabble.com/How-can-I-nested-rules-tp4020488p4020681.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


More information about the rules-users mailing list