[rules-users] Maps in Drools

Edson Tirelli tirelli at post.com
Wed Aug 19 21:24:45 EDT 2009


   ooops... correct version:

when
   Map( this["type"] == "Point", $x : this["x"] )
   Map( this["type"] == "Circle", this["x"] == $x )
then
end


2009/8/19 Edson Tirelli <tirelli at post.com>

>
> when
>    Map( this["type"] == "Point", $x : this["x"] )
>    Map( this["type"] == "Circle", x == $x )
> then
> end
>
>
> 2009/8/19 André Thieme <address.good.until.2009.dec.14 at justmail.de>
>
>> 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/
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss by Red Hat @ www.jboss.com
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090819/11566020/attachment.html 


More information about the rules-users mailing list