[rules-users] Maps in Drools

André Thieme address.good.until.2009.dec.14 at justmail.de
Wed Aug 19 18:38:26 EDT 2009


Edson Tirelli schrieb:

>         when
>                Customer( $custId : id )
>                DailyOrders( count[$custId] == 1 )
>         then

Btw, this brings me to a new syntax question for the default Drools rule
syntax. Is this possible:

when
   m:Map()
   eval( m.get("type") == "Point", $x : m.get("x") )
   ...
   Circle( x == $x )
then
   ...


or, an alternative which may be clearer:

when
   m:Map()
   eval( m.get("type") == "Point" )
   $x : m.get("x")
   ...
then
   ...

So, what I would like to have is:
1) looking at all Maps which have the value "Point" under the key "type"
2) of all those Maps: store in a var what value they have under key "x"
3) reuse the var, here $x instead of having an expensive lookup over and
    over again.

Is that possible? Or would I have to write my example above as
...
c:Circle()
eval(c.getX() == m.get("x"))


André
-- 
Lisp is not dead. It’s just the URL that has changed:
http://clojure.org/



More information about the rules-users mailing list