[rules-users] Counting events / fact condition not evalauted with accumulate

jpullmann jaroslav.pullmann at fit.fraunhofer.de
Tue Jul 17 04:25:48 EDT 2012


Dear contributors, 

   this simple rule should trigger only when a critical amount of particular
events was detected, 
  though it seems to accept any event of this type, disregarding the fact
condition (e.g. there 
  is no single event that matches "target == Long.MAX_VALUE"). The current
behaviour results in 
  an unconstrained type match: LocalizationEvent():
   
// annotation for external event class
declare LocalizationEvent
    @role( event )
    @duration( dur )       
    @timestamp( time )
end

// triggers on *any* LocalizationEvent, regardless of fact condition
rule "Detect crictial number of events"
when  	
   accumulate( 
    // there is no matching event
   	$ev: LocalizationEvent(type == TYPE.LEFT, target == Long.MAX_VALUE, area
== Long.MAX_VALUE)
   	over window:time(30s) from entry-point "events/localization";
   	$n : count( $ev );
   	$n > 5 )
then
    System.out.println($n+" events detected" );
end

  The KB is configured for stream processing, the events are inserted in a
chronological order
  and the session pseudo clock is advanced accordingly. Drools version in
use is 5.4.0. 

  Any suggestions are appreciated! 
   Many thanks 
    Jaro


--
View this message in context: http://drools.46999.n3.nabble.com/Counting-events-fact-condition-not-evalauted-with-accumulate-tp4018729.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list