Map a Relational Schema to a Graph

Optional Challenge

This challenge reinforces the mapping concepts from the previous lesson. You can skip it and continue to the next module.

Your challenge is to apply the relational-to-graph mapping by designing a minimal graph model.

The Scenario

You have a simple relational schema:

  • customers table: customer_id, company_name, city

  • orders table: order_id, customer_id, order_date

  • order_items table: order_id, product_id, quantity

The foreign keys are: orders.customer_id references customers.customer_id, and order_items links orders to products.

Your Task

Using Arrows.app, create a graph model:

  1. Add three node labels: Customer, Order, Product

  2. Add two relationship types: PLACED (Customer to Order) and CONTAINS (Order to Product)

  3. Add at least one property to the CONTAINS relationship: quantity

This models the junction table order_items as a relationship with properties.

Verify Your Model

Your model should show:

  • Customer nodes connected to Order nodes by PLACED

  • Order nodes connected to Product nodes by CONTAINS with a quantity property

Verify Your Graph Model

Did you create a graph model with Customer, Order, and Product nodes, and PLACED and CONTAINS relationships?

  • ✓ Yes, I created the model in Arrows.app

  • ❏ No, I need to review the mapping concepts

Summary

In this challenge, you applied the mapping rules: entity tables became nodes, and the junction table became a relationship with properties.

Chatbot

How can I help you today?