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

Reply via email to