As a newbie to Drools (using v4.0.7), I’m struggling a bit with the right way to express the following concept
I have a ParentFactObject with an array of ChildFactObjects.
The ChildFactObjects have a boolean attribute “TestMe”
I want to pattern match all ParentFactObjects for whom all ChildFactObjects have false for TestMe
Here’s what I’ve tried:
rule "NoTestChildren"
when
$parentFactObject : ParentFactObject // parent exists
(
)
not ChildFactObject // no child exists that has TestMe true
(
TestMe == true
) from $parentFactObject.childFactObjects
then
log("Rule NoTestChildren fired.");
end
I get the following:
org.drools.rule.InvalidRulePackage: [66,4]: unknown:66:4 mismatched token: [@1085,4469:4472='from',<38>,66:4]; expecting type THEN
Also tried this:
rule " NoTestChildren "
when
$parentFactObject : Borrower // parent exists
(
)
forall ($childFactObject : ChildFactObject // no child exists that has TestMe true
(
TestMe == true
) )from $parentFactObject. childFactObjects
then
log("Rule NoTestChildren fired.");
end
I’ve tried a series of variations with similar results.
Can anyone provide any guidance on how to do this?
Thanks in advance.
Tom Murphy
This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.