if (result==null) {
if (result==null && propertyKey!=null) {
    public Object smartRelationship(D2WContext c) {        Object result = null;        Object rawObject=c.valueForKey("object");        String propertyKey=c.propertyKey();        if (rawObject!=null && rawObject instanceof EOEnterpriseObject && propertyKey != null) {            EOEnterpriseObject object=(EOEnterpriseObject)rawObject;            EOEnterpriseObject lastEO=object;            if (propertyKey.indexOf(".")!=-1) {                String partialKeyPath=KeyValuePath.keyPathWithoutLastProperty(propertyKey);                Object rawLastEO=object.valueForKeyPath(partialKeyPath);                lastEO=rawLastEO instanceof EOEnterpriseObject ? (EOEnterpriseObject)rawLastEO : null;            }            if (lastEO!=null) {                EOEntity entity=EOModelGroup.defaultGroup().entityNamed(lastEO.entityName());                String lastKey=KeyValuePath.lastPropertyKeyInKeyPath(propertyKey);                result=entity.relationshipNamed(lastKey);            }        }        if (result==null) {            result=c.relationship();        }        return result;    }