But

    $that : Thing(...)
    Thing( this != $that,...)

is the standard way of ensuring that a pattern matches two distinct objects of the same class, and there is no reason why you shouldn't be able to use it with not as well:

   $that : Thing(...)
   not ( Thing( this != $that,... ) )

"Given one Thing (with constraints...) and *not* having any *other* Thing (with constraints...), then..."

-W


2010/5/26 Georg Maier <Georg.Maier@cjt.de>

Hi,

 

I’m new to Drools and currently trying to implement some examples using CEP / Fusion. I got stuck on a problem to which I can’t find any solution in the online documentation, so I’m hoping for your help.

I’m trying to write a rule, which is activated whenever a certain event occurs and no event of the same type occurred in the e.g. last 5 minutes (or just at the same time). I know how to do it if these are events of different types, but I can’t find any way for events of the same type. What I tried is something like that:

 

$error : RouterErrorEvent ( $name : routerName ) from entry-point "abc"

not ($otherError : RouterErrorEvent ( (this coincides $error) && (routerName == $name) ) from entry-point "abc")

 

First of all there’s the problem, that $error and $otherError will be the same instance if a “RouterEventError” has been inserted from the “abc” entry point. Adding a (this != $error) to the second, ($otherError) obviously is no solution to that as well.

If it were two different events something like in example 2.19 would work:

 

$error1 : ErrorOneEvent( $id : id )

not ($error2 : ErrorTwoEvent( id == $id, this coincides $error1 ))

 

I’m kinda sure I’m missing something pretty “easy” here… or is this approach completely wrong?

As I’m aware of the fact that I couldn’t be more of a newbie J I would appreciate any suggestions for nice tutorials or further reading as well!

 

Thanks in advance!

 

Georg


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users