[rules-users] CE not

Wolfgang Laun wolfgang.laun at gmail.com
Tue Oct 26 02:32:24 EDT 2010


The negated existence is represented by a "not" CE.

 $event1 : Event(eventNo == "A")
   not    Event(eventNo == "B", this  after[5s] $event1 )

A negated condition with respect to time still requires an EventB to be
present,
but with a constraint on (relative) timestamps.

Also, note that the startedby operator has a semantic that implies durations
for both events, which is not in your requirement.

-W

On 26 October 2010 07:11, david.bao <david.lg.bao at gmail.com> wrote:

>
> Hi,
>
> I'm a newbie of Drools Fusion. I have a requirement as following:
>
> If Event A is inserted into the working memory and in the following 5
> seconds there is no Event B, some action will be performed.
>
> Here is my rule script
>
> import com.foo.event.Event
>
> rule "test"
> when
>        $event1 : Event(eventNo == "A")
>        Event(eventNo == "B", this not startedby [5s] $event1 )
> then
>        System.out.println("there is no Event B in 5 seconds");
> end
>
> Java code:
> session.insert( event1 );
> clock.advanceTime( 6, TimeUnit.SECONDS );
> session.insert(event2);
> session.fireAllRules();
>
> this works. But if i do not insert event2 and the rule will not be fired.
>
> I also tried
> not Event(eventNo == "B", this startedby [5s] $event1 )
>
> not work also
>
> Thanks
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/CE-not-tp1771908p1771908.html
> Sent from the Drools - User 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/20101026/240bfb98/attachment.html 


More information about the rules-users mailing list