<br> Since you are interested in the presence of 3 events, does not matter if more of them occur, isn't simply the case of using the "exists" CE?<br><br>when<br> exists( <br> $e1 : Event( type == "A" ) and<br>
$e2 : Event( type == "A", <hapenned within 15 seconds of $e1> )<br> $e3 : Event( type == "A", <hapenned within 15 seconds of $e1> )<br> )<br>then<br> // do something<br>
end<br><br> There are variations of that, that you can use to trigger the rule once for each event type, but not multiple times for the same event type, etc. What do you think about it?<br><br> BTW, I think you will be glad to know that Drools 5 brings a whole new bunch of features for CEP processing that will make your life so much easier, including temporal constraints and support to events as first class citizens (allowing for sliding time windows, transparent garbage collection, etc). Maybe you can help us testing the milestone releases we will start to put out soon and provide use cases.<br>
<br> []s<br> Edson<br>
<br><br><br><div class="gmail_quote">2008/6/2 Alexander Claus <<a href="mailto:styjdt@claus4joy.de">styjdt@claus4joy.de</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">Yes, I checked the rule attributes for
applicability for my needs. Unfortunately I did not find a way, how this could
help me.</font></div>
<div><font face="Arial" size="2">Here is my scenario:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">I want to use Drools as engine for complex event
processing / event correlation. My current approach is to insert the events as
facts containing a timestamp into the working memory and then do
"timestamp-arithmetics".</font></div>
<div><font face="Arial" size="2">That I need a mechanism to mark events as
processed, you can see, if you consider the following type of rule:</font></div>
<div><font face="Arial" size="2">"If there are 3 occurrences of Event "A" within 15
seconds, then fire".</font></div>
<div><font face="Arial" size="2">Now consider the event sequence:</font></div>
<div><font face="Arial" size="2">Event "A" at time 0 seconds</font></div>
<div><font face="Arial" size="2">Event "A" at time 4 seconds</font></div>
<div><font face="Arial" size="2">Event "A" at time 8 seconds</font></div>
<div><font face="Arial" size="2">Event "A" at time 12 seconds</font></div>
<div><font face="Arial" size="2">Obviously I want my rule to be fired, if the first
three events were detected. But, without marking the first three events as
processed by this rule, the arrival of the fourth event creates 3 new
activations:</font></div>
<div><font face="Arial" size="2">Events 1,2,4</font></div>
<div><font face="Arial" size="2">Events 1,3,4</font></div>
<div><font face="Arial" size="2">Events 2,3,4</font></div>
<div><font face="Arial" size="2">I think it's clear that I'm not interested in these
last three rule firings.</font></div>
<div><font face="Arial" size="2">Note, that we have here only one rule, so locking
should prevent the rule from firing at all.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">So, currently I mark each event occurring in the
LHS of a rule in the RHS as processed by this rule and check in the LHS, if the
events are not processed by the rule.</font></div>
<div><font face="Arial" size="2">I know, not very elegant, but I found this to be
the easiest way.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">So, if you have suggestions how to overcome this
lack of elegance, please let me know.</font></div>
<div><font face="Arial" size="2">Thanks.</font></div>
<div><font face="Arial" size="2"></font> </div><font color="#888888">
<div><font face="Arial" size="2">Alexander Claus</font></div></font><div><div></div><div class="Wj3C7c">
<div><font face="Arial" size="2"></font> </div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="tirelli@post.com" href="mailto:tirelli@post.com" target="_blank">Edson Tirelli</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org" target="_blank">Rules Users List</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Monday, June 02, 2008 2:55 PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> Re: [rules-users] Retrieve
rulename in LHS</div>
<div><br></div><br> Alexander,<br><br> Seems a lot of
cumbersome code to control rule execution, and something that should probably
not be done that way. Did you looked at the lock-on-active rules attribute?
Can't you use it together with either rule-flow or agenda-groups to achieve
your goal without manually controlling rules x fact
execution?<br><br> []s<br> Edson<br><br>
<div class="gmail_quote">2008/6/2 Alexander Claus <<a href="mailto:styjdt@claus4joy.de" target="_blank">styjdt@claus4joy.de</a>>:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br><br>I
wonder if there is a way to get the rulename in the LHS of a rule
directly<br>via DRL. I found a post here:<br><a href="http://article.gmane.org/gmane.comp.java.drools.user/8373" target="_blank">http://article.gmane.org/gmane.comp.java.drools.user/8373</a>,
which describes a<br>solution to get the rulename in the RHS of a rule. But
that doesn't work in<br>the LHS.<br><br>I need this to mark some facts as
processed by the current rule, so that the<br>facts do not trigger rule
firing again together with other facts. Currently<br>I use an arbitrary
string, which is only used by one rule. But for the sake<br>of convenience,
it would be nice to use such an "automated" mechanism for<br>getting the
rulename as this unique identifier string.<br><br>Thanks in
advance.<br><font color="#888888">Alexander Claus
<br>_______________________________________________<br>rules-users mailing
list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Edson Tirelli<br>JBoss Drools Core Development<br>Office:
+55 11 3529-6000<br>Mobile: +55 11 9287-5646<br>JBoss, a division of Red Hat @
<a href="http://www.jboss.com" target="_blank">www.jboss.com</a> </blockquote></div></div></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>