Sorry, me again,

I'm putting together some prototype rules that operate on related objects in a graph of objects.

I'm adding all objects individually to working memory and then checking the objects are related in the rule to ensure only valid combinations are selected; for example:-

//Java code
parent.addChild(child)
wm.assertObject(parent);
wm.assertObject(child);

//Rule
rule "Adult smurfs"
when
        c : Child ( age > 18, p : parent )
        Parent ( parentId == ( p.parentId ), type == "SMURF" )
then
        System.out.println("Smurf " + p.getName() + " is " + c.getAge() + " years old."
end

rule "Adult clangers"
when
        c : Child ( age > 18, p : parent )
        Parent ( parentId == ( p.parentId ), type == "CLANGER" )
then
        System.out.println("Clanger " + p.getName() + " is " + c.getAge() + " years old."
end

This requires that the parent-child relationship is navigable from the child end of the relationship -- child.getParent().

What other approaches does anyone else use to implement rules that span related objects?

With kind regards,

Michael Anstis
-------------------------------------------
Next Generation Estimating System
( Trafford House (Int) 8 718 2239
( Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com>