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.

Pls help me to review my graph structure <3

Hello everyone!
I've just started learning Neo4j and I've decided to do this using a real life example.
I've built a trial model for my project which is investigation of corruption in public sector. So far I have smth like this:


I have faced with couple of problems:

  1. I need to add a relationship that reflects who has appointed a person on a certain job position. In this case I should create a separate node :Job ? Then how to define in which company is this job given that I have a separate node for it.
  2. I need to allow user to add nodes and relationships but their edits will be reflected only after my approval. Is it better to add a node called :Status with type property or I can just add a status property to all of my entities?

Thank you, in advance!
I would appreciate any other suggestions

2 REPLIES 2

With regard to the first question I've came to smth like this:

Yes, this looks better. This is a great example where you discover that a concept in your graph that was previously only represented by a relationship requires a richer representation (either in the ability to look it up, or to connect it to multiple nodes).

If needed you can also keep previous relationships, or alter the type to better serve for certain use cases (for example, having :WORKED_AT relationships to :Company nodes, and maybe a :CURRENTLY_WORKS_AT relationship to the :Company they are currently employed by (and likewise you could have an additional :CURRENTLY_WORKS_AS relationship to their current :Job node). This way you have multiple ways to query over your data, giving you shortcuts when creating your query if you don't need to bother with info in your :Job nodes, or if you quickly want to traverse only to current :Job or :Company nodes for a person (or only see current employees or jobs per company).

As for the approval part, that is a tough question. We do have richer security functionality cooking up for our next major release that could help for these kind of cases, but until then you may have to make due with your current approach.