Designing Properties

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:

  1. Relevance — Include only properties you filter or return in queries; omit internal flags

  2. Data type — Map VARCHAR to String, INTEGER to Integer, DATE to Date/DateTime; use toInteger() etc. in Cypher if needed

  3. Naming — Use camelCase (e.g. companyName); avoid SQL snake_case

  4. Location — Node for entity attributes; relationship for link-specific data (e.g. quantity on CONTAINS)

Node Properties

Properties for each Northwind node type:

Customer Node Properties

From the customers table:

Column Property Type Notes

customer_id

customerID

String

Primary identifier - keep as-is (5-character code)

company_name

companyName

String

Main display name

contact_name

contactName

String

Person to contact

contact_title

contactTitle

String

Job title of contact

address

address

String

Street address

city

city

String

City name

region

region

String

State/province (nullable)

postal_code

postalCode

String

ZIP/postal code

country

country

String

Country name

phone

phone

String

Phone number

fax

fax

String

Fax number (nullable)

Order Node Properties

From the orders table:

Column Property Type Notes

order_id

orderID

Integer

Primary identifier

order_date

orderDate

Date

When order was placed

required_date

requiredDate

Date

Requested delivery date

shipped_date

shippedDate

Date

Actual ship date (nullable)

freight

freight

Float

Shipping cost

ship_name

shipName

String

Recipient name

ship_address

shipAddress

String

Delivery address

ship_city

shipCity

String

Delivery city

ship_region

shipRegion

String

Delivery region

ship_postal_code

shipPostalCode

String

Delivery postal code

ship_country

shipCountry

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

product_id

productID

Integer

Primary identifier

product_name

productName

String

Product display name

quantity_per_unit

quantityPerUnit

String

Package description

unit_price

unitPrice

Float

Current price

units_in_stock

unitsInStock

Integer

Current inventory

units_on_order

unitsOnOrder

Integer

Pending orders

reorder_level

reorderLevel

Integer

Minimum stock level

discontinued

discontinued

Boolean

No longer sold flag

Category Node Properties

From the categories table:

Column Property Type Notes

category_id

categoryID

Integer

Primary identifier

category_name

categoryName

String

Category display name

description

description

String

Category description

picture

omit

-

Binary data - not suitable for graph storage

Supplier Node Properties

From the suppliers table:

Column Property Type Notes

supplier_id

supplierID

Integer

Primary identifier

company_name

companyName

String

Supplier company name

contact_name

contactName

String

Contact person

contact_title

contactTitle

String

Contact job title

address

address

String

Street address

city

city

String

City

region

region

String

State/province

postal_code

postalCode

String

Postal code

country

country

String

Country

phone

phone

String

Phone number

fax

fax

String

Fax number

homepage

homepage

String

Website URL

Employee Node Properties

From the employees table:

Column Property Type Notes

employee_id

employeeID

Integer

Primary identifier

last_name

lastName

String

Surname

first_name

firstName

String

Given name

title

title

String

Job title

title_of_courtesy

titleOfCourtesy

String

Mr., Ms., etc.

birth_date

birthDate

Date

Date of birth

hire_date

hireDate

Date

Employment start date

address

address

String

Home address

city

city

String

City

region

region

String

State/province

postal_code

postalCode

String

Postal code

country

country

String

Country

home_phone

homePhone

String

Phone number

extension

extension

String

Office extension

notes

notes

String

Biography/notes

photo

omit

-

Binary data

photo_path

omit

-

Legacy file path

Shipper Node Properties

From the shippers table:

Column Property Type Notes

shipper_id

shipperID

Integer

Primary identifier

company_name

companyName

String

Shipper company name

phone

phone

String

Phone number

Relationship Properties

The CONTAINS relationship (from order_details) has properties:

Column Property Type Notes

unit_price

unitPrice

Float

Price at time of order

quantity

quantity

Integer

Number of units ordered

discount

discount

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

companyName, orderDate, unitPrice

Descriptive names

shippedDate not sd

Consistent prefixes

All shipping fields use ship prefix

Boolean as adjectives

discontinued not isDiscontinued

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.

Chatbot

How can I help you today?