<br>     There are 2 important concepts related to time windows. First and most important, sliding windows only work in STREAM_MODE, not in CLOUD_MODE (default). Did you set the engine to STREAM_MODE?<br>     Second, the session clock becomes really important in STREAM_MODE: what clock are you using? Real time or pseudo clock?<br>
<br>     []s<br>     Edson<br><br><div class="gmail_quote">2009/5/26 Chris Richmond <span dir="ltr"><<a href="mailto:crichmond@referentia.com">crichmond@referentia.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="blue" lang="EN-US">
<div>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Well, it never fires even though the last
several values are ALL above my moving averate limit…I never see the
output being written out.  I modified my limit value to something very
very low to ensure the average was beyond that, but still nothing.   </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I understand what you are saying about
Expert+Fusion and that was my understanding as well and I have been reading
through the docs on that links, however I have not read all of the documentation
exhaustively yet.  There doesn’t seem to be a lot of samples(syntax
wise) for authoring rules taking advantage of those Fusion features. 
There are isolated one or two line samples, but I guess I am having a difficult
time determining how to author rules based on collections of data…think
of sensor data over time….so I want to author rules that work on the
latest readings plus some configurable amount of readings in the past. 
>From the Fusion features description, it seems ideal….but finding out the
nuts and bolts of implementing it is eluding me thus far.  </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am continuing the reading as
well..perhaps I have not come across it yet..</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks again for your help.</span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Chris  </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<div>
<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">
<hr align="center" size="3" width="100%">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b><span style="font-weight: bold;">On
Behalf Of </span></b>Edson Tirelli<br>
<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, May 26, 2009 4:24
PM<br>
<b><span style="font-weight: bold;">To:</span></b> Rules Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] moving
average rule</span></font></p>
</div><div><div></div><div class="h5">
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
   Chris,<br>
<br>
   Fusion is an extension of Drools Expert. Think about it as all
Expert features + some additional features. That is why Drools Fusion docs is
just a list of features explained.<br>
<br>
   I assume you looked here already:<br>
<br>
<a href="http://www.jboss.org/drools/documentation.html" target="_blank">http://www.jboss.org/drools/documentation.html</a><br>
<br>
   For both, expert and fusion docs.<br>
<br>
   So, back to your rule, syntax seems correct to me. Why do you say
it is not working? What error or symptoms do you see?<br>
<br>
   []s<br>
   Edson</span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2009/5/26 Chris Richmond <<a href="mailto:crichmond@referentia.com" target="_blank">crichmond@referentia.com</a>></span></font></p>
<div link="blue" vlink="purple">
<div>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Hello,</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I
am trying to write a rule for a moving average over values over the last minute
using fusion.  In general I can’t seem to locate a detailed resource
for authoring syntax for these types of rules or rules in general, but
specifically, I tried to modify something from the fusion documentation for my
purposes using the StockTicker fusion sample.  Here is the rule entry I
aded to the broker.drl:</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span></font><font color="green" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: green;">"Alert when moving average goes below 50"</span></font></p>
<p><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">when</span></font></b></p>
<p><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">    Number( doubleValue
> 127 ) </span></font><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">from</span></font></b><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span></font><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">accumulate</span></font></b><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">(</span></font></p>
<p><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">       
StockTick( symbol == </span></font><font color="green" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: green;">"ORCL"</span></font><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">, $price: price ) over window:time( 1m ),</span></font></p>
<p><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">       
average( $price ) )</span></font></p>
<p><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">then</span></font></b></p>
<p><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">    System.out.println(</span></font><font color="green" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: green;">"moving average has gone beyone moving
average"</span></font><font color="black" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span></font></p>
<p><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;">End</span></font></b></p>
<p><b><font color="#960000" size="2" face="Courier New"><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(150, 0, 0); font-weight: bold;"> </span></font></b></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I
basically want to be alerted any time the moving average for ORCL moves above
127 (or whatever criteria I set…I picked that based on the sample data
the sample fusion project uses), but it doesn’t seem to be working. 
</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I
guess if I could locate the definitave samples or guide for authoring these
types of rules I could use that, but it’s very difficult to piece
together how to author rules utilizing fusion features based on isolated
snippets from the fusion guide.</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Can
anyone point me to some reasources for learning rule authoring, especially for
taking advantage of the fusion features.</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Thanks,</span></font></p>
<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><br>
<font color="#888888"><span style="color: rgb(136, 136, 136);">Chris</span></font></span></font></p>
</div>
</div>
<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></span></font></p>
</div>
<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
 Edson Tirelli<br>
 JBoss Drools Core Development<br>
 JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></span></font></p>
</div></div></div>
</div>
<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></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>