Graph Data Modelling
There is no data model within Neo4j until you create data within the database.
Neo4j is schema-optional - you create the data model as you create the data.
The Golden Rule
The golden rule of graph data modeling is to model your data as a graph of nouns and verbs:
Noun VERB Noun
The nouns become nodes and the verbs become relationships:
Expanding Relationships
You can expand a relationship to include more detail:
Describe the Data
The (Noun)-[:VERB]→(Noun)
pattern allows you to describe your data in a way that is easy to understand.
Properties
Nodes & relationships with the same label or type can have different properties.
Labels
Node labels serve as an anchor point for a query.
By specifying a label, you are specifying a subset of one or more nodes with which to start a query.
Multiple Labels
You can segment your graph by using multiple labels on nodes:
Labels allow you to target specific sub-sections of your graph.
Node | Property
Depending on your use case, you may want to deduplicate properties into Nodes:
Node | Property
This model offers greater flexibility and improved query performance but at the cost of semantic complexity.
Relationships
Relationships are fast to traverse and efficient. Specialized relationship allow you to traverse the graph quickly.
Relationships
Actors rated by a user:
Continue
Summary
In this lesson, you explored graph data modeling concepts.