def get_relationship_variable_id(path):
    _, r = path[0]
    child_link_name = r.child_variable.id
    for _, r in path[1:]:
        parent_link_name = child_link_name
        child_link_name = '%s.%s' % (r.parent_entity.id,
                                     parent_link_name)
    return child_link_name