Hi and welcome Matt!

> What is the best way to design this type of relationship? What direction is
> best to use?
>   

The one that makes the most sense to you in your code, I think! Or 
rather: how would you draw this on a whiteboard when explaining the 
application domain to someone?! In my case I'd go with HAS_CHILD 
relationships as this direction feels more natural to me.

There's no need to add relationships twice to cover the directions, as 
Neo4j can traverse both incoming and outgoing relationships or simply 
ignore their direction (that is use Direction.BOTH or leave the 
direction unspecified).

> I noticed in the matrix example, relationships point from Neo to the other
> characters.

Even if Neo4j relationships always have a start node and an end node 
(and a direction) it's up to the application to decide what semantics 
goes with this. In the Matrix example the KNOWS relationship likely 
should count as undirected, as someone you know also knows you. The 
CODED_BY relationship is different, as the direction of it is really 
significant.

>  Is there also a relationship from the reference node to Neo, or
> does Neo point to the reference node?
>   

There are different variations of this example, both with and without a 
relationship from the reference node to the Thomas Andersson/Neo node. 
This one has such a relationship:
http://wiki.neo4j.org/content/The_Matrix

For real applications it often a good idea to add a few nodes that are 
used as "subreference nodes" - have a look here:
http://wiki.neo4j.org/content/Design_Guide#Organizing_your_Nodespace


/anders


-- 
Anders Nawroth [and...@neotechnology.com]
GTalk, Skype: anders.nawroth
Phone: +46 737 894 163
http://twitter.com/nawroth
http://blog.nawroth.com/

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to