<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">You're missing the agenda. <div><br></div><div>http://en.wikipedia.org/wiki/Rete_algorithm#Conflict_resolution</div><div><br></div><div>In the rete algorithm the agenda is a list of activated rules who's actions are eligible to fire. The "first" one on the list is selected, it's action is fired, and the agenda might change as a result. "First" is in quotes because the agenda list is sorted by conflict resolution rules. One of those rules drools uses is specificity, which means that rules with more specific patterns (i.e. ones that select for a more specific set of working memory objects) are selected before less specific ones. You can't get any less specific than selecting nothing, so the empty LHS rule is selected last...<br><br>--- On <b>Tue, 11/16/10, Nirmal Fernando <i><nirmal070125@gmail.com></i></b>
wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Nirmal Fernando <nirmal070125@gmail.com><br>Subject: Re: [rules-users] Replacement for eval<br>To: "Rules Users List" <rules-users@lists.jboss.org><br>Date: Tuesday, November 16, 2010, 10:32 PM<br><br><div id="yiv46909824">Thanks for the replies!<br><br>I observed that the action of a rule not get executed straight after that rule activated.<br><br>Say my rules are following:<br><br>rule "Hello World"<br> when<br> then<br> System.out.println( "hello world" ); <br>
end<br><br>rule "GoodBye"<br> when<br> Message( status == Message.GOODBYE, myMessage : message )<br> then<br> System.out.println("good bye");<br>end<br><br>If I have set up my Message class such that it will fire the "GoodBye" rule, my output is:<br>
<br>good bye<br>hello world<br><br>What I wanna know whether this is the expected behaviour? (Since normally I expect the action of that particular rule to be executed straight after it's fired.)<br><br>Am I missing something here?<br>
<br>Thanks.<br><br><br><div class="yiv46909824gmail_quote">2010/11/16 Greg Barton <span dir="ltr"><<a rel="nofollow" ymailto="mailto:greg_barton@yahoo.com" target="_blank" href="/mc/compose?to=greg_barton@yahoo.com">greg_barton@yahoo.com</a>></span><br><blockquote class="yiv46909824gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex;">
<div><div>If you use bean property conventions for naming your methods you can use a regular condition element. for instance, you could rename emptyMessageFinder() to isMessageFound() or getMessageFound() and your condition would look like this:</div>
<div><br></div><div>when</div><div> m : Message(messageFound == true)</div><div>then</div><div>...</div><div>end</div><div><br></div><div>And when you do this the rete is used, birds sing in the trees, and world peace will be declared.<br>
<font color="#888888"><br>GreG</font></div><div class="yiv46909824im"><div><br>On Nov 16, 2010, at 5:37, Nirmal Fernando <<a rel="nofollow" ymailto="mailto:nirmal070125@gmail.com" target="_blank" href="/mc/compose?to=nirmal070125@gmail.com">nirmal070125@gmail.com</a>> wrote:<br><br></div>
<div></div></div><blockquote type="cite"><div><div class="yiv46909824im">Hi,<br><br>I have two questions.<br><br>1) Is there any other way/method in Drools to test the truth value of a condition other than "eval"? <br></div>
<div class="yiv46909824im">In almost all rules of my application needs to test conditions, and it takes ages to run
using "eval". <br>
<br>2) Say I have a java method which returns a boolean, and I have used it within an "eval" function. (eg: eval(message.emptyMessageFinder()) )<br>This "emptyMessageFinder()" method will return a "boolean" if there's an empty message. This function is containing many loops and recursive operations.<br>
<br>Will I get a performance improvement if I alternate the above such that the "emptyMessageFinder()" method sets a boolean attribute (anyEmptyMessage)<br>in the Message class to true and false, and I'm using following in my drl.<br>
<br>when <br> m: Message()<br> m.emptyMessageFinder()<br> eval(m.anyEmptyMessage) //can I use eval here??<br></div><div class="yiv46909824im">......<br><br>If someone can answer these questions it would be a great help!<br><br>
Thank you in advance!<br>
<br>-- <br>Best Regards,<br>Nirmal<br><br>C.S.Nirmal J. Fernando<br>Department of Computer Science & Engineering,<br>Faculty of Engineering,<br>University of Moratuwa,<br>Sri Lanka.<div><br></div><div>Blog: <a rel="nofollow" target="_blank" href="http://nirmalfdo.blogspot.com/"></a><a rel="nofollow" target="_blank" href="http://nirmalfdo.blogspot.com/">http://nirmalfdo.blogspot.com/</a></div>
<br>
</div></div></blockquote><div class="yiv46909824im"><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rules-users mailing list</span><br><span><a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></span><br>
<span><a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span><br></div></blockquote><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" ymailto="mailto:rules-users@lists.jboss.org" target="_blank" href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best Regards,<br>Nirmal<br><br>C.S.Nirmal J. Fernando<br>Department of Computer Science & Engineering,<br>Faculty of Engineering,<br>University of Moratuwa,<br>Sri Lanka.<div>
<br></div><div>Blog: <a rel="nofollow" target="_blank" href="http://nirmalfdo.blogspot.com/">http://nirmalfdo.blogspot.com/</a></div><br>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" href="/mc/compose?to=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></div></blockquote></div></td></tr></table><br>