On 9 February 2011 16:49, jwillans2 <span dir="ltr">&lt;<a href="mailto:james.willans@ceteva.com">james.willans@ceteva.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Wolfgang,<br>
<br>
For example, the user may specify something along the lines of:<br>
<br>
rule &quot;example&quot;<br>
  when<br>
    Object(slot = &quot;value&quot;)<br></blockquote><div><br>An java.lang.Object doesn&#39;t have a property called &quot;slot&quot;.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

  then<br>
    ..<br>
end<br>
<br>
Minimally we might want to rewrite the rule to strengthen the condition:<br>
<br>
rule &quot;example&quot;<br>
  when<br>
    Object(slot = &quot;value&quot;, id = 125)<br></blockquote><div><br>Let&#39;s say you want to check whether<br>      Item( id == 125 )<br>and specify 125 only at runtime. Then you can write your rule as<br>      ItemParam( field == &quot;id&quot;, $value: value )<br>
      Item( id == $value )<br><br>But I&#39;d prefer using templates and generate simple rules, even at runtime.<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

  then<br>
    ..<br>
end<br>
<br>
Where 125 is not known until runtime.  We may want to handle more complex<br>
cases where the user refers to &quot;facts&quot; that are conceptually scoped, but we<br>
may want to rewrite using &quot;from&quot;:<br>
<br>
rule &quot;example&quot;<br>
  when<br>
    $op : ObjectProvider()<br>
    Object(slot = &quot;value&quot;) from op.eval()<br></blockquote><div><br>Again, java.lang.Object is not useful. -- Why don&#39;t you simply insert the objects<br>contained in ObjectProvider&#39;s eval field?<br><br>-W<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
  then<br>
    ..<br>
end<br>
<br>
Thanks,<br>
<br>
James<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Rewriting-rules-tp2458626p2459318.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Rewriting-rules-tp2458626p2459318.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">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>