Results 1 to 4 of 4

Thread: SDG: Direction.Both Relationships

  1. #1
    Join Date
    Jul 2010
    Posts
    139

    Default 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. #2
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    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

  3. #3
    Join Date
    Jul 2010
    Posts
    139

    Default

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

  4. #4
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Yes, sorry, forgot to mention that.

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •