Hi Greg,<br><br>Many thanks for the response. Works great!<br><br>Cheers,<br><br>Paul<br><br><div class="gmail_quote">On Mon, Jan 18, 2010 at 6:24 AM, Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yeah, you&#39;ll have to reinsert events into the stream, or another stream.  Probably the latter would be better.<br>

<br>
rule &quot;DetectedFooAverageOver1&quot;<br>
when<br>
<div class="im">  $f : Double(doubleValue &gt; 1.0) from accumulate( Event($v : value, name == &quot;Foo&quot;) over window:time ( 10s ) from entry-point EntryPoint, average($v))<br>
</div>then<br>
  entryPoints[&quot;DetectedStuff&quot;].insert(new ComplexEvent(&quot;FooAvg&quot;, $f));<br>
end<br>
<br>
Then a similar rule for the Bar average, and a rule to test the coincidence of the complex events:<br>
<br>
rule &quot;ComplexAvgBarPrettySoonAfterComplexAvgFoo&quot;<br>
when<br>
  $foo : ComplexEvent(name == &quot;FooAvg&quot;) from entry-point DetectedStuff<br>
  $bar : ComplexEvent(name == &quot;BarAvg&quot;, this after[0s,1s] $foo) from entry-point DetectedStuff<br>
then<br>
  System.out.println(&quot;Uf, dah!&quot;);<br>
end<br>
<br>
And more fun can be had with this event aggregation idea.<br>
<div class="im"><br>
--- On Sun, 1/17/10, Paul R. &lt;<a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>&gt; wrote:<br>
<br>
&gt; From: Paul R. &lt;<a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>&gt;<br>
</div>&gt; Subject: Re: [rules-users] Accumulate + Temporal Operators<br>
&gt; To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
&gt; Date: Sunday, January 17, 2010, 12:29 PM<br>
<div><div></div><div class="h5">&gt; I&#39;ve declared an @expires of 30s for<br>
&gt; both events. However, my problem is that within a 30 second<br>
&gt; window it doesn&#39;t seem possible to ascertain whether<br>
&gt; both of the events occur simultaneously. I could change the<br>
&gt; @expires to 10 seconds for the above rule, which would make<br>
&gt; it work. However, I would like to be to perform more<br>
&gt; complicated matches, e.g. matching sequences of events which<br>
&gt; occur after another.<br>
&gt;<br>
&gt;<br>
&gt;         $f : Double(doubleValue &gt; 1.0) from<br>
&gt; accumulate( Event($v : value, name == &quot;Foo&quot;) over<br>
&gt; window:time ( 10s )<br>
&gt;<br>
&gt;             from entry-point EntryPoint,<br>
&gt; average($v))<br>
&gt;<br>
&gt;         // following event must start immediately<br>
&gt; _after_ the above.<br>
&gt;<br>
&gt;         $b : Double(doubleValue &lt; 1.0) from<br>
&gt; accumulate( Event($v : value, name == &quot;Bar&quot;) over<br>
&gt; window:time ( 20s )<br>
&gt;<br>
&gt;             from entry-point EntryPoint,<br>
&gt; average($v))<br>
&gt;<br>
&gt; Any suggestions how I can achieve this kind of<br>
&gt; functionality?<br>
&gt;<br>
&gt; Many Thanks,<br>
&gt;<br>
&gt; Paul<br>
&gt;<br>
&gt;<br>
&gt; On Sun, Jan 17, 2010 at 4:19 AM,<br>
&gt; Greg Barton &lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; Do your Foo and Bar events declare<br>
&gt; an @expires value?  If their expiration is less than 10<br>
&gt; seconds then the rule below won&#39;t work properly. (And by<br>
&gt; default an event&#39;s expiration is 0, which makes the rule<br>
&gt; below go wacky if @expires hasn&#39;t been declared...)  If<br>
&gt; the @expires is 10s or greater for both events it should<br>
&gt; work.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --- On Thu, 1/14/10, Paul R. &lt;<a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &gt; From: Paul R. &lt;<a href="mailto:reverselogic@gmail.com">reverselogic@gmail.com</a>&gt;<br>
&gt;<br>
&gt; &gt; Subject: [rules-users] Accumulate + Temporal<br>
&gt; Operators<br>
&gt;<br>
&gt; &gt; To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;<br>
&gt; &gt; Date: Thursday, January 14, 2010, 1:56 PM<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; I&#39;m using accumulate with sliding windows to<br>
&gt; verify<br>
&gt;<br>
&gt; &gt; that certain event conditions are present for a<br>
&gt; specified<br>
&gt;<br>
&gt; &gt; period of time, which works fine, however<br>
&gt;<br>
&gt; &gt; I need to verify that both conditions are present at<br>
&gt; the<br>
&gt;<br>
&gt; &gt; same time, i.e Foo.value &gt; 1 for 10 seconds and<br>
&gt; Bar.value<br>
&gt;<br>
&gt; &gt; &lt; 1 for 10 seconds. There doesn&#39;t<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; appear to be an obvious way to use the temporal<br>
&gt; operators<br>
&gt;<br>
&gt; &gt; in this situation. Can anybody offer any suggestions?<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;     rule test no-loop true<br>
&gt;<br>
&gt; &gt;     when<br>
&gt;<br>
&gt; &gt;         $f : Double(doubleValue &gt; 1.0) from<br>
&gt;<br>
&gt; &gt; accumulate( Foo($v : value) over window:time ( 10s )<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;             from entry-point EntryPoint,<br>
&gt;<br>
&gt; &gt; min($v))<br>
&gt;<br>
&gt; &gt;         $b : Double(doubleValue &lt; 1.0) from<br>
&gt;<br>
&gt; &gt; accumulate( Bar($v : value) over window:time ( 10s )<br>
&gt;<br>
&gt; &gt;             from entry-point EntryPoint,<br>
&gt;<br>
&gt; &gt; max($v))<br>
&gt;<br>
&gt; &gt;     then<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;         // ...<br>
&gt;<br>
&gt; &gt;     end<br>
&gt;<br>
&gt; &gt;    <br>
&gt;<br>
&gt; &gt; Any help greatly appreciated.<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Thanks,<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; Paul<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; -----Inline Attachment Follows-----<br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; _______________________________________________<br>
&gt;<br>
&gt; &gt; rules-users mailing list<br>
&gt;<br>
&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;<br>
&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt;<br>
&gt; rules-users mailing list<br>
&gt;<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;<br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; -----Inline Attachment Follows-----<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>