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(a)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(a)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(a)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(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users