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

Olenin, Vladimir (MOH) Vladimir.Olenin at moh.gov.on.ca
Tue Feb 20 10:23:14 EST 2007


Thanks, Oana. I think I'm finally starting to get a grip on this thing :-).

 

 

Vlad

 

 

  _____  

From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of nicolae oana
Sent: 20 February 2007 03:38
To: Rules Users List
Subject: Re: [rules-users] exists + normal column constraints - how many
times a rule is cal led in the end????

 

Vlad,

exists Person(role == "parent")  

checks if in workingMemory is at least one Person fact having  attribute
role == "parent", in both your examples.

Your reasoning is correct: the four facts with role =="child" will activate
the rule. So, the result for your second example will be the same as the
first result, for your list of facts, no matter how you switch the columns.

Regards,
             Oana

"Olenin, Vladimir (MOH)" <Vladimir.Olenin at moh.gov.on.ca> wrote:

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

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

 

  

  _____  

Now that's room service! Choose
<http://travel.yahoo.com/hotelsearchpage;_ylc=X3oDMTFtaTIzNXVjBF9TAzk3NDA3NT
g5BF9zAzI3MTk0ODEEcG9zAzIEc2VjA21haWx0YWdsaW5lBHNsawNxMS0wNw--%0d%0a>  from
over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070220/3db99eb4/attachment.html 


More information about the rules-users mailing list