I have created a rule whose "when" condition is as follows :-
when
$map: Map(this["key1"].equals("value1")) and Map(this["key2"].equals("value2"))
then
...
The above condition is working fine. Now how do I add multiple boolean conditions in a rule? For eg. The above rule could be summarized as : a and b so if I want to create a rule : (a and b) or c then what would be actual drl syntax for it. I am new to drools so kindly help me with the syntax of the rule (a and b) or c.
I did create a syntax
when
$map: Reindexing((Map(this["key1"].equals("value1")) and Map(this["key2"].equals("value2"))) or Map(this["key3"].equals("value3")))
then
But I got the following exception
Error Messages: Message [id=1, level=ERROR, path=mapIterationRules.drl, line=13, column=0 text=[ERR 101] Line 13:21 no viable alternative at input '(' in rule "first rule"]
Thanks
Reindexing
supposed to be or do? You have facts of type Map. Using a class name within a pattern using another class name isn't valid syntax. Check the documentation. – Inapplicableand
andor
conditional element operators if all constraints should relate to the same Map - use the constraint logical operators||
and&&
. Again, check the documentation – Inapplicable