cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Newbie Relationship Question

I have a pretty straight forward question. Is it acceptable to have 2 relationships from one node to another. Using the actors example on the Neo4J site, is it acceptable to have a node called Clint Eastwood and another called Million Dollar Baby? One relationship would be directed in and the other would be acted in?

Another example would be training related. John Smith as the employee and OSHA as the training. Would you do 2 relationships? John Smith is_required to take OSHA and John Smith completed OSHA?

I know this is a very simple question, but I'm just trying to understand the best way to begin modeling. In one of the videos I watched, they mentioned that Neo4J is not optimized for querying properties, but is far better at querying based on relationships so I'm trying to use relationships more.

2 REPLIES 2

intouch_vivek
Graph Steward

Hi Cohenba,

  1. You can have n number of relationships between two nodes
  2. Querying /filtering on relationship could be costly as you cannot index relationship properties.
  3. Basic rule is to create object as node and event/action as relationship. So yes John Smith and OSHA should be two nodes as they are objects. Now either you can have one relationship between them with two properties is_required and completed. or have two distinct relationship. It is based on the requirement. For an example if you want to aggregated on the count of employees who are required to take the training or who have completed the training then having two different relationship will be better.

Vivek,

Thank you so much for the quick reply. This was super helpful!!