[rules-users] before/after behavior for negative pattern

Wolfgang Laun wolfgang.laun at gmail.com
Sat Sep 1 11:48:59 EDT 2012


You say that the first rule is working, but then you also write that
if the first event is a RawEvent neither one works. Isn't this a
contradiction?

According to the definition and using "t" for "timestamp", we have
   A after[x,y] B
equalling, by definition
   x <= A.t - B.t <= y
or
   B.t + x <= A.t <= B.t + y
and with [x,y] set to [0,90s] we have
   B.t <= A.t <= B.t + 90

(A before[x,y] B is the same except for exchanging the roles of A and B.)

However, any RawEvent R inhibits both rules from firing, since it matches
both the pattern after $start and the pattern after "not": its "id" is
necessarily the same and clearly
  R.t <= R.t <= R.t + 90

Try adding
   not RawEvent( this != $start, id == $start.id,...

-W



On 1 September 2012 17:28, Rob21 <rob.perrez at gmail.com> wrote:

> Hi all,
> I try to detect the beginning of a scenario which is characterized by an
> event happening after no other event of the same type has happened in the
> last 90sec.
> I can't understand why only the first of those two rules is working.
>
> rule "Detect Scenario beginning"
>     when
>         $start : RawEvent()
>         not RawEvent(id == $start.id, $start after[0ms, 90s] this)
>     then
>     System.out.println($start);
> end
>
> rule "Detect Scenario beginning alt"
>     when
>         $start : RawEvent()
>         not RawEvent(id == $start.id, this before[0ms, 90s] $start)
>     then
>     System.out.println($start);
> end
>
> Moreover if the first sent event is a rawEvent none of them will detect it.
> Where am i wrong ? (still a beginner with drools)
> PS : I already posted it on the forum, but i forgot to complete all the
> subscription steps so it was rejected. Sorry for the double post.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/before-after-behavior-for-negative-pattern-tp4019497.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/20120901/cbaf3e8a/attachment.html 


More information about the rules-users mailing list