[rules-users] Guvnor (5.3.0 Final)- Rule using accumulate with windows:length delivers an unexpected result

Michael Anstis michael.anstis at gmail.com
Tue Nov 8 04:09:55 EST 2011


I don't see that this problem is explicitly Guvnor's.

Have you tried replicating the issue with vanilla DRL and a standalone
Drools project?

I suspect you'll have the same issue - perhaps somebody more familiar with
the workings of sliding windows and accumulate functions can advise further.

With kind regards,

Mike

On 8 November 2011 07:44, axel <axel.poeschmann at solutions.endress.com>wrote:

> Hello All,
>
> I'm using Guvnor 5.3.0-Final with Tomcat 6.0 testing the following simple
> rule getting unexpected results. Maybe someone can give me a hint whats
> wrong in my rule.
> Thanks in advance!
>
> Axel
>
> Short Rule description:
>
> A list is built from selected event-facts evalEvent(@role (event), Double
> f,
> String wam) over a certain window in a first line (because I found the hint
> to do it seperately in another thread). Next, I want to caclculate the
> avarage, but only from the selected events in the list. Finally, I check a
> certain limit with the average and the RHS is just inserting a fact to
> generate some output in the test case.
>
> rule "Event Processing Evaluation"
> dialect "mvel"
> when
>  $list:java.util.List() from collect( evalEvent(wam == 'D1', f != null)
> over window:length( 1 ))
>  $average:Double() from accumulate( evalEvent($vf:f) from
> $list,average($vf) )
>  eval($average > 5)
> then
>  internalEvent fact0 = new internalEvent();
>  fact0.setDesrc( "Internal Event: "+ $average );
>  insert(fact0 );
> end
>
> Test details from Guvnor Test that delivers an (for me) unexpected result:
>
> I'm inserting three events, where the avarage of all three events is over
> the limit, but taken only the last or last two (same result) as I want to
> do
> with the window:length is not and shoud therefore not fire the rule. I
> added
> below output details from the Guvnor Test that shows the following: The
> list
> seams to be right (only the last event in $list), the avarage seams to be
> right ($average = 5.0) - but the rule still fires.
> It seams for me that the average of all three evnts is internally used for
> eval($average > 5). I tried a lot of variants, but nothing works well. I'd
> like to check to use an entry-point if that changes the result, but I found
> no way within the Guvnor Test Case Editor putting enty points in for
> events.
>
>
>  OBJECT ASSERTED value:evalEvent( wam=D1, f=6.0 ) factId: 1
>  OBJECT ASSERTED value:evalEvent( wam=D1, f=5.0 ) factId: 6
>  OBJECT ASSERTED value:evalEvent( wam=D1, f=5.0 ) factId: 9
>  FIRING rule: [Event Processing Evaluation] activationId:Event Processing
> Evaluation [3, 2, 0] declarations: $list=[evalEvent( wam=D1, f=5.0 )](2);
> $average=5.0(3)
>  OBJECT ASSERTED value:internalEvent( desrc=Internal Event: 5.0 ) factId:
> 12
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-5-3-0-Final-Rule-using-accumulate-with-windows-length-delivers-an-unexpected-result-tp3489546p3489546.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111108/d7f546f4/attachment.html 


More information about the rules-users mailing list