Great idea, they have a unique attribute (id) which can be
ordered! Sometimes it’s that simple… ;-)
Solved J
Thanks again
Georg
Von:
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] Im Auftrag von Swindells,
Thomas
Gesendet: Mittwoch, 26. Mai 2010 13:34
An: Rules Users List
Betreff: Re: [rules-users] Detecting two instances of the same
eventwithFusion Rules
You can solve this if you are able to put an ordering on the
Things.
Eg you could have
$that : Thing(...)
$other : Thing(this != $that, name > $that.name)
This assumes that names are unique.
Thomas
From: rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Georg Maier
Sent: 26 May 2010 12:27
To: Rules Users List
Subject: Re: [rules-users] Detecting two instances of the same
eventwithFusion Rules
Hi,
thanks for the reply. You are right, it’s just not working the
otherway round, if there would be no “not”
$that : Thing(..)
$other : Thing ( this != $that , …)
would match always twice. For example, if there were two
“Thing”’s A and B it would match for the combination AB as well as BA… I know
this was actually not my question, but I guess it was the reason I got confused
J
Thanks again!
Von: rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] Im Auftrag von Wolfgang Laun
Gesendet: Mittwoch, 26. Mai 2010 10:01
An: Rules Users List
Betreff: Re: [rules-users] Detecting two instances of the same event
withFusion Rules
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
**************************************************************************************
This message is confidential and intended only for the addressee. If you have
received this message in error, please immediately notify the
postmaster@nds.com and delete it from your system as well as any copies. The
content of e-mails as well as traffic data may be monitored by NDS for
employment and security purposes. To protect the environment please do not
print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX,
United Kingdom. A company registered in England and Wales. Registered no.
3080780. VAT no. GB 603 8808 40-00
**************************************************************************************