[rules-users] sliding window question
Lin Lin
lin.lin at comcast.net
Fri Feb 28 09:25:02 EST 2014
> On Feb 27, 2014, at 4:06 PM, "lin.lin [via Drools]" <ml-node+s46999n4028396h13 at n3.nabble.com> wrote:
>
> Hi
>
> Thanks again for the pointers!!
>
> I modified the code but the sliding window rule does not seem to be working as how I want it to be(copied shown in the following). I injected 6 events, one event every 10 seconds, the first one is less than 90, the rest are more than 90. I am expecting getting 3 alerts at 4th event, 5th event and 6 event. But instead I only get one alert.
>
> when
> not Reading( reading <= 90 ) over window:time( 30s ) from entry-point ReadingStream
> then
> System.out.print ("alert: Reading high for 30 seconds \n");
>
>
> So I used the other way as you suggested. It works and gives me 3 alerts. However if I added the accumulate pattern (copied below) , no alert is generated at all. If I removed the first 3 patterns, just leave the last pattern, it does print the average of last 30 seconds event every time when a new event is injected. What else did I do wrong?
>
> when
> $r1: Reading( reading >90 ) from entry-point HeartrateStream
> $r2: Reading( reading > 90, this after[30s,30s] $r1 ) from entry-point HeartrateStream
> not (Reading( reading <= 90, this after $r1, this before $r2 ) from entry-point HeartrateStream)
> $averg: Number() from accumulate( Reading ( $r:reading) over windiw:time(30s) from entry-point HeartrateStream, average($r) )
> then
> System.out.print ("alert: Reading high for 30 seconds, average reading"+$averg+"\n");
>
>
> Thanks a lot!!!
> Lin
>
>
>
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://drools.46999.n3.nabble.com/sliding-window-question-tp4028367p4028396.html
> To unsubscribe from sliding window question, click here.
> NAML
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140228/7d6cc303/attachment.html
More information about the rules-users
mailing list