We have some ideas for OGNL style graph access in 3.1 - but for now you cannot use field constraints on sub properties. When using Predicate and ReturnValues it is essential that their operations are constant, and do not very over time. Eval can be used for expressions that very over time. Only literal constraints are indexed, we do not currently index return value/predicate field constraints - just something to bear in mind if you have performance issues, as you can gain speed by flattening your model.

Mark
Russ Egan wrote:
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