On 9 February 2011 16:49, jwillans2 <james.willans@ceteva.com> wrote:

Hi Wolfgang,

For example, the user may specify something along the lines of:

rule "example"
 when
   Object(slot = "value")

An java.lang.Object doesn't have a property called "slot".
 
 then
   ..
end

Minimally we might want to rewrite the rule to strengthen the condition:

rule "example"
 when
   Object(slot = "value", id = 125)

Let's say you want to check whether
      Item( id == 125 )
and specify 125 only at runtime. Then you can write your rule as
      ItemParam( field == "id", $value: value )
      Item( id == $value )

But I'd prefer using templates and generate simple rules, even at runtime.

 
 then
   ..
end

Where 125 is not known until runtime.  We may want to handle more complex
cases where the user refers to "facts" that are conceptually scoped, but we
may want to rewrite using "from":

rule "example"
 when
   $op : ObjectProvider()
   Object(slot = "value") from op.eval()

Again, java.lang.Object is not useful. -- Why don't you simply insert the objects
contained in ObjectProvider's eval field?

-W
 
 then
   ..
end

Thanks,

James

--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rewriting-rules-tp2458626p2459318.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users