You are expecting map values to be elevated somehow from Object to Integer and String.
By using typed attributes in the Person class you can overcome your problem.

Sent from my HTC (Android)

On Feb 21, 2010 9:28 PM, "Adam Krieg" <spamcontrol@mac.com> wrote:

I’m new to Drools and having trouble accessing my Domain object which is basically a container around a map.

class Person {
   Map props;
   public Map getProps();
…. Extra stuff
}


I want to create a rule that will match when Age is greater than 20 and name is one of “Fred”, “Barney”, or “Wilma”.  These  entries are stored in the Map props, so that to get age, you would call person.getProps().get(“AGE”)



rule "My Rule"
               dialect "mvel"
               when
                               $person : Person(
                                   props[“AGE”] > 20,
                                   props[“NAME”] memberOf [“Fred”, “Wilma”, “Barney”]
                               )
               then
                               System.out.println("found match”+$person);

End

But I am running into a parsing error:
no viable alternative at input ')' in rule "My Rule" in pattern Person.

The second condition seems to be the problem.  Can I check for membership inside a List I create inline in mvel?


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users