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.

Modeling opinions and best practices

TJLeach
Node Link

I've been giving my graph model alot of thought and I've come up with a baseline model of nodes and relationship. But I have more content that would be either properties or nodes. I had a epiphany that beyond the base content all other content can be thought of as "opinions" and "best practices" or standards. Is there an example Neo4J applications model that can demonstrate the structure of a model using my two types of content?

Thanks,

Terry

2 REPLIES 2

A more in-depth example may help us to provide advice.

There are a couple things to consider for this.

If the entity ought to be some kind of single value, some kind of option or choice, it may be better to model it as a node, especially if there's value in looking up these values by index, and even more especially if your other option is to store these as a list property on your nodes. If there's additional info that should be present with this, then that's another sign that it should be a node, with associated properties or additional connected nodes.

For example, consider a movies graph with genres. We could model these as a list of genre strings within :Movies nodes, but this removes the possibility of an index lookup by genre (currently schema indexes don't consider list values), and it allows the possibility of misspelling or inconsistencies of values. If we wanted to store some additional info about genres, such as a textual description, we couldn't easily store it this way.

However if we model :Genre nodes instead that are connected to :Movie nodes, then these values are normalized, and we can quickly get counts of movies for a genre via a degree check of relationships to a genre node (without having to actually expand to connected nodes). We can have additional related data, such as a textual description, on the nodes themselves. Additionally we can use the node in alternate contexts, such as as genres for :Book nodes or other media.

Modeling things as nodes gives more flexibility overall.

If these kinds of considerations don't apply to your case, then using properties should be just fine.

Thanks that's a great example! I have a bunch of :use_case nodes which are used to accomplish the 15 :categories nodes of work. In a spreadsheet the :categories nodes would be the columns name with the :use cases being individual cells below.

So if I have a :teacher node that color codes each :use_case by it's level difficulty using 5 colors or a rating of 0 to 5, that would be more desirable than making the difficulty level a property in each :use case node? So I would continue to add nodes for :students and :student_organizations that are related to :use_cases and their relationship to each other?