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