[rules-users] sliding window question

lin.lin lin.lin at comcast.net
Wed Feb 26 20:55:30 EST 2014


Hi, 

I tried to create a rule that gives an alert when a machine reading is high
for 30 seconds. I modeled the machine reading input as events.  The
following is the rule: 

rule "rule1" 
dialect "mvel" 
    when 
       $rd1 : mReading( reading >90 ) from entry-point ReadingStream 
       not ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 ) 
from entry-point ReadingStream ) 
    then 
      System.out.print ("alert: Reading high for 30 seconds \n"); 
end 

This does not detect detect the bad reading.  However, If I changed the rule
to be following (change second condition from "not" to "exists"), it detects
all readings that are good. 

rule "rule1" 
dialect "mvel" 
    when 
       $rd1 : mReading( reading >90 ) from entry-point ReadingStream 
       exists ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 ) 
from entry-point ReadingStream ) 
    then 
      System.out.print ("alert: Reading high for 30 seconds \n"); 
End 


Is this an issue in CEP or did I do something wrong? 

Thanks a lot! 
Lily 



--
View this message in context: http://drools.46999.n3.nabble.com/sliding-window-question-tp4028367.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list