Introduction to Graph Data Modeling

About this module

At the end of this module, you will be able to:

  • Describe what graph data modeling is.

  • Describe how Neo4j supports graph data modeling.

  • Describe the tools you can use for graph data modeling.

  • Describe the workflow for graph data modeling.

What is graph data modeling?

Graph data modeling is a collaborative effort where the application domain is analyzed by stakeholders and developers to come up with the optimal model for use with Neo4j. Stakeholders must understand the domain and be prepared to ask detailed questions about how the business-at-hand operates.

Stakeholders are:

  • Business analysts

  • Architects

  • Managers

  • Project leaders

How does Neo4j support graph data modeling?

  • Neo4j is a full-featured graph database that allows you to create property graphs.

  • Applications retrieve data for business use cases by traversing the graph.

Traversal in the graph

Traversal
MATCH (r:Residence)<-[:OWNS]-(p:Person)
WHERE r.address = '475 Broad Street'
RETURN p

Traversal means anchoring a query based upon a property value, then traversing the graph to satisfy the query. In this example, the address property of the Residence node is used to determine where to anchor the query. Then, the OWNS relationship is traversed to retrieve the qualifying nodes. A relationship is only traversed once in a MATCH clause.

Tools for graph data modeling

ArrowTool

There are many ways that developers and stakeholders can work together to build a graph data model for their application. Drawing it on a whiteboard may be done initially, but you will need to share your model with others so using a tool is recommended. The tool that we use in this course is the Arrows tool which integrates with Neo4j. With the Arrows tool, you can generate Cypher statements for creating code to implement the model.

Guided Exercise: Using the Arrows tool

Follow along with this video to learn how to begin using the Arrows tool for graph data modeling.

Workflow for graph data modeling

GraphDataModelingWorkflow

Data model maintenance is cyclical and iterative. We are comfortable with this idea because updating a graph model is much cheaper and easier than updating the schema of a tabular store. Ease-of-updating will be a consistent theme throughout this training.

Check your understanding

Question 1

What elements of a Neo4j graph are used to categorize entities?

Select the correct answer.

  • Relationship

  • Property

  • Node

  • Label

Question 2

Which statements below are true about Neo4j graph traversal?

Select the correct answers.

  • Traversal during a query starts at a set of anchor nodes.

  • Traversal during a query ends at an anchor node.

  • A relationship is only traversed once in a MATCH clause.

  • A relationship can be traversed multiple times in a MATCH clause.

Question 3

What modeling tool is designed specifically for use with Neo4j?

Select the correct answer.

  • Visio

  • Sketch

  • Arrows Tool

  • Neo4j Modeler

Summary

You can now:

  • Describe what graph data modeling is.

  • Describe how Neo4j supports graph data modeling.

  • Describe the tools you can use for graph data modeling.

  • Describe the workflow for graph data modeling.