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.

Reporting hierarchy

Hi I am new to the application and I am trying to replicate a traditional db model by importing csv extract. I am facing issue with the below instance:

Employee<-[supervises]-manager1<-[supervises]-manager2-[supervises]-(manager3) ..and so on.

here the manager attributes are also employee records. Please let me know how do I establish the relationship while importing the data as I need to have all the above columns as employee nodes and then have the hierarchy defined.

below is the excel column format:

employee|id|manager_L1|manager_L1_id|manager_L2|manager_L2_id|..

1 REPLY 1

Using columns to represent the levels of hierarchy isn't a good approach. Really what you should be looking at are just single employee / manager pairs per row:

employee|employee_id|manager|manager_id

You'd want one run through to create the nodes first, so you have all :Employee nodes created (we're assuming all managers are :Employees as well), then do a second run through to create the relationships, matching to the :Employee nodes via employee_id and manager_id and creating the relationships between them.

The effect of creating all the relationships between pairs of employee/manager will create the hierarchy graph.