[rules-users] Combination of conditions doesn't work

Michael Anstis michael.anstis at gmail.com
Thu Apr 7 10:34:59 EDT 2011


@FrankVhh

Entry-points are used with CEP; you'll find details in the Fusion
documetation.

With kind regards,

Mike

On 7 April 2011 15:21, FrankVhh <frank.vanhoenshoven at agserv.eu> wrote:

> Hi Sariman,
>
> The trick with "from entry-point", is quite unfamiliar to me. There might
> be
> some problem with that, but I cannot tell by looking at it.
>
> However, there are a few problems with the rules that you have printed out
> for us.
>
> 1) The way I understand it, they do not do what they should be doing. You
> said you do NOT want an action when all sensors evaluate to true. In your
> case, you are evaluateing whether all sensors are false. This is pretty
> useless if you already have a rule which evaluates the existence of at
> least
> 1 "true" sensor. The way I would put this is like this:
>
> rule "Myrule"
>        when
>                #conditions
>                sensorEvent1: SensorEvent(booleanValue == true)
>                exists( SensorEvent(booleanValue == false) )
>        then
>                #actions
> end
>
> 2) There are some errors in your rule. No idea whether this is a copy/paste
> or a read/type, so I will just point them out.
>    - ";" is usually not needed in a LHS, I am not familiar with the from
> entry-point syntax, but I assume it wouldn't be needed
>    - There is a ")" in excess in one of your conditions
>
> 3) I don't think it makes sense to put your rules as you did in the second
> example. Even if you are trying to examine whether those three sensors are
> false.
>
> On a personal note: what does from entry-point do? I must have overlooked
> it
> in the documentation.
>
> Regards,
> Frank
>
>
> sariman wrote:
> >
> > To keep it short, I have three sensors providing me some values every x
> > seconds. I am running an algorithm over those values and getting at the
> > end a single value for each sensor. Next I check if this value is
> > greater/less than a threshold value and creating an object and setting
> its
> > booelan value to true/false. The last part looks like this:
> >
> > SensorEvent sensorEvent = new SensorEvent ();
> >               sensorEvent.setBoolean(booleanValue);
> >               sensorEvent.setSensorID(sensorID);
> >
> > I want to do some actions if one of the sensors has "true" and this
> works.
> > But I want no action if all sensors have "true". And this part doens't
> > work. If I only check one of the sensors if it is "false" it is ok but
> the
> > combination doesn't work. It means this case seems naver to happen. No
> > exception or error but no system print either. Here is the code snippet
> > from my rules file:
> >
> > declare SensorEvent
> >       @role(event)
> > end
> >
> >
> > rule "All false"
> >
> >       when
> >               #conditions
> >               sensorEvent1    : SensorEvent(sensorID == 1 , booleanValue
> == false)    from
> > entry-point "Default";
> >               sensorEvent2    : SensorEvent(sensorID == 5 , booleanValue
> == false) )  from
> > entry-point "Default";
> >               sensorEvent3    : SensorEvent(sensorID == 6 , booleanValue
> == false)    from
> > entry-point "Default";
> >
> >       then
> >               #actions
> >               System.out.println(" All false!! -> ");
> >
> > end
> >
> >
> > I run the engine in stream mode and every single value (or object) is
> > being inserted after I receieved the value. I also tried this variant but
> > it didn't work either:
> >
> > rule "All false"
> >
> >       when
> >               #conditions
> >               sensorEvent1    : SensorEvent(sensorID == 1 )   from
> entry-point "Default";
> >               sensorEvent2    : SensorEvent(sensorID == 5 )   from
> entry-point "Default";
> >               sensorEvent3    : SensorEvent(sensorID == 6 , booleanValue
> == false &&
> > sensorEvent1.booleanValue == false && sensorEvent2.booleanValue ==
> false))
> > from entry-point "Default";
> >
> >       then
> >               #actions
> >               System.out.println(" All false!! -> ");
> >
> > end
> >
> > Any suggestions?
> >
>
>
> --
> View this message in context:
> http://drools-drools-expert-drools-fusion-guvnor-drools-planner.46999.n3.nabble.com/Combination-of-conditions-doesn-t-work-tp2789735p2790446.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110407/b717d9d4/attachment.html 


More information about the rules-users mailing list