using the no-loop attribute in your rule will prevent it from firing again<br><br><div class="gmail_quote">On Fri, Jan 23, 2009 at 12:50 PM, Dan Seaver <span dir="ltr"><<a href="mailto:dan.seaver@ge.com">dan.seaver@ge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Sounds like a very good idea. If you go forward with this, I'd love to see<br>
your method for solving the following type of problem:<br>
<br>
I need to update a particular object without causing the rule to re-fire.<br>
<br>
Say I have two classes, Stack and Board. I need to choose the Stack to put<br>
each Board, so one of these sorting rulles would look like this:<br>
<br>
when<br>
board : Board (thickness == 1)<br>
stack : Stack (location == "A")<br>
then<br>
board.setStack(stack);<br>
update(board);<br>
end<br>
<br>
The problem is the update statement puts the rule back in the Agenda to be<br>
fired again, thus an infinite loop. My solution in general has been to use a<br>
Collection to track boards that have been processed, but it seems to be alot<br>
of overhead. I'm not pleased by my solution.<br>
<br>
when<br>
board : Board (thickness == 1)<br>
stack : Stack (location == "A")<br>
processed : NamedCollection(name == "BoardsSorted", collection not<br>
contains board)<br>
then<br>
board.setStack(stack);<br>
update(board);<br>
processed.add(board);<br>
update(processed);<br>
end<br>
<br>
Also, the NamedCollection needs to be created, which I'm doing within the<br>
ruleset, which adds a somewhat meaningless to Business Analysts rule. Though<br>
I could create the NamedCollection in Java and add it to WorkingMemory prior<br>
to firing the rules, I'd like the rulesets to take care of themselves.<br>
<br>
My actual problem set is laced with many solutions that need to update<br>
objects. Even if the object is not directly related to the rule criteria, a<br>
map to the object needs to be created in the RHS so the LHS has a reference<br>
to the object being updated, thus posing the same problem as above.<br>
<br>
Your insights would be greatly appreciated.<br>
<br>
<br>
Mark Proctor wrote:<br>
><br>
> I'm going to try an informal experiment for the 4th of February at 5PM<br>
> GMT (Date/Time subject to change), we will run an online Drools Clinic<br>
> in the form of a Webinar. So the idea here isn't of a 60 minute<br>
> presentation, but really more of a 60 minute interactive Q&A where we<br>
> will use the desktop to assist in some explanations talking through code<br>
> or examples. What do people think?<br>
><br>
> Ideally we would have a set of pre-determined questions, with some adhoc<br>
> ones on the day too. Feel free to start listing your Qs here. I want to<br>
> avoid "What's WorkingMemory" type questions, but other than that,<br>
> anything is game. Also if anyone has anything cool they would like to<br>
> discuss about how they have used Drools, or just general interesting AI<br>
> ideas, then that's fine too - happy for this just to turn into a fun<br>
> geek chat too.<br>
><br>
> Mark<br>
><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>
><br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/Drools-Community-Clinic-Feb-4th-5PM-GMT-tp21623144p21629458.html" target="_blank">http://www.nabble.com/Drools-Community-Clinic-Feb-4th-5PM-GMT-tp21623144p21629458.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
<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>
</font></blockquote></div><br>