<br>   :) I do believe you are seeing this errors, but I have no idea why. I just created a new drools project in my eclipse environment, set the target runtime to Drools 5.0.1, and copy and pasted your rules bellow. I executed a the rules and I got the correct results:<br>
<br>----------<br>Rule Definitions TermContractions 1.1 Executed<br>----------<br><br>   I have no error in my eclipse either, so I guess you have some other problem (maybe in your environment) going on there...<br><br>   Edson<br>
   <br><br><div class="gmail_quote">2010/3/5 Moe Alkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com">moe.alkhafaji@medcpu.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;">
Thanks Edson. I wish I can send a screen shot, but I just had a bunch of white lines in the file on top of this. I removed all the bad lines, and simplified the rule to isolate any potential problem outside of this. Here is the simplified version (entire content of the rule file):<br>


<br>#created on: Jun 23, 2009<br>package com.medcpu.eephratobmain<div class="im"><br><br>rule &quot;Definitions TermContractions 1.1&quot;<br>    when<br></div>        eval(1 == 1)<br>    then<br>        System.out.println(&quot;Rule Definitions TermContractions 1.1 Executed&quot;);<div class="im">
<br>

end<br><br>rule &quot;TermContractions 2.8&quot; extends &quot;Definitions TermContractions 1.1&quot;             &lt;=== Line 11<br>    when<br></div>        eval(2 == 3)<br>    then<br>        System.out.println(&quot;Rule TermContractions 2.8 Executed&quot;);<br>


end<br><br>And here are the errors again:<div class="im"><br><br>nds.when cannot be resolved to a type                                                   MPU/src/rules    EEphratOBMain.drl    line 11    <br></div><div class="im">
Syntax error on token &quot;&quot;Definitions TermContractions 1.1&quot;&quot;, . expected     MPU/src/rules    EEphratOBMain.drl    line 11    <br>

Syntax error on token &quot;then&quot;, invalid AssignmentOperator                        MPU/src/rules    EEphratOBMain.drl    line 11    <br></div>Syntax error, insert &quot;;&quot; to complete BlockStatements                              MPU/src/rules    EEphratOBMain.drl    line 11    <br>


