cancel
Showing results for 
Search instead for 
Did you mean: 

Relation Hops

ms007
Node Link

Hi there,

We are migrating from sdn 5.3.x to 6.2.

Many related domain entities do have a relation back to the source nodes

For example (User)-[:IS_MEMBER]->(Community)<-[:CREATED_BY]-(User)

@Node(primaryLabel = "Community")
@SuperBuilder
@NoArgsConstructor
public class Community extends BaseDomainObject {
    @Getter
    @Setter
    @Relationship(type = "CREATED_BY")
    private User creator;
}
@Node
@SuperBuilder
@NoArgsConstructor
public class User extends BaseDomainObject {
    @Getter
    @Setter
    @EqualsAndHashCode.Include
    private String name;

    @Getter
    @Setter
    @Relationship(type = "IS_MEMBER_OF")
    private Set<Community> communities = new HashSet<>();

    @Getter
    @Setter
    @Relationship(type = "IS_EDITOR_OF")
    private Set<Community> editorOfCommunities = new HashSet<>();
}

Sometimes the relationships are in circle.
Until sdn 6.2 this was only a problem when we wanted deep graphs by setting a depth of two or three. Now it grasps the entire graph.

Documentation

What is the preferred migration path for this type of problem?
Thank you in advance

1 REPLY 1

gerrit_meier
Neo4j
Neo4j

Use projection for you use-case: Multi-level projections
I explicitly linked to the multi-level projections section because I think that you need more than one hop if I understand you correctly. But of course the whole chapter has a lot of information about projections in general. Also if you have no need, try to stick with interface-based projections.