Graph Data Modeling Fundamentals
Design graph data models for Neo4j using proven best practices. Turn application questions into nodes, relationships, and properties that scale.
In this 2-hour course, you will learn
This course teaches you how to design a performant Full definition for data model (opens in a new tab)The labels, relationship types and properties chosen to represent a domain. in Neo4j. You will learn to translate a set of use cases into Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. and Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node., test that model against the questions your application needs to answer, and refactor it as your understanding of the domain grows.
Who this course is for
This course is for developers and data engineers who need to design the graph behind a Neo4j application. If you have learned Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. and can read and write data, but you are unsure how to decide what should be a node, what should be a relationship, and what should be a Full definition for property (opens in a new tab)A named value stored on a node or a relationship., this course gives you a repeatable method. No prior modeling experience is assumed —you start from a set of use cases and build the model up step by step using the Movies domain.
Prerequisites
Before taking this course, complete two beginner courses first:
- Neo4j Fundamentals introduces graph databases, the Full definition for property graph (opens in a new tab)The data model Neo4j implements, in which nodes and relationships both carry properties as well as labels and types. model, and when Neo4j is the right choice. You need this vocabulary —nodes, relationships, Full definition for label (opens in a new tab)A tag on a node that groups it with other nodes of the same kind. A node can carry more than one., properties —before you can reason about a model.
- Cypher Fundamentals teaches you to read and write data with Cypher. You will use Cypher throughout this course to create nodes, add relationships, and refactor the graph, so you should be comfortable with
MATCH,MERGE, andCREATEbefore you begin.
Together they give you the language and the query skills that this course assumes.
What you'll build and do
This is a hands-on course. You will model and build a real Movies graph, starting from the use cases the application must support and turning them into a working model. You will create Movie and Person nodes, connect them, and then repeatedly test the model by asking whether it can answer the use-case questions —the discipline that keeps a graph model honest.
When testing reveals a weakness, you refactor. You will add labels, eliminate duplicated data by promoting repeated property values into their own nodes, replace generic relationships with specific ones, and introduce intermediate nodes to connect more than two entities at once. By the end you will have a model that is both correct and fast for its intended queries, and a process you can reuse on your own domain.
Module by module
Getting Started
You will learn what graph data modeling is and why it matters: a graph model is designed around the questions you need to answer, not around tables. You will meet the Movies domain and define the purpose of the model —the use cases that every later decision will be tested against.
Modeling Nodes
Nodes represent the entities in your domain. You will identify the entities in the Movies domain, create Movie and Person nodes in Cypher, and learn how to recognize when a new label is needed. You will then create more nodes to round out the initial model.
Modeling Relationships
Relationships connect entities and carry much of a graph's meaning. You will model the connections between people and movies, create your initial relationships in Cypher, learn to identify when a new relationship type is required, and add the remaining relationships the use cases demand.
Testing the Model
A model is only correct if it answers the questions you set out to answer. You will test the model against the use cases, use an Full definition for instance model (opens in a new tab)A data model drawn with real example data, showing particular nodes and relationships rather than their types. —real sample data —to confirm the queries return what you expect, and see how enforcing data models helps keep the graph consistent as it grows.
Refactoring the Graph
Full definition for refactoring (opens in a new tab)Changing the structure of a graph without changing what it represents, usually to make queries simpler, faster or more logical. is a normal, expected part of modeling. You will learn how labels work in the graph and add an Actor label to the people who acted in movies, retest to confirm your queries still work and now run faster, then add a Director label. You will also learn which labels to avoid, so your model stays clean rather than accumulating labels that add no value.
Eliminating Duplicate Data
Duplicated property values waste storage and make updates error-prone, because the same fact lives in many places. You will see why duplication hurts and then fix it by moving repeated values —such as a movie's language and genre —out of properties and into their own Language and Genre nodes, so each fact is stored once and shared through relationships.
Using Specific Relationships
A generic relationship forces every query to filter, which slows Full definition for traversal (opens in a new tab)Following relationships from one node to the next to reach other parts of a graph.. You will learn to specialize relationships —taking broad connections and replacing them with specific types such as ACTED_IN, DIRECTED, and RATED —so that a query can follow exactly the relationships it needs and skip the rest.
Adding Intermediate Nodes
Some facts connect more than two entities, or need properties of their own that do not belong on either endpoint. You will learn to introduce an Full definition for intermediate node (opens in a new tab)A node introduced to act as an intermediate step between two or more other nodes, or to carry properties that a single relationship cannot. —for example a Role node that captures the character a person played in a specific movie —to model these richer relationships cleanly.
Where to go next
Once you can design a model, you need to load data into it. Importing Data Fundamentals teaches you how to import data from CSV files into a Neo4j graph, applying the modeling decisions you made here.
Data modeling is also a core topic on the Neo4j Certified Professional certification exam, so the skills you build in this course move you directly toward that credential.
Graph data modeling fundamentals
Creating graphs
Graph Refactoring
8 modules, 2 hours.
Posts from the GraphAcademy blog.
My five favorite cards in Aura Dashboards
When Dashboards first became available in Aura, I started to move my reporting away from custom tools. Here are the five cards I use the most, and a Cypher statement behind them.
SQL to Cypher - 10 Queries You Already Know
You already know how to write these queries. This article shows you what they look like when the joins go away.
Writing Cypher Queries That Don't Lose Your Data
The query trap that hides your newest data, and the query shape that brings it back.