Announcement Announcement Module
Collapse
No announcement yet.
SDG: Direction.Both Relationships Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDG: Direction.Both Relationships

    I've setup a bi-directional relationship between 2 nodes using SDG. However, when I view the relationship in neo4j, it appears the relationship is still only outgoing. Any idea why?

    Code:
    @NodeEntity
    public class DummyModelObject
    {
      @RelatedTo(type = "RELATED_OBJECT", elementClass = DummyModelObject.class, direction = Direction.BOTH)
      private Set<DummyModelObject> relatedObjects;
    
      @Indexed(indexName = "model_obj_id_index")
      private String id;
    
      @Indexed(indexName = "title_index")
      private String title;
    }
    Output from Neo4jShell:

    Code:
    neo4j-sh[readonly] (0)$ ls 1
    *__type__   =[org.mycompany.graph.model.DummyModelObject]
    *createDate =[1303929118211]
    *id         =[32a05b5b-e9e4-40e9-9cbc-41acd905aadd]
    *modifyDate =[1303929118211]
    *title      =[DummyModelObject Title 1]
    (DummyModelObject Title 1,1) --[RELATED_OBJECT]-> (DummyModelObject Title 2,2)
    
    
    neo4j-sh[readonly] (0)$ ls 2
    *__type__   =[org.mycompany.graph.model.DummyModelObject]
    *createDate =[1303929118211]
    *id         =[e16379f0-f041-42b8-a1ee-ddc2ee02a271]
    *modifyDate =[1303929118211]
    *title      =[DummyModelObject Title 2]
    (DummyModelObject Title 2,2) <-[RELATED_OBJECT]-- (DummyModelObject Title 1,1)

  • #2
    As the docs state, the direction BOTH is just used when collecting relationships for the field, when creating them they are only created outgoing.

    This was a deliberate decision as there were issues about creating both directions at the same time (but unfortunately I can't recall the problems).

    Will look into that again.

    Thanks Michael

    Comment


    • #3
      Thanks for the follow up. It appears relationships can be traversed from both sides (endNode and startNode), so all should be good.

      Comment


      • #4
        Yes, sorry, forgot to mention that.

        Michael

        Comment

        Working...
        X