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