Unless you assert the contents of the map into working memory, you are gonna
have to use either an eval statement or from. For example using eval

when
    Cheese($type : type)
    Cheese(eval(map.get("foo").containsKey($type))
then


2009/4/21 Meny Kobel <[email protected]>

> Hi,
> One of the class member of the fact is map<String,List>.
> In the DRL file I need to get list from the map(I know the map key) and set
> it to variable name $theList.
> Then I need to check if some variable is memberof $theList
> Can you please advice how to get the list from the map and set the $theList
> variable?
>
> For example :
>
> public class Cheese
> {
>     private String type;
>     private Map<String,List<Integer>> map;
>
>
>     public Cheese(String type) {
>         this.type = type;
>     }
>
>     public String getType() {
>         return type;
>     }
>
>     public void setType(String type) {
>         this.type = type;
>     }
>
>     public Map<String, List<Integer>> getMap()
>     {
>         return map;
>     }
>
>     public void setMap(Map<String, List<Integer>> map)
>     {
>         this.map = map;
>     }
>
>
>     public List<Integer> getListFromMap(String name)
>     {
>         return map.get(name);
>     }
> }
>
> DRL file -
>
> rule "Cheese_fans_18"
>   when
>     Cheese($theList :* don't know how to get the list from the map*)
>     Cheese(type memberof $theList)
>
>   then
>     System.out.println("Cool");
> end
>
>
>
> Thanks,
> Meny
>
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to