[rules-users] exists + normal column constraints - how many times a rule is cal led in the end????

Olenin, Vladimir (MOH) Vladimir.Olenin at moh.gov.on.ca
Mon Feb 19 16:45:29 EST 2007


Hi,

 

I'm not sure my understanding of 'existential quantifiers' is correct.
Hopefully, someone can clear it up a bit...

 

Providing I have the following fact class:

 

Person(role: parent/child, name)

 

And following facts:

 

1: parent, John

2: parent, Alice

3: parent, Steve

4: parent, Jane

5: child, Eric

6: child, Rob

7: child, May

8: child, April

 

I expect the rule

 

Rule "iterate children if at least one parent is found"

When

            exists Person(role == 'parent')

            $child: Person(role == 'child')

Then

            // do smth for each $child if at least one parent is found

End

 

 

To iterate through all 'child' persons (facts 5 through 8), ie the action
will be called exactly 4 times. Is this correct? What would happen if I swap
the order of the conditions (with 'parent exists' constrain going _after_
'child' constraint):

 

When

            $child: Person(role == 'child')

            exists Person(role == 'parent')

 

Thanks,

 

Vlad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070219/39d5c54f/attachment.html 


More information about the rules-users mailing list