Identifying Nodes

Introduction

So far, you have learned the elements of a graph, and how to query across them using Cypher. Before you can import data, you need to identify what should be a node in your graph model.

In this lesson, you will learn how to identify entities that should be nodes and why products are nodes in the Northwind model.

Deciding what should be a node

Nodes represent entities - things that exist independently and have their own identity and data.

Think of nodes as nouns - they are the "things" in your domain (Customer, Product, Order), not the actions or connections between them.

Ask these questions:

  • Is it a distinct entity? Does it represent something with its own identity, rather than just a property or connection?

  • Does it have its own properties? Does it store data that describes itself?

  • Will you query it directly? Will you search for it or filter by it?

  • Does it connect to other things? Does it have relationships?

If you answer "yes" to most of these, it should be a node.

Identifying Northwind entities

Based on the decision criteria, these Northwind entities are nodes:

  • Product - Items for sale (what the system recommends)

  • Customer - Companies that buy products (the "me" in "people like me")

  • Order - Purchase orders (the connection between customers and products)

  • Category - Product groupings

Each of these entities exists independently, has its own properties and relationships to other entities.

Analyzing products as nodes

Product is a node in Northwind because:

  • Distinct entity - Products are "things" with their own identity (Chai, Tofu, etc.), not just attributes of orders

  • Own properties - Each product has productName, unitPrice, quantityPerUnit, stock levels

  • Direct queries - You search for products: "What products cost more than $50?"

  • Connections - Products are contained within Orders (which ones were purchased) and organized into Categories (how they’re grouped).

Properties of products

If you examine products.csv file, you will see the following columns that describe the product:

  • productID - The unique identifier for each product

  • productName - The name of the product

  • quantityPerUnit - The quantity of the product per unit

  • unitPrice - The price of the product per unit

  • unitsInStock - The current inventory level of the product

  • unitsOnOrder - The number of units on order

  • reorderLevel - The reorder level of the product

  • discontinued - Whether the product is discontinued

Foreign keys do not become properties

The supplierID and categoryID columns are foreign keys that reference the supplier and category nodes respectively. They do not need to be stored as properties on the product node.

Summary

In this lesson, you learned how to identify nodes:

  • Nodes represent entities - Things with distinct identity, own properties, and relationships

  • Decision criteria - Ask: distinct entity? Own properties? Direct queries? Connections?

  • Product is a node - Has its own identity and data, queried directly, connects to orders and categories

  • Not a property - Entities shouldn’t be properties if you need to query them or connect them to multiple things

  • Start with products - The entities being recommended are the foundation of the graph

In the next lesson, you will import your first Product nodes using the Import tool tool.

Chatbot

How can I help you today?

Data Model

Your data model will appear here.