take a look at section <br><h5 class="title"><a id="d0e5167">4.8.2.10.1. Accumulate Functions</a></h5>of the drools expert doc<br><br><a href="http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html">http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html</a><br>
<br><div class="gmail_quote">2010/6/23 Earnest Dyke <span dir="ltr">&lt;<a href="mailto:earniedyke@yahoo.com">earniedyke@yahoo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;"><div>Greg,<br><br>Thanks for the example. This should do what I need. Can you point me to some documentation on how to create custom operators?<br>
<br>Earnie!<br></div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Greg Barton &lt;<a href="mailto:greg_barton@yahoo.com" target="_blank">greg_barton@yahoo.com</a>&gt;<div class="im">
<br><b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br></div><b><span style="font-weight: bold;">Sent:</span></b> Tue, June 22, 2010 4:29:50 PM<div>
<div></div><div class="h5"><br><b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Inter-fact comparison<br></div></div></font><div><div></div><div class="h5"><br>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
A regular old accumulate could do this.  Doesn&#39;t even have to be custom:<br><br>rule &quot;many bogus attempts&quot;<br>when<br>$login : Login( $baseName : name)<br>$total : Number( intValue &gt; 5 )<br>from accumulate( Login( this != login, eval(levenshtein(name, baseName) ),<br>
init( int total = 0; ),<br>action( total++; ),<br>reverse( total--; ),<br>result( total ) )<br>then<br>//ALARM!<br>end<br><br>This basically says &quot;accumulate all Logins where the name is within a levenshtein distance of a given Login and freak out if there&#39;s more than X.&quot;<br>
<br>This rule isn&#39;t all fusiony, but you get the idea.  Also, the eval in the accumulate could be a custom operator for readability.<br><br>--- On <b>Tue, 6/22/10, Earnest Dyke <i>&lt;<a href="mailto:earniedyke@yahoo.com" target="_blank">earniedyke@yahoo.com</a>&gt;</i></b> wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Earnest Dyke &lt;<a href="mailto:earniedyke@yahoo.com" target="_blank">earniedyke@yahoo.com</a>&gt;<br>Subject: Re: [rules-users] Inter-fact comparison<br>
To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>Date: Tuesday, June 22, 2010, 2:57 PM<br><br><div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;">
<div>Thanks for the quick reply. <br><br>Yes, the original facts are already coming in via a stream (Fusion) to an existing set of rules so I was hoping to build on that. What I am trying to do is evaluate logins information as users are attempting to login trying to identify hack attempts by a person trying to login with a slightly different user name over a given period of time.<br>
<br>Earnie!<br></div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> David Sinclair &lt;<a href="mailto:dsinclair@chariotsolutions.com" target="_blank">dsinclair@chariotsolutions.com</a>&gt;<br>
<b><span style="font-weight: bold;">To:</span></b> Rules Users List
 &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Tue, June 22, 2010 3:47:36 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Inter-fact comparison<br>
</font><br>
Hi Earnie,<br><br>What you are explaining seems pretty straight forward and would more likely than not be overkill to use a rule engine. Are there other aspects of the system you are leaving out that warrant the use of Drools?<br>

<br>dave<br><br><div class="gmail_quote">2010/6/22 Earnest Dyke <span dir="ltr">&lt;<a rel="nofollow">earniedyke@yahoo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;">Greetings all,<br><br>I have a requirement to compare a set of facts against each other, calculate a value that indicates the amount of difference (Levenshtein distance) between a single attribute on each fact. So I load all of my facts into working memory then what? Do I execute a rule first that creates a new set of facts which is a Cartesian product of the original set of facts, each new fact containing a reference to two original facts and the diff between them? Looked at using a custom accumulate function but I don&#39;t think that&#39;s going to do what I need since it is intended to go through a set of facts and return a single value.<br>

<br>Any and all related help is appreciated.<br><br>Earnie! <br></div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" 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>
</div></div>
</div></div><br>-----Inline Attachment Follows-----<br><br><div>_______________________________________________<br>rules-users mailing list<br><a rel="nofollow">rules-users@lists.jboss.org</a><br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></blockquote></td></tr></tbody></table><br>

      </div></div></div></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>