Good point. I've been using this in a couple of my solutions and was worried that I was creating implicit dependencies, ie. you need to assume Rule 2 is there. I also find that it can complicate the rules to ensure firing is correct or avoid looping.<div>
<br></div><div>I assume your saying the conditions of Rule 1 should be rewritten to accommodate Rule 2, and given the various conditions Rule 1 may actually be split into multiple rules that may call the RHS (now a function) of Rule 2 depending on conditions.</div>
<div><br></div><div>On the other hand is there not a case for building up a knowledge base of facts that rules can act on. How do you separate these situations.<br><br><div class="gmail_quote">2009/12/4 Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have some reservations w.r.t. the proposed solution. One has to assume that "Rule 2" is there (and should continue to be so) to fire when its condition is true, irrespective of what goes on due to "Rule 1". The only way to do this is by writing<br>
InsertedFact()<br> or<br> condition-of-rule2()<br>and this would make any bindings in condition-of-rule2() unusable in the rule's consequence.<br><br>If by "firing" is meant that the RHS of Rule 2 is to be executed, simply add the statements of the consequence to the ones of Rule 1. (Wrapping it in a function avoids code duplication.)<br>
<br>-W <br><br><br><br><div class="gmail_quote">2009/12/4 Ross H <span dir="ltr"><<a href="mailto:rossh00@gmail.com" target="_blank">rossh00@gmail.com</a>></span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Insert a new fact that causes Rule 2 to fire. That way you can decouple your logic and gain more flexibility to add more rules based on this new fact.<br><br><div class="gmail_quote">2009/12/4 Deepak Jambhekar <span dir="ltr"><<a href="mailto:deepak.jambhekar@tcs.com" target="_blank">deepak.jambhekar@tcs.com</a>></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></div><div><font size="2" face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif"><div>
Hi...</div><div> In one of my requirments I need to fire a rule from another rule... i.e.</div>
<div> when </div><div> <span style="font-family:Monaco,Verdana,Arial,Helvetica,sans-serif;font-size:11px"><font color="#008000"><font color="#960000">rule</font><font color="#000000"> </font>"Rule 1"</font></span></div>
<p style="margin:0px"><font color="#960000"><font color="#000000"><span style="white-space:pre">        </span></font>when</font></p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><span style="white-space:pre">                </span>condition()</p>
<p style="margin:0px"><font color="#960000"><font color="#000000"><span style="white-space:pre">        </span></font>then</font></p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><span style="white-space:pre">        </span> someaction()</p>
<p style="margin:0px;font-family:Monaco;font-style:normal;font-variant:normal;font-weight:normal;font-size:11px;line-height:normal;font-size-adjust:none;font-stretch:normal"><span style="white-space:pre">        </span> then it should fire another rule Rule2</p>
<p style="margin:0px"><font color="#960000">end</font></p><p style="margin:0px"><font color="#960000"> <span style="font-family:'Default Sans Serif',Verdana,Arial,Helvetica,sans-serif;font-size:small"><font color="#000000"> <span style="font-family:Monaco,Verdana,Arial,Helvetica,sans-serif;font-size:11px"><font color="#008000"><font color="#960000">rule</font><font color="#000000"> </font>"Rule 2"</font></span></font></span></font></p>
<p style="margin:0px"><font color="#960000"><font color="#000000"><span style="white-space:pre">        </span></font>when</font></p><p style="margin:0px">
<span style="white-space:pre">                </span>condition()</p><p style="margin:0px"><font color="#960000"><font color="#000000"><span style="white-space:pre">        </span></font>then</font></p>
<p style="margin:0px"><span style="white-space:pre">        </span> someaction()</p><p style="margin:0px"><span style="white-space:pre">        </span><font color="#960000">end</font></p>
<div>Can we achieve this in Guvnor??</div><div>please help....<br><br></div><div>Thanks<br>Deepak Prabhakar Jambhekar<br><br></div></font><pre>=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
</pre>
<br></div></div>_______________________________________________<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>
<br></blockquote></div><br>
<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>
<br></blockquote></div></div></div><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></blockquote></div><br></div>