In this lesson, you will map relational columns to graph properties and make decisions about data types and naming conventions.
From Columns to Properties
Relational table columns become properties on nodes or relationships in the graph. However, not every column needs to become a property:
-
Primary keys become node identifiers (and often properties too)
-
Foreign keys are replaced by relationships
-
Data columns become node or relationship properties
-
Computed columns may be calculated at query time instead
Property Design Principles
When designing properties:
-
Relevance — Include only properties you filter or return in queries; omit internal flags
-
Data type — Map VARCHAR to String, INTEGER to Integer, DATE to Date/DateTime; use
toInteger()etc. in Cypher if needed -
Naming — Use camelCase (e.g.
companyName); avoid SQL snake_case -
Location — Node for entity attributes; relationship for link-specific data (e.g.
quantityon CONTAINS)
Node Properties
Properties for each Northwind node type:
Customer Node Properties
From the customers table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
String |
Primary identifier - keep as-is (5-character code) |
|
|
String |
Main display name |
|
|
String |
Person to contact |
|
|
String |
Job title of contact |
|
|
String |
Street address |
|
|
String |
City name |
|
|
String |
State/province (nullable) |
|
|
String |
ZIP/postal code |
|
|
String |
Country name |
|
|
String |
Phone number |
|
|
String |
Fax number (nullable) |
Order Node Properties
From the orders table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
Date |
When order was placed |
|
|
Date |
Requested delivery date |
|
|
Date |
Actual ship date (nullable) |
|
|
Float |
Shipping cost |
|
|
String |
Recipient name |
|
|
String |
Delivery address |
|
|
String |
Delivery city |
|
|
String |
Delivery region |
|
|
String |
Delivery postal code |
|
|
String |
Delivery country |
Foreign keys become relationships, not properties
The customer_id, employee_id, and ship_via columns are foreign keys and will become relationships, not properties.
Product Node Properties
From the products table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
String |
Product display name |
|
|
String |
Package description |
|
|
Float |
Current price |
|
|
Integer |
Current inventory |
|
|
Integer |
Pending orders |
|
|
Integer |
Minimum stock level |
|
|
Boolean |
No longer sold flag |
Category Node Properties
From the categories table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
String |
Category display name |
|
|
String |
Category description |
|
omit |
- |
Binary data - not suitable for graph storage |
Supplier Node Properties
From the suppliers table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
String |
Supplier company name |
|
|
String |
Contact person |
|
|
String |
Contact job title |
|
|
String |
Street address |
|
|
String |
City |
|
|
String |
State/province |
|
|
String |
Postal code |
|
|
String |
Country |
|
|
String |
Phone number |
|
|
String |
Fax number |
|
|
String |
Website URL |
Employee Node Properties
From the employees table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
String |
Surname |
|
|
String |
Given name |
|
|
String |
Job title |
|
|
String |
Mr., Ms., etc. |
|
|
Date |
Date of birth |
|
|
Date |
Employment start date |
|
|
String |
Home address |
|
|
String |
City |
|
|
String |
State/province |
|
|
String |
Postal code |
|
|
String |
Country |
|
|
String |
Phone number |
|
|
String |
Office extension |
|
|
String |
Biography/notes |
|
omit |
- |
Binary data |
|
omit |
- |
Legacy file path |
Shipper Node Properties
From the shippers table:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Integer |
Primary identifier |
|
|
String |
Shipper company name |
|
|
String |
Phone number |
Relationship Properties
The CONTAINS relationship (from order_details) has properties:
| Column | Property | Type | Notes |
|---|---|---|---|
|
|
Float |
Price at time of order |
|
|
Integer |
Number of units ordered |
|
|
Float |
Discount percentage (0.0 to 1.0) |
Relationship properties capture historical data
The unit_price on the relationship may differ from the unitPrice on the Product node. The relationship property captures the historical price at the time of the order.
Property Naming Conventions
Follow these conventions for consistency:
| Convention | Example |
|---|---|
camelCase |
|
Descriptive names |
|
Consistent prefixes |
All shipping fields use |
Boolean as adjectives |
|
Data Type Mapping
Map SQL data types to Neo4j types:
| SQL Type | Neo4j Type | Notes |
|---|---|---|
VARCHAR, TEXT |
String |
Text data |
INTEGER, SMALLINT |
Integer |
Whole numbers |
DECIMAL, REAL |
Float |
Decimal numbers |
DATE, TIMESTAMP |
Date/DateTime |
Date and time values |
BOOLEAN, BIT |
Boolean |
True/false values |
BLOB, BYTEA |
omit or external |
Binary data not ideal for graph storage |
Check Your Understanding
Junction Table Properties
When the order_details junction table becomes a CONTAINS relationship, what happens to the quantity, unit_price, and discount columns?
-
❏ They are lost during the transformation
-
❏ They become properties on the Order node
-
❏ They become properties on the Product node
-
✓ They become properties on the CONTAINS relationship
Hint
These values are specific to a particular order-product combination, not to the order or product alone.
Solution
The quantity, unit_price, and discount columns become properties on the CONTAINS relationship. This is because these values describe the specific instance of a product within an order - the same product could have different quantities and prices in different orders.
This is an advantage of graph databases: relationships can have properties, eliminating the need for junction tables.
Summary
In this lesson, you learned:
-
How to map relational columns to graph properties
-
Property design for each Northwind node type
-
How to handle relationship properties from junction tables
-
Naming conventions and data type mappings
In the next lesson, you will plan constraints and indexes for your graph model.