[rules-users] Accessing maps (hashmaps) keys and values in rules
Mehak
mehak.kapoor at hewitt.com
Wed Mar 12 07:41:50 EDT 2008
Hi
I am using xml drl files for my rules. I pass the facts in HashMap.
Map factAgendaMap = new HashMap();
factAgendaMap.put("group", ruleConfig.getRuleName());
factAgendaMap.put("fact", fact);
session.execute(factAgendaMap);
In my drl file I m calling the rule as
<rule name="rule1">
<rule-attribute name="activation-group" value="abc"/>
<lhs>
<pattern identifier="map" object-type="HashMap">
</pattern>
<pattern identifier = "task" object-type = "Task">
<from>
<expression> map.get("fact")
</expression>
</from>
<or-constraint-connective>
<field-constraint field-name="childTasks.size()">
<literal-restriction evaluator="==" value="null"/>
</field-constraint>
<field-constraint field-name="childTasks.size()">
<literal-restriction evaluator="==" value="null"/>
</field-constraint>
</or-constraint-connective>
</pattern>
</lhs>
<rhs>
System.out.println("Success rule1 activation");
</rhs>
</rule>
This is giving me error that <from> tag placed misappropriately. I want to
use OR constraint on the facts passed in HashMap.
--
View this message in context: http://www.nabble.com/Accessing-maps-%28hashmaps%29-keys-and-values-in-rules-tp11692818p16001825.html
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list