[rules-dev] Re: JBoss rules execution algorithm

Mark Proctor mproctor at codehaus.org
Mon Oct 1 12:02:38 EDT 2007


For the case when r2 has the 'not'. When 4 doesn't exist r3 is true, 
when r3 fires it asserts 4, thus r3 can no longer be true, however r4 
retracts the 4 and 2  still exists, thus enabling r3 to match again 
which causes the recursion - basically the insertion and retracting of 4 
is toggling r3 on and off. Best thing to do is always use the audit log 
so you can visualise what's going on.

Mark
lukichev wrote:
>
> Dear Mark,
>
>  
>
> I have a question concerning rule execution algorithm in JBoss 4.0.1.
>
>  
>
> There are 2 rule sets, one runs in a circle and another one stops.
>
>  
>
> The first one, which stops:
>
>  
>
> *rule* "r1"
>
>       *when*
>
>             $num1:Integer(intValue == 1)
>
>       *then*
>
>             *insert*(*new* Integer(2));
>
> *end*
>
>  
>
> *rule* "r2"
>
>       *when*
>
>             $num1:Integer(intValue == 2)
>
>       *then*
>
>             *insert*(*new* Integer(3));
>
> *end*
>
>  
>
> *rule* "r3"
>
>       *when*
>
>             $num1:Integer(intValue == 2)
>
>       *then*
>
>           *insert*(*new* Integer(4));
>
> *end*
>
>  
>
> *rule* "r4"
>
>       *when*
>
>             $num1:Integer(intValue == 3)
>
>             $num2:Integer(intValue == 4)
>
>       *then*
>
>             *retract*($num2);
>
> *end*
>
> * *
>
> The second one, which runs in a circle, is different from the one 
> above by the additional condition in r3:
>
>  
>
>             *not* $num2:Integer(intValue == 4)
>
>  
>
> I would expect the same behavior of these two rule sets, but it is 
> different. Could you, please, comment, why this is so?
>
>  
>
> Sincerely,
>
> Sergey Lukichev
>
> Research Assistant, REWERSE I1, rule modeling and markup
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20071001/0b8f99f5/attachment.html 


More information about the rules-dev mailing list