First option:<br>You might use one &quot;abstract&quot; rule for the common part and rules using extends for the variants. The simple trick of matching a previously selected fact lets you split constraints across rule extensions.<br>
<br>rule a1234<br>when<br>    $fa: FactA( a1==X1,...a4 == X4 )<br>then<br>end<br><br>rule b1 extends a1234<br>when<br>    FactA( this == $fa, b1 == Y1 )<br>then<br>    //...<br>end<br><br>Second option:<br>Use rule templates or even decition tables in spreadsheets.<br>
<br>-W<br><br><br><div class="gmail_quote">2011/4/3 Hezi Stern <span dir="ltr">&lt;<a href="mailto:hezis@delegatecom.com">hezis@delegatecom.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 link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal">Hi all,</p><p class="MsoNormal"> </p><p class="MsoNormal">I have a general question regarding best practice or perhaps better put as right architecture design.</p>
<p class="MsoNormal"> </p><p class="MsoNormal">We are using Drools (Expert in particularly) to model and execute the behavior aspects of our service, which revolves around meeting scheduling between various users.</p><p class="MsoNormal">
 </p><p class="MsoNormal">My main challenge is how to properly structure the rules so that they provide the desired flexibility to both modify and control over time.</p><p class="MsoNormal"> </p><p class="MsoNormal">Following is a small example which illustrates my question:</p>
<p class="MsoNormal">I need to determine a specific execution time and it is based on many conditions and in general about 15 scenarios where I create a rule per scenario. I find that there is a wide set of conditions that are common to all scenarios.</p>
<p class="MsoNormal">So for example a rule would look like: </p><p class="MsoNormal"> </p><p class="MsoNormal">when </p><p class="MsoNormal">a1 == X1</p><p class="MsoNormal">a2 == X2</p><p class="MsoNormal">a3 == X3</p><p class="MsoNormal">
a4 == X4</p><p class="MsoNormal">b1 == Y1</p><p class="MsoNormal"> </p><p class="MsoNormal">Then </p><p class="MsoNormal">Something …</p><p class="MsoNormal"> </p><p class="MsoNormal">Another rule would be </p><p class="MsoNormal">
 </p><p class="MsoNormal">when </p><p class="MsoNormal">a1 == X1</p><p class="MsoNormal">a2 == X2</p><p class="MsoNormal">a3 == X3</p><p class="MsoNormal">a4 == X4</p><p class="MsoNormal">b2 == Y2</p><p class="MsoNormal">
 </p><p class="MsoNormal">Then </p><p class="MsoNormal">Something else …</p><p class="MsoNormal"> </p><p class="MsoNormal">As you can see I am duplicating the a’ conditions which are the common conditions and the b’ is a new unique condition. It seems to me like a poorer code maintainability and possibly performance reduction (but I may be wrong, perhaps this is how rules should be written).</p>
<p class="MsoNormal">I assume this is a common case in rules so my question is what would be the best way (architecturally wise) to implement such cases (e.g. insert a new class that indicates that conditions a’ are set and base the rules on the existence of such a class)</p>
<p class="MsoNormal"> </p><p class="MsoNormal">Thanks </p><p class="MsoNormal">Hezi  </p><font color="#888888"><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></font></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>