Connect Orders to Products
Now connect Order nodes to Product nodes with CONTAINS relationships. This transforms the order-details.csv join table into graph relationships with properties.
Create the CONTAINS relationship
In the Import tool, drag from the Order node to the Product node to create a relationship.
Configure the relationship
In the Definition pane:
-
Type:
CONTAINS -
Table:
order-details.csv -
From node: Order.id ←
orderIDcolumn -
To node: Product.id ←
productIDcolumn
Add relationship properties
Use Map from table to add these properties to the relationship:
-
quantity(Integer) - How many units ordered -
unitPrice(Float) - Price at time of purchase -
discount(Float) - Discount applied
Relationship properties
These properties describe the specific connection - how a product was ordered in a specific order. This data can’t be stored on either node.
Run the import
Click Run Import. You should see 2,155 CONTAINS relationships created.
Validate Import
Once you have imported the CONTAINS relationships, click the Check Database button to verify that the task is complete.
Hint
Follow the steps in this lesson to create CONTAINS relationships.
Make sure to:
-
Upload
order-details.csv(2,155 rows) -
Create relationships (not nodes) with type
CONTAINS -
Match Order nodes using
orderId -
Match Product nodes using
productId -
Add relationship properties: quantity (Integer) and unitPrice (Float)
-
Click Run Import
Solution
The CONTAINS relationship should connect:
-
From: Order node (using orderId)
-
To: Product node (using productId)
-
Relationship type:
CONTAINS -
Properties: quantity (Integer), unitPrice (Float)
After running the import, you should have 2,155 CONTAINS relationships, transforming the entire order_details join table into graph relationships.
Download Solution
If you are having trouble, you can download the solution model and open it using the Open model (with data) option.
-
Download 2-create-orders-relationships.zip
-
In the Import tool, click the 3-dot menu (…) and select Open model (with data)
-
Select the downloaded zip file
Summary
You created CONTAINS relationships with properties:
-
2,155 CONTAINS relationships created
-
Added properties: quantity, unitPrice, discount
-
Completed the recommendation path: Customer→Order→Product