<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Well I am only modifying the StockTicker
example which I believe is using Stream mode and &nbsp;and system time.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=3 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Edson Tirelli<br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, May 27, 2009 2:22
AM<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><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
&nbsp;&nbsp;&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp;&nbsp; Second, the session clock becomes really important in
STREAM_MODE: what clock are you using? Real time or pseudo clock?<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; []s<br>
&nbsp;&nbsp;&nbsp;&nbsp; Edson<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2009/5/26 Chris Richmond &lt;<a href="mailto:crichmond@referentia.com">crichmond@referentia.com</a>&gt;<o:p></o:p></span></font></p>

<div link=blue vlink=blue>

<div>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Well, it never fires even though the last several values are ALL
above my moving averate limit&#8230;I never see the output being written out.&nbsp; I
modified my limit value to something very very low to ensure the average was
beyond that, but still nothing.&nbsp;&nbsp; </span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;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.&nbsp;
There doesn&#8217;t seem to be a lot of samples(syntax wise) for authoring rules
taking advantage of those Fusion features.&nbsp; 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&#8230;think of sensor data over time&#8230;.so I
want to author rules that work on the latest readings plus some configurable
amount of readings in the past.&nbsp; &gt;From the Fusion features description,
it seems ideal&#8230;.but finding out the nuts and bolts of implementing it is
eluding me thus far.&nbsp; </span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>I am continuing the reading as well..perhaps I have not come
across it yet..</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Thanks again for your help.</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Chris&nbsp; </span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=3 width="100%" align=center>

</span></font></div>

<p><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span
style='font-size:10.0pt;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><o:p></o:p></p>

</div>

<div>

<div>

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p style='margin-bottom:12.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><br>
&nbsp;&nbsp; Chris,<br>
<br>
&nbsp;&nbsp; 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>
&nbsp;&nbsp; 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>
&nbsp;&nbsp; For both, expert and fusion docs.<br>
<br>
&nbsp;&nbsp; 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>
&nbsp;&nbsp; []s<br>
&nbsp;&nbsp; Edson<o:p></o:p></span></font></p>

<div>

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>2009/5/26
Chris Richmond &lt;<a href="mailto:crichmond@referentia.com" target="_blank">crichmond@referentia.com</a>&gt;<o:p></o:p></span></font></p>

<div link=blue vlink=purple>

<div>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Hello,</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I
am trying to write a rule for a moving average over values over the last minute
using fusion.&nbsp; In general I can&#8217;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.&nbsp; Here is the rule entry I
aded to the broker.drl:</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><b><font size=2 color="#960000" face="Courier New"><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000;font-weight:bold'>rule</span></font></b><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> </span></font><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>&quot;Alert when moving average goes below 50&quot;</span></font><o:p></o:p></p>

<p><b><font size=2 color="#960000" face="Courier New"><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000;font-weight:bold'>when</span></font></b><o:p></o:p></p>

<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp; Number( doubleValue
&gt; 127 ) </span></font><b><font size=2 color="#960000" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#960000;font-weight:
bold'>from</span></font></b><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span></font><b><font
size=2 color="#960000" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#960000;font-weight:bold'>accumulate</span></font></b><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>(</span></font><o:p></o:p></p>

<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
StockTick( symbol == </span></font><font size=2 color=green face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>&quot;ORCL&quot;</span></font><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>, $price: price ) over window:time( 1m ),</span></font><o:p></o:p></p>

<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
average( $price ) )</span></font><o:p></o:p></p>

<p><b><font size=2 color="#960000" face="Courier New"><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000;font-weight:bold'>then</span></font></b><o:p></o:p></p>

<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp; System.out.println(</span></font><font
size=2 color=green face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:green'>&quot;moving average has gone beyone moving
average&quot;</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span></font><o:p></o:p></p>

<p><b><font size=2 color="#960000" face="Courier New"><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000;font-weight:bold'>End</span></font></b><o:p></o:p></p>

<p><b><font size=2 color="#960000" face="Courier New"><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000;font-weight:bold'>&nbsp;</span></font></b><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I
basically want to be alerted any time the moving average for ORCL moves above
127 (or whatever criteria I set&#8230;I picked that based on the sample data the
sample fusion project uses), but it doesn&#8217;t seem to be working.&nbsp; </span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;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&#8217;s very difficult to piece together how
to author rules utilizing fusion features based on isolated snippets from the
fusion guide.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Can
anyone point me to some reasources for learning rule authoring, especially for
taking advantage of the fusion features.</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Thanks,</span></font><o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><br>
<font color="#888888"><span style='color:#888888'>Chris</span></font></span></font><o:p></o:p></p>

</div>

</div>

<p style='margin-bottom:12.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><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><o:p></o:p></span></font></p>

</div>

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
<br clear=all>
<br>
-- <br>
&nbsp;Edson Tirelli<br>
&nbsp;JBoss Drools Core Development<br>
&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com"
target="_blank">www.jboss.com</a><o:p></o:p></span></font></p>

</div>

</div>

</div>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><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><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br clear=all>
<br>
-- <br>
&nbsp;Edson Tirelli<br>
&nbsp;JBoss Drools Core Development<br>
&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><o:p></o:p></span></font></p>

</div>

</body>

</html>