[rules-users] Using GUVNOR for FUSION RULES

Michael Anstis michael.anstis at gmail.com
Fri Apr 27 05:26:34 EDT 2012


Glad to be of assistance.

To bind a field, once the field has been added to the Fact type simply
click on the field name.

With kind regards,

Mike

On 27 April 2012 08:31, Pellecchia Carolina <c.pellecchia at vitrociset.it>wrote:

>
> Hi Mike,
>
> I’m a colleague of Matteo Cusmai, we would like to thank you for your
> suggestions. you have been very helpful.
>
> Following your steps, I couldn't understand a point: how can I bind a
> field(for ex. RadiationObservation.location)  to a variable?
> specifically,
>
>        $obs : RadiationObservation(?$obsLocation : location? ) over
> window:length (1) from entry-point "lowLevelSensorStream"
>
>
> Best regards,
> Carolina Pellecchia
> ________________________________________
> Da: rules-users-bounces at lists.jboss.org [
> rules-users-bounces at lists.jboss.org] per conto di
> rules-users-request at lists.jboss.org [rules-users-request at lists.jboss.org]
> Inviato: giovedì 26 aprile 2012 19.07
> A: rules-users at lists.jboss.org
> Oggetto: rules-users Digest, Vol 65, Issue 93
>
> Send rules-users mailing list submissions to
>        rules-users at lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
>        rules-users-request at lists.jboss.org
>
> You can reach the person managing the list at
>        rules-users-owner at lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
>   1. Re: Setting variables in a stateless session (Welsh, Armand)
>   2. Re: Using GUVNOR for FUSION RULES (Michael Anstis)
>   3. Re: Guvnor guided editor and non argument constructor
>      (Michael Anstis)
>   4. looking for advice (Bobby Richards)
>   5. Re: Guvnor guided editor and non argument constructor
>      (Vincent LEGENDRE)
>   6. Re: Guvnor guided editor and non argument constructor (Sean Su)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 26 Apr 2012 15:57:11 +0000
> From: "Welsh, Armand" <AWelsh at StateStreet.com>
> Subject: Re: [rules-users] Setting variables in a stateless session
> To: "rules-users at lists.jboss.org" <rules-users at lists.jboss.org>
> Message-ID:
>        <
> D52DE19B4C463C4BA21F81790B9F079543084863 at GDCPW3376.corp.statestr.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Think of a stateless knowledge session as being a statefull knowledge
> session, with the following adjustments:
> A stateless knowledge session cannot be manipulated prior the start of the
> session.
> A stateless knowledge session cannot be manipulated or queried after the
> end of the session.
> A stateless session begins when you execute the fireallrules method.
> A stateless session ends when the rule processing terminates.  -- There is
> no pause, there is no restarting.  The instant the rules stop firing, and
> return to your calling code, the knowledge session has been torn down.
>
>
>
> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] On Behalf Of bardelman
> Sent: Thursday, April 26, 2012 2:06 AM
> To: rules-users at lists.jboss.org
> Subject: [rules-users] Setting variables in a stateless session
>
> hi folks, this is a simple question ,
> i just want to understand how is it possible that a stateless session have
> a
> setGlobal() method as it does not maintain a state. What's the point ?!
> i  also have some confusion between a "request scope" and a "stateless
> session scope" i think it s the same..
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Setting-variables-in-a-stateless-session-tp3940652p3940652.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 26 Apr 2012 15:52:09 +0100
> From: Michael Anstis <michael.anstis at gmail.com>
> Subject: Re: [rules-users] Using GUVNOR for FUSION RULES
> To: Rules Users List <rules-users at lists.jboss.org>
> Message-ID:
>        <CAAG9P0tN=HqTJ9hkJHDiQGBk=_10o4f810-bQBhbTFwUtO-fEQ at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Sure.
>
>   - Create "New Rule"
>
>
>   - Add a condition (green + near "WHEN")
>
>
>   - Select "From Entry Point"
>
>
>   - Type "lowLevelSensorStream" into TextBox
>
>
>   - Click on "click to add patterns..."
>
>
>   - Select your Fact Type (see * below)
>
>
>   - In "Over sliding window" ListBox select "Length"
>
>
>   - Type "1" into the TextBox next to "Length".
>
> * OK, so this is possibly where you're having problems.
>
> In order for a Fact Type to be used with CEP it needs to be annotated as an
> Event. This is how this can be accomplished:-
>
> *If you have a Declarative Model
> *
>
>   - Open the Declarative Model
>
>
>   - Select the Fact Type that should be an Event
>
>
>   - Add an Annotation, name="role", key="value", value="event"
>
>
>   - Save
>
>
> *If you have a POJO Model*
>
>   - Create a new Declarative Model
>
>
>   - Add a Fact Type that matches the name of that in your JAR
>
>
>   - Add an Annotation, name="role", key="value", value="event"
>
>
>   - Save
>
>
> Annotating your POJO is covered in the Drools Expert User Guide. You are
> just using Guvnor to achieve what is required.
>
> With kind regards,
>
> Mike
>
> On 26 April 2012 15:22, Matteo Cusmai <cusmaimatteo at gmail.com> wrote:
>
> > Hi Mike,
> > thanks for suggestion, but i have already read documentation.
> >
> > First of all, i cannot define "over window:length(1) from entry-point
> > lowLevelSensorStream".
> > Do you help me to do this?
> >
> > Best Regards,
> > Matteo.
> >
> >
> >
> > On Thu, Apr 26, 2012 at 11:32 AM, Michael Anstis <
> michael.anstis at gmail.com
> > > wrote:
> >
> >> Yes this is possible with Guvnor 5.2 onwards.
> >>
> >> The user-guide explains how to use the Guided Rule Editor (but not
> >> specifically CEP features).
> >>
> >> Read that and give it a try - it's reasonably intuitive (not an excuse
> >> for poor documentation though) and come back here with questions.
> >>
> >> With kind regards,
> >>
> >> Mike
> >>
> >> On 26 April 2012 09:08, Matteo Cusmai <cusmaimatteo at gmail.com> wrote:
> >>
> >>> Hi all,
> >>> i am novice on GUVNOR, but i would like to define my fusion rules by
> >>> graphical tool.
> >>>
> >>> An example of my rules is:
> >>>
> >>> rule "radiation-event"
> >>>     salience 10
> >>>     no-loop
> >>>     when
> >>>         $obs    : RadiationObservation( $obsLocation : location, value
> >
> >>> 10 ) over window:length(1) from entry-point lowLevelSensorStream
> >>>         not RadiationEvent( this meets[ 25s ] $obs, location
> >>> geoIsWithinDistance[ 5m ] $obsLocation )
> >>>     then
> >>>         insert(new RadiationEvent( $obs, "Radiation over 10",
> >>> Event.THREAT_HIGH, $obsLocation, $obs.getSensor() ));
> >>> end
> >>>
> >>> rule "radiation-update"
> >>>     salience 5
> >>>     no-loop
> >>>     when
> >>>         $obs    : RadiationObservation( $obsLocation : location, value
> >
> >>> 10 ) over window:length(1) from entry-point lowLevelSensorStream
> >>>         $event     : RadiationEvent( this meets[ 25s ] $obs, location
> >>> geoIsWithinDistance[ 5m ] $obsLocation )
> >>>     then
> >>>         Event e = Event.clone($event);
> >>>         e.addObservation($obs);
> >>>         insert( e );
> >>>         retract($event);
> >>>         retract($obs);
> >>> end
> >>>
> >>> Is it possibile to define rules such the above using GUVNOR?
> >>> Are there some documentation or tutorial?
> >>>
> >>> Thanks a lot in advance,
> >>> Matteo Cusmai.
> >>>
> >>> _______________________________________________
> >>> rules-users mailing list
> >>> rules-users at lists.jboss.org
> >>> https://lists.jboss.org/mailman/listinfo/rules-users
> >>>
> >>>
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20120426/31ab515e/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Thu, 26 Apr 2012 14:40:27 +0100
> From: Michael Anstis <michael.anstis at gmail.com>
> Subject: Re: [rules-users] Guvnor guided editor and non argument
>        constructor
> To: Rules Users List <rules-users at lists.jboss.org>
> Message-ID:
>        <CAAG9P0tnkU2nLzXduz03si26uL-wFtRAA=0ogGAF05OJEZ4dGw at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Seems reasonable enough.
>
> On 26 April 2012 14:36, Sean Su <sean.x.su at gmail.com> wrote:
>
> > It seems that the new fact created by the guided editor must be from
> > the java class that has the default non argument constructor in
> > Guvnor. There seems no way we can customize it to pass arguments in.
> > This would force us to provide setters to the object.
> >
> > Is this a true statement?
> >
> > Thanks
> >
> > Sean
> >
> > Sent from my iPad
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20120426/75a0a7a7/attachment-0001.html
>
> ------------------------------
>
> Message: 4
> Date: Thu, 26 Apr 2012 11:42:41 -0500
> From: Bobby Richards <bobby.richards at gmail.com>
> Subject: [rules-users] looking for advice
> To: rules-users at lists.jboss.org
> Message-ID:
>        <CAAqkdrv7Nv1WMByZsd+XM=OZvetnEOFk03x7QaTGyNc6wAbccQ at mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> I have not yet determined how I want to implement my problem and was hoping
> to get some feedback.
>
> I am using drools to migrate the logic from my automated currency trading
> infrastructure.  Each currency pair, i.e. eurusd has around
> 200 attributes associated with it.
>
> This includes range values (high, low, average) for multiple time periods,
> volatility information, bid/ask updates etc.
>
> Currently I have classes associated for each, so say for range:
>
> class Range {
>  double high;
>  double low;
>  double avg;
> }
>
> Range europe = new Range();  //european trading hours
> Range us = new Range(); //us trading hours
>
>
> Questions:
> 1.  I am wondering if I should not just create a map that lists every
> attribute per pair as a key ("eurusd:range:europe:high")?  So essentially
> my drools session will have one fact, not counting the incoming quotes.  I
> see on the list that this was a problem before the mvel updates but that
> was a while ago.
>
> 2.  When an incoming quote might modify a value, what is the performance
> difference between using a rule to change the value or making the changes
> outside of the ksession and referencing the facthandler to modify?  Is one
> method considered 'cleaner'?
>
> Thanks,
> Bobby
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20120426/2b86c5f5/attachment-0001.html
>
> ------------------------------
>
> Message: 5
> Date: Thu, 26 Apr 2012 18:48:37 +0200 (CEST)
> From: Vincent LEGENDRE <vincent.legendre at eurodecision.com>
> Subject: Re: [rules-users] Guvnor guided editor and non argument
>        constructor
> To: Rules Users List <rules-users at lists.jboss.org>
> Message-ID:
>        <1c470056-3677-4bd2-a1eb-368610b51999 at confiance.eurodecision.fr>
> Content-Type: text/plain; charset="utf-8"
>
> JavaBeans convention : all default constructible and plenty of setters
> (for writeable properties) and getters (for readeable properties)
>
> ----- Mail original -----
>
> De: "Michael Anstis" <michael.anstis at gmail.com>
> ?: "Rules Users List" <rules-users at lists.jboss.org>
> Envoy?: Jeudi 26 Avril 2012 15:40:27
> Objet: Re: [rules-users] Guvnor guided editor and non argument constructor
>
>
> Seems reasonable enough.
>
>
> On 26 April 2012 14:36, Sean Su < sean.x.su at gmail.com > wrote:
>
>
> It seems that the new fact created by the guided editor must be from
> the java class that has the default non argument constructor in
> Guvnor. There seems no way we can customize it to pass arguments in.
> This would force us to provide setters to the object.
>
> Is this a true statement?
>
> Thanks
>
> Sean
>
> Sent from my iPad
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20120426/29fa9844/attachment-0001.html
>
> ------------------------------
>
> Message: 6
> Date: Thu, 26 Apr 2012 13:06:57 -0400
> From: Sean Su <sean.x.su at gmail.com>
> Subject: Re: [rules-users] Guvnor guided editor and non argument
>        constructor
> To: Rules Users List <rules-users at lists.jboss.org>
> Message-ID: <-6645870489207221519 at unknownmsgid>
> Content-Type: text/plain; charset="iso-8859-1"
>
> What I am prototyping is part of the event processing (with or without
> fusion). I want to use the rules created by the Guvnor to create the new
> events. However, as you would understand, once the event has been created,
> it should not be modified as it happened in the past.
>
> So I am trying to avoid setters if possible.
>
> Sean
>
> Sent from my iPad
>
> On Apr 26, 2012, at 12:49 PM, Vincent LEGENDRE <
> vincent.legendre at eurodecision.com> wrote:
>
> JavaBeans convention : all default constructible and plenty of setters (for
> writeable properties) and getters (for readeable properties)
>
> ------------------------------
> *De: *"Michael Anstis" <michael.anstis at gmail.com>
> *?: *"Rules Users List" <rules-users at lists.jboss.org>
> *Envoy?: *Jeudi 26 Avril 2012 15:40:27
> *Objet: *Re: [rules-users] Guvnor guided editor and non argument
> constructor
>
> Seems reasonable enough.
>
> On 26 April 2012 14:36, Sean Su <sean.x.su at gmail.com> wrote:
>
> > It seems that the new fact created by the guided editor must be from
> > the java class that has the default non argument constructor in
> > Guvnor. There seems no way we can customize it to pass arguments in.
> > This would force us to provide setters to the object.
> >
> > Is this a true statement?
> >
> > Thanks
> >
> > Sean
> >
> > Sent from my iPad
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.jboss.org/pipermail/rules-users/attachments/20120426/26a2bdaa/attachment.html
>
> ------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> End of rules-users Digest, Vol 65, Issue 93
> *******************************************
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120427/39498310/attachment-0001.html 


More information about the rules-users mailing list