Edson Tirelli-3 wrote:
Ck,
You need to think different when using forward chaining. Your data
will
drive the execution, not your "goals".
So, the state of your facts match rule B twice, it will fire twice.
"Stupid" example:
rule "1. increment counter"
salience 10
when
$c : Counter( value < 2 )
then
System.out.println( "firing rule 1" );
$c.setValue( $c.getValue() + 1 );
modify( $c );
end
rule "2. diplay counter"
when
Counter( $value : value )
then
System.out.println("Value = "+$value);
end
If you do:
wm.assertObject( new Counter( 0 ) );
wm.fireAllRules();
Rules will fire:
1 -> 1 -> 2
2007/5/9, ch4nd4n <chandan_kumar(a)msn.com>:
>
>
> Hi,
> is there a possibility to fire a particular rule twice?
>
> For example if I have Rules "A", "B", "C",
"D" and I am putting a Person
> Object with few parameters,
>
> Then how can I fire in following order
>
> A -> B -> C -> B -> D
>
> Thanks,
> Ck
>
http://www.gfour.net
Hi Ed,
Thanks for the clarification. Your example gave me a clear picture how it
can be controlled. My attempts to get something like this done, was ending
up in endless loop. I was forced to use no-loop, which of course would
disable the purpose.
--
Ck
http://www.gfour.net
--
View this message in context:
http://www.nabble.com/reuse-a-rule-already-fired-tf3714857.html#a10407422
Sent from the drools - user mailing list archive at
Nabble.com.