On 9 February 2011 16:49, jwillans2 <span dir="ltr"><<a href="mailto:james.willans@ceteva.com">james.willans@ceteva.com</a>></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 "example"<br>
when<br>
Object(slot = "value")<br></blockquote><div><br>An java.lang.Object doesn't have a property called "slot".<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 "example"<br>
when<br>
Object(slot = "value", id = 125)<br></blockquote><div><br>Let'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 == "id", $value: value )<br>
Item( id == $value )<br><br>But I'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 "facts" that are conceptually scoped, but we<br>
may want to rewrite using "from":<br>
<br>
rule "example"<br>
when<br>
$op : ObjectProvider()<br>
Object(slot = "value") from op.eval()<br></blockquote><div><br>Again, java.lang.Object is not useful. -- Why don't you simply insert the objects<br>contained in ObjectProvider'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>