<div dir="ltr"><br>&nbsp;&nbsp; Yes, it is a new feature on Drools 4. Please note that Drools 4 has a huge amount of improvements in comparison to Drools 3, and we strongly advise the upgrade.<br>&nbsp;&nbsp; If you really want to stay on Drools 3, you should contact Red Hat for support. Not sure it is possible, but you may try.<br>
<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/8/21 Maxim Veksler <span dir="ltr">&lt;<a href="mailto:maxim.veksler@gmail.com">maxim.veksler@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;">
<div dir="ltr"><br><div class="gmail_quote"><div class="Ih2E3d">On Wed, Aug 20, 2008 at 8:57 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.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;">
<div dir="ltr"><br>&nbsp;&nbsp; You are using variables (like $nissan) before binding them. Remember you can only use a variable &quot;after&quot; binding it.<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson</div></blockquote></div><div><br>Please allow me to a related question, regarding drools 3.0.x<br>

<br>In this LHS example, mentioned in this thread :<br><br>&quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $fred : Golfer( name == &quot;Fred&quot;)<div class="Ih2E3d"><br>&nbsp; &nbsp; &nbsp;&nbsp; $bob : Golfer( name == &quot;Bob&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;position != $fred.position,<br></div>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color == &quot;plaid&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color != $fred.color)<br>&quot;&quot;&quot;<br><br>$fred is a bind variable, but how is it possible to use a data member from this variable inside another node&#39;s ruling ? <br><br>Judging from Drools 3, this should have failed with compilation errors, assuming that it&#39;s a new feature of Drools 4, is there a possibility to implement this behavior in drools3? as it would be great help for me in my rules.<br>

<br>// Just for reference, the way I would implement the above logic in Drools 3 is :<br><br>
&quot;&quot;&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $fred : Golfer( name == &quot;Fred&quot;, $fredPosition : position, $fredColor : color)<br>
&nbsp; &nbsp; &nbsp;&nbsp; $bob : Golfer( name == &quot;Bob&quot;,<br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;position != $fredPosition,<br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color == &quot;plaid&quot;,<br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color != $fredColor)<br>
&quot;&quot;&quot;<br>
<br><br>Thank you,<br>Maxim.<br></div><div><div></div><div class="Wj3C7c"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br>
<br><div class="gmail_quote">2008/8/20 Marcin Krol <span dir="ltr">&lt;<a href="mailto:mrkafk@gmail.com" target="_blank">mrkafk@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;">Hello everyone,<br>
<br>
I managed to produce my first example of Drools rules. However, I am having problems with some field restrictions:<br>
<br>
Racing order:Unable to create restriction &#39;[QualifiedIndentifierRestr: != $nissan.pos ]&#39; for field &#39;pos&#39; in the rule &#39;Racing order&#39;<br>
<br>
The problem is only SOME field restrictions produce this error. Other field restrictions don&#39;t!<br>
<br>
If anybody has a hint or knows why this is not working, please let me know, I would greatly appreciate it.<br>
<br>
<br>
<br>
The rules are:<br>
<br>
<br>
#created on: 2008-08-20<br>
package com.sample<br>
<br>
#list any import classes here.<br>
<br>
#declare any global variables here<br>
<br>
dialect &quot;mvel&quot;<br>
<br>
import com.sample.Car;<br>
<br>
rule &quot;Racing order&quot;<br>
 &nbsp; &nbsp;when<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// Porsche was not red<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$porsche : Car( manufacturer == &quot;Porsche&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos != $nissan.pos,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos != $subaru.pos,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color != &quot;red&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//color != &quot;blue&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//color != $nissan.color,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//color != $subaru.color<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// First car was Nissan<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$nissan : Car( manufacturer == &quot;Nissan&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; pos == 1,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; color != $subaru.color,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; color != $porsche.color )<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// Subaru was blue<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$subaru : Car( manufacturer == &quot;Subaru&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//pos == 2,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos != $nissan.pos,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pos != $porsche.pos,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color == &quot;blue&quot; )<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 2nd car was silver<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Car( pos == 2,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color == &quot;silver&quot;,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this in ( $nissan, $subaru, $porsche ) )<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;Nissan &quot; + $nissan.getPos() + &quot; &quot; + $nissan.getColor() );<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;Subaru &quot; + $subaru.getPos() + &quot; &quot; + $subaru.getColor() );<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println( &quot;Porsche &quot; + $porsche.getPos() + &quot; &quot; + $porsche.getColor() );<br>
<br>
end<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
<br>
<br>
<br>
The Car.java file:<br>
<br>
<br>
package com.sample;<br>
<br>
 &nbsp; &nbsp;public class Car {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String manufacturer;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String color;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private int pos;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public Car() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public Car(String manufacturer, String color, int pos) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;super();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.color = color;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.pos = pos;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.manufacturer = manufacturer;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public String getManufacturer() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.manufacturer;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public float getPos() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.pos;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public String getColor() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.color;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp;}<br>
<br>
<br>
<br>
<br>
The CarExample.java file, which is the main app:<br>
<br>
<br>
<br>
package com.sample;<br>
<br>
import java.io.InputStreamReader;<br>
<br>
import org.drools.RuleBase;<br>
import org.drools.RuleBaseFactory;<br>
import org.drools.StatefulSession;<br>
import org.drools.compiler.PackageBuilder;<br>
import com.sample.Car;<br>
<br>
public class CarExample {<br>
<br>
 &nbsp; &nbsp;public static void main(String[] args) throws Exception {<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;final PackageBuilder builder = new PackageBuilder();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;builder.addPackageFromDrl( new InputStreamReader( CarExample.class.getResourceAsStream( &quot;CarExample.drl&quot; ) ) );<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;final RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ruleBase.addPackage( builder.getPackage() );<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;final StatefulSession session = ruleBase.newStatefulSession();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;String[] names = new String[] { &quot;Nissan&quot;, &quot;Subaru&quot;, &quot;Porsche&quot;};<br>
 &nbsp; &nbsp; &nbsp; &nbsp;String[] colors = new String[] { &quot;red&quot;, &quot;blue&quot;, &quot;silver&quot;};<br>
 &nbsp; &nbsp; &nbsp; &nbsp;int[] positions = new int[] { 1, 2, 3 };<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;for ( int n = 0; n &lt; names.length; n++ ) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for ( int c = 0; c &lt; colors.length; c++ ) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for ( int p = 0; p &lt; positions.length; p++ ) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.insert( new Car( names[n], colors[c], positions[p]) );<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;session.fireAllRules();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;session.dispose();<br>
 &nbsp; &nbsp;}<br>
<br>
<br>
<br>
}<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>
</blockquote></div></div></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</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><br><br clear="all"><br>-- <br>Cheers, <br>Maxim Veksler<br><br>&quot;Free as in Freedom&quot; - Do u GNU ?<br>
</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, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>