<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16643" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY 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>&nbsp;</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&nbsp;4 seconds</FONT></DIV>
<DIV><FONT face=Arial size=2>Event "A" at time&nbsp;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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Alexander Claus</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=tirelli@post.com href="mailto:tirelli@post.com">Edson Tirelli</A> 
  </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=rules-users@lists.jboss.org 
  href="mailto:rules-users@lists.jboss.org">Rules Users List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, June 02, 2008 2:55 PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [rules-users] Retrieve 
  rulename in LHS</DIV>
  <DIV><BR></DIV><BR>&nbsp;&nbsp; Alexander,<BR><BR>&nbsp;&nbsp; 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>&nbsp;&nbsp; []s<BR>&nbsp;&nbsp; Edson<BR><BR>
  <DIV class=gmail_quote>2008/6/2 Alexander Claus &lt;<A 
  href="mailto:styjdt@claus4joy.de">styjdt@claus4joy.de</A>&gt;:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">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">www.jboss.com</A> </BLOCKQUOTE></BODY></HTML>