I have a test rule based on the OPM function help which checks entity values :
the person is happy if
forAllScope(the person's cats)
the cat is happy
I've set up all my entites and relationships and everything works as expected when the person's cats entity contains one to many instances, etc. but the question I have is that if there are no "cat" entities, but containment for that entitiy is set to complete in the debugger it returns true to the person being happy - even though nowhere in the scope is the cat happy (as there are no entity instances).
What I would like to happen is for "the person is happy" to be false if no cat entities are present and containment is complete. I understand I could add an additional ExistsScope but I really want to understand what ForAllScope is doing in this situation.
Another way to think of this is the default is to assume that ForAllScope will evaluate to true if all entities are known AND those that exist satisfy the subsequent conditions. What this means is you need to decide whether you want the logic to represent "at least one cat exists AND all cats are happy" (which requires an additional condition) or "every cat that exists is happy" (the default).
In terms of the policies / rules, it is always best to be explicit (regardless of the default behavior of a function such as ForAllScope). The recommended approach would be to explicitly state whether at least one cat must exist for the person to be happy OR whether the person is happy if the person has no cat's.