I am trying to write a rule that collects / accumulates values based on a temporal operator.
rule "Zone6 Overlap"
when
$i1 : Instance ($e1 : event == " Vel : 20.99-23.98 km/h : " && $name1 : name) from entry-point "Stream"
$i2 : Instance ($e2 : event && $name2 : name && $e2 == $e1 && $name2 != $name1
&& this overlaps $i1) from entry-point "Stream"
then
System.out.println("** Overlap Event: Velocity Zone 6 ** \nPlayer1: " + $i1.getName() + "\nPlayer2: "
+ $i2.getName() + "\nEvent: " + $i1.getEvent() + "\n" + "Start Time (P1): "
+ $i1.getStart() + " - End Time: " + $i1.getEnd() + "\nStart Time (P2): "
+ $i2.getStart() + " - End Time: " + $i2.getEnd() + "\n");
end
This is my original rule which manages to get the overlap of two durations.
The idea of the rule i want to create is to see if there are any collective overlaps of the durations of players in a football game. I want to see if any of up to the 9 players on the field are travelling at a range of speed specified as a string in the event variable that are all overlapping at once.
I've tried a few things regarding accumulate and collect but struggling with how to collect these events when they happen and return them to the right hand side of the rule so they can be printed to standard out.
Please help.
Thanks.