Hi there, 

I'm a drools newbie and I wonder if someone could help me. I'm using drools
6.0.1 and I'm trying to write a rule that fires when:

1) a certain event is seen and 
2) a second event is not seen within a certain period of time (1 minute in
the examples below) after the first event is seen

I have tried the following LHS patterns:

rule "Something" dialect "mvel"
when
    $e1: Event($location: properties["location"] && ...)
    not Event(...., this after $e1)
then
    //do stuff
end

rule "Something" dialect "mvel"
when
    $e1: Event($location: properties["location"] && ...)
    not Event(...., this after[0, 1m] $e1)
then
    //do stuff
end

rule "Something" dialect "mvel"
when
    $e1: Event($location: properties["location"] && ...)
    List (size == 0) from collect (Event(..., this after $e1) over
window:time(1m))
then
    //do stuff
end


rule "Something" dialect "mvel"
when
    $e1: Event($location: properties["location"] && ...)
    List (size == 0) from collect (Event(...) over window:time(1m))
then
    //do stuff
end

The unwanted behaviours are as follows:

In the first case, the rule fires immediately after the first event is
inserted. 
In the second case, the rule fails to fire if the second event is seen (as
expected) but the rule does not fire if the second event is not seen within
1 minute.
In the third and fourth cases, the rule fires immediately after the first
event is inserted.

Event is a java class with a hash map of properties, defined with the
following metadata:

declare Event
        @role(event)
end

I would really appreciate if someone could help me out here. 

Thanks and let me know if you need any more info.

Dave




--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-event-not-found-over-window-query-tp4028129.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to