I think you'd have to use predicate expressions:

when
Company($s : supervisor -> ($s.getAge() < 25)) || Company($s : supervisor -> ($s.getAge() > 67))
then ...

"$s : supervisor" binds the supervisor bean property of Company to the variable $s, which you then use in the -> () construct, where you can use arbitrary java expressions. I think this is the only way to access nested bean properties in 3.0.

On Thu, 04 May 2006 09:52:26 -0400, Per Ivar Gjerløw"" <[EMAIL PROTECTED]> wrote:

How can I write a rule like this if an object inherits methods from a
super class?

I have a class hierarchy like this: A Company object and a Person
object both inherits methods from an abstract parent object.

And the Company object has a getSupervisor() method which returns a
Person object.

If I want to write a rule for the to check the age of the Supervisor
when only the Company object is in the working memory.

Is this the way to go??
rule "age"

    when
    Company(Person(age< 25)) or Company(Person(age> 67))
    then
    System.out.println("The supervisor is younger than 25 or older
than 67 years");
end

--
Best regards,

Per Ivar Gjerløw




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to