refactoring RelationBuilder.java