[rules-users] Matching consecutive events

jpullmann jaroslav.pullmann at fit.fraunhofer.de
Wed Aug 1 05:52:27 EDT 2012


Dear contributors, 

  this rule is expected to match a sequence of 2 consecutive events: 

rule "test"		
    when        
        // a)
       	$ev1 : LocalizationEvent( type == TYPE.HINT,  $target : target  )
from entry-point "events/localization"       	      
       	$ev2 : LocalizationEvent( type == TYPE.HINT, target == $target, this
after $ev1 ) from entry-point "events/localization"
       	// b) 
        // Ev1 directly followed by ev2: no other HINT in between
       	not( LocalizationEvent( type == TYPE.HINT, target == $target, this
after $ev1, this before $ev2 )  from entry-point "events/localization" )
    then    
      do()
end

 The second event is interpreted as a "confirmation" of the first event (a). 
 No other (deviating) event is allowed between them (b). With this
restriction 
 in place, the rule requires a sequence of 3 input events for activation,
otherwise 
 2 events are sufficient (as expected). The events are ordered correctly and
it is 
 not obvious, why a third event is needed since the interval between ev1 and
ev2 is 
 closed ? This leads to an unnecessary delay in rule activation.. How could
this be 
 avoided and are there other approaches to match a concrete event sequence
pattern ? 

 Many thanks 
   Jaro



--
View this message in context: http://drools.46999.n3.nabble.com/Matching-consecutive-events-tp4018980.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list