The left-hand side of an assignment must be a variable                            MPU/src/rules    EEphratOBMain.drl    line 11    <br>unknown:11:28 mismatched token: [@42,260:266=&#39;extends&#39;,&lt;7&gt;,11:28]; expecting type THEN    MPU/src/rules    EEphratOBMain.drl <br>
<div><div></div><div class="h5">

<br><br><div class="gmail_quote">2010/3/5 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com" target="_blank">ed.tirelli@gmail.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;">


<br>   These error messages don&#39;t make much sense to me, but it is accusing error on line 19 now... considering that I removed lines and the error before was on line 11, isn&#39;t this another problems in rules down in the file?<div>


<div></div><div><br>
<br>   Edson<br><br><div class="gmail_quote">2010/3/5 Moe Alkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com" target="_blank">moe.alkhafaji@medcpu.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;">



Thanks Edson,<br><br>I tried using the rules you pasted below, and here are the errors again (same line)<br><br><br>nds.when cannot be resolved to a type                                                  MPU/src/rules    EEphratOBMain.drl    line 19    <br>





Syntax error on token &quot;&quot;Definitions TermContractions 1.1&quot;&quot;, . expected    MPU/src/rules    EEphratOBMain.drl    line 19    <br>Syntax error on token &quot;then&quot;, invalid AssignmentOperator                       MPU/src/rules    EEphratOBMain.drl    line 19    <br>





Syntax error, insert &quot;;&quot; to complete BlockStatements                             MPU/src/rules    EEphratOBMain.drl    line 19    <br>The left-hand side of an assignment must be a variable                           MPU/src/rules    EEphratOBMain.drl    line 19   <br>





unknown:19:28 mismatched token: [@134,611:617=&#39;extends&#39;,&lt;7&gt;,19:28]; expecting type THEN    MPU/src/rules    EEphratOBMain.drl <br><br><br>I also understand about what you saying regarding additional things I have to do to ensure that only the child rule executes, but I want to go through the first step first :) Thanks!<div>



<div></div><div><br>

<br><div class="gmail_quote">2010/3/5 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com" target="_blank">ed.tirelli@gmail.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;">





<br>   Hmmm, you should be receiving a duplicate variable declaration error... would you please open a JIRA for us to double check what is happening and fix the error message?<br><br>   Meanwhile, try without repeating the constraints on the parent rule in the child rule:<div>





<br>
<br>rule &quot;Definitions TermContractions 1.1&quot;<br>    when<br>        mpr : MPUFacade()<br>

        eval(!mpr.isImportant(Constants.FINDING_KEYWORD_Contractions_Frequency))<br>    then<br>        mpr.print(&quot;Rule Definitions TermContractions 1.1 Executed&quot;);<br>end<br><br>rule &quot;TermContractions 2.8&quot; extends &quot;Definitions TermContractions 1.1&quot;              <br>





</div>
    when<div><br>        eval(!mpr.isImportant(Constants.FINDING_KEYWORD_TEST))<br>    then<br>        mpr.print(&quot;Rule TermContractions 2.8 Executed&quot;);<br>end<br><br></div>    Also, remember that unless you use some of the tricks I mentioned before, both rules will fire.<br>






<br>   []s<br>   Edson<br><br><br><div class="gmail_quote">2010/3/5 Moe Alkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com" target="_blank">moe.alkhafaji@medcpu.com</a>&gt;</span><div><div></div><div>





<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Here are the rules that I created (sorry for breaking that in multiple emails), I hope this is all the information needed:<br><br>rule &quot;Definitions TermContractions 1.1&quot;<br>    when<br>        mpr : MPUFacade()<br>








        eval(!mpr.isImportant(Constants.FINDING_KEYWORD_Contractions_Frequency))<br>    then<br>        mpr.print(&quot;Rule Definitions TermContractions 1.1 Executed&quot;);    <br>end<br><br>rule &quot;TermContractions 2.8&quot; extends &quot;Definitions TermContractions 1.1&quot;                  &lt;=== Line 11<br>








    when<br>        mpr : MPUFacade()    <br>        eval(!mpr.isImportant(Constants.FINDING_KEYWORD_Contractions_Frequency))<br>        eval(!mpr.isImportant(Constants.FINDING_KEYWORD_TEST))<br>    then<br>        mpr.print(&quot;Rule TermContractions 2.8 Executed&quot;);<br>








end<div><div></div><div><br><br><div class="gmail_quote">On Fri, Mar 5, 2010 at 12:33 PM, Moe Alkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com" target="_blank">moe.alkhafaji@medcpu.com</a>&gt;</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;">

Specifically speaking, here is what I get on Eclipse when I do that:<br><br><br>nds.when cannot be resolved to a
type                                                 MPU/src/rules   
EEphratOBMain.drl    line 11    <br>Syntax error on token &quot;:&quot;, ;
expected                                                   
MPU/src/rules    EEphratOBMain.drl    line 11    <br>Syntax error on token &quot;&quot;Definitions TermContractions 1.1&quot;&quot;, . expected    MPU/src/rules    EEphratOBMain.drl    line 11    <br>Syntax error on token &quot;then&quot;, invalid AssignmentOperator                       MPU/src/rules    EEphratOBMain.drl    line 11    <br>









Syntax
error, insert &quot;;&quot; to complete
Statement                                       MPU/src/rules   
EEphratOBMain.drl    line 11    <br>Syntax error, insert &quot;;&quot; to
complete Statement                                      
MPU/src/rules    EEphratOBMain.drl    line 11    <br>Syntax error,
insert &quot;;&quot; to complete Statement                                      
MPU/src/rules    EEphratOBMain.drl    line 11    <br><br>Line 11 is:<br>
<br><b>
rule &quot;TermContractions 2.8&quot; extends &quot;Definitions TermContractions 1.1&quot;</b><br>
<br>
and &quot;Definitions TermContractions 1.1&quot; is another rule defined in the same drl.<div><div></div><div><br>
<br><br><div class="gmail_quote">On Fri, Mar 5, 2010 at 12:04 PM, Moe Alkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com" target="_blank">moe.alkhafaji@medcpu.com</a>&gt;</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;">









Thanks Edson, I will try that. However, I have one follow up question. I tried to use the &quot;extends&quot; command and it did not work (it gave me a syntax error). I am using the latest Drools 5.0 M1. Could it be because the Eclipse Drools plugin does not support this feature yet and if I ignore this error on Eclipse it would still work at runtime?<br>










<br>Thanks!<br><br><div class="gmail_quote">2010/3/5 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com" target="_blank">ed.tirelli@gmail.com</a>&gt;</span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">










<br>      Although I noticed the other day that this is not documented yet, Drools 5.0.x does support rule inheritance. In your case, it would be written as:<br><br>rule r1<br>when<br>   A()<br>then<br>   // do something<br>











end<br><br>rule r2 extends r1<br>when<br>   B()<br>then<br>   // do something else<br>end<br><br>    When using inheritance, the subrule will inherit the whole LHS of the parent rule.<br><br>    Integration test here:<br>











<br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/extend_rule_test.drl" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/extend_rule_test.drl</a><br>











<a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_RuleExtend.drl" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_RuleExtend.drl</a><br>











<br>    In your case, you have an extra requirement that if a child rule fires, you don&#39;t want the parent rule to fire. My suggestion is either doing this with a logical condition, or adding drools.halt() on the consequence of rules that should stop subsequent firings, or using activation-groups + salience. Example, in the above case, you could have:<br>











<br>rule r1<br>   activation-group &quot;example rules&quot;<br>   salience 10<br>
when<br>
   A()<br>
then<br>
   // do something<br>
end<br>
<br>
rule r2 extends r1<br>
   activation-group &quot;example rules&quot;<br>
   salience 20<br>

when<br>
   B()<br>
then<br>
   // do something else<br>
end<br>
<br>   Since rule 2 has a higher salience, if it activates it will fire first, and due to the activation-group, it will cancel the activation of r1 preventing it to fire.<br><br>   Hope it helps.<br><br>   Edson<br><br><div class="gmail_quote">











2010/3/5 malkhafaji <span dir="ltr">&lt;<a href="mailto:moe.alkhafaji@medcpu.com" target="_blank">moe.alkhafaji@medcpu.com</a>&gt;</span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">











<br>
Hello,<br>
<br>
I know, from searching this forum and posting before, that the concept of<br>
inheritance does not exist today in Drools. However, I have a need for it.<br>
Here is my specific situation:<br>
<br>
I have certain rules that have some generic conditions to be fired:<br>
<br>
Rule 1<br>
If A Then X end<br>
<br>
Rule 2<br>
If A, B Then Y end<br>
<br>
What I would like to do is, if Rule 2 is true, then I don&#39;t want Rule 1 to<br>
execute. I have many and many of those rules, so combining all the<br>
conditions in less number of rules violates our design having rules being<br>
mutually exclusive. That is why I wanted to include this behavior as a<br>
natural inheritance behavior rather than forcing the flow with logic inside<br>
the rule itself (you will make rules aware of others this way).<br>
<br>
So, since there is not built-in feature that allows you to do that, do<br>
people suggest anything that I can do without having to mix Rule 1 and Rule<br>
2 into one rule with complex conditional statements? Any ideas?<br>
<br>
The only thing I can think of is taking this logic processing outside of<br>
drools, which is something that I am not too excited about.<br>
<br>
Thanks.<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://n3.nabble.com/Inheritance-Like-Design-Question-tp430848p430848.html" target="_blank">http://n3.nabble.com/Inheritance-Like-Design-Question-tp430848p430848.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<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>
</font></blockquote></div></div></div><font color="#888888"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>











</font><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><font color="#888888"><br><br clear="all"><br>-- <br>Moe Alkhafaji<br>Chief Technology Officer, MedCPU<br>Phone: (630) 290-1113<br>Email: <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a><br>









<br>This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a> and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company.<br>











</font></blockquote></div><br><br clear="all"><br>-- <br>Moe Alkhafaji<br>Chief Technology Officer, MedCPU<br>Phone: (630) 290-1113<br>Email: <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a><br><br>This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a> and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company.<br>










</div></div></blockquote></div><br><br clear="all"><br>-- <br>Moe Alkhafaji<br>Chief Technology Officer, MedCPU<br>Phone: (630) 290-1113<br>Email: <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a><br><br>






This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a> and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company.<br>









</div></div><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><div><div></div><div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>






</div></div><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><br><br clear="all"><br>-- <br>Moe Alkhafaji<br>Chief Technology Officer, MedCPU<br>Phone: (630) 290-1113<br>Email: <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a><br><br>This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a> and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company.<br>






</div></div><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><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</div></div><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><br><br clear="all"><br>-- <br>Moe Alkhafaji<br>Chief Technology Officer, MedCPU<br>Phone: (630) 290-1113<br>Email: <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a><br><br>This message contains information which may be confidential. Unless you are the addressee, you may not use, copy or disclose to anyone the message or any information contained in this message. If you have received this email in error, please notify <a href="mailto:cto@medcpu.com" target="_blank">cto@medcpu.com</a> and please delete the message immediately. In order for the contents of this message to be binding on behalf of MedCPU it must be confirmed in writing by an authorized signatory of MedCPU. Our company accepts no liability for the content of this email unless it is so confirmed. The views or opinions presented herein do not necessarily represent those of the company.<br>



</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><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>