[rules-users] predicate vs return value expression - what's the difference?

Olenin, Vladimir (MOH) Vladimir.Olenin at moh.gov.on.ca
Mon Feb 5 15:56:19 EST 2007


Hi,

 

I'm reading through DROOLS manual and can't understand the difference /
explanations regarding predicate expression (Figure 3.17) and return value
expression (Figure 3.18). The manual gives two examples of the same thing
done two different ways:

 

 

Predicate expression:

 

Person( girlAge : age, sex = "F" )
Person( boyAge : age -> ( girlAge.intValue() == boyAge.intValue() + 2 ), sex
= 'M' )

 

 

Return value expression:

 

Person( girlAge : age, sex == "F" )
Person( age == ( new Integer(girlAge.intValue() + 2) ), sex == 'M' )

 

 

 

While the 'return value' expression is more or less clear, I can't
understand the semantics of 'predicate' ('->') operator. Can anyone decode
this? What's the difference between the two? When each of the ways should be
used and why?

 

Thanks!

 

Vlad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070205/8eccce24/attachment.html 


More information about the rules-users mailing list