[rules-users] moving average rule

Edson Tirelli tirelli at post.com
Wed May 27 08:21:45 EDT 2009


     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?
     Second, the session clock becomes really important in STREAM_MODE: what
clock are you using? Real time or pseudo clock?

     []s
     Edson

2009/5/26 Chris Richmond <crichmond at referentia.com>

>  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.
>
>
>
> 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.
>
>
>
> I am continuing the reading as well..perhaps I have not come across it
> yet..
>
>
>
> Thanks again for your help.
>
>
>
> Chris
>
>
>
>
>
>
>  ------------------------------
>
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Edson Tirelli
> *Sent:* Tuesday, May 26, 2009 4:24 PM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] moving average rule
>
>
>
>
>    Chris,
>
>    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.
>
>    I assume you looked here already:
>
> http://www.jboss.org/drools/documentation.html
>
>    For both, expert and fusion docs.
>
>    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?
>
>    []s
>    Edson
>
> 2009/5/26 Chris Richmond <crichmond at referentia.com>
>
> Hello,
>
>
>
> 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:
>
>
>
> *rule* "Alert when moving average goes below 50"
>
> *when*
>
>     Number( doubleValue > 127 ) *from* *accumulate*(
>
>         StockTick( symbol == "ORCL", $price: price ) over window:time( 1m
> ),
>
>         average( $price ) )
>
> *then*
>
>     System.out.println("moving average has gone beyone moving average");
>
> *End*
>
> * *
>
> 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.
>
>
>
> 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.
>
>
>
> Can anyone point me to some reasources for learning rule authoring,
> especially for taking advantage of the fusion features.
>
>
>
> Thanks,
>
>
> Chris
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090527/be63025a/attachment.html 


More information about the rules-users mailing list