Challenge: Refactor the graph

Introduction

In this challenge, you will need to:

  1. Identify an opportunity to refactor the graph by adding a new label, creating indirect relationships, or normalizing properties to nodes.

  2. Write the Cypher query to refactor the graph.

  3. Create a new query that takes advantage of the refactored graph structure.

Looking for an extra challenge?

If you have completed the challenge above and are looking for an extra challenge, you can try refactoring the graph to calculate and store the total cost of an order by summing the price of the products in the order.

The total cost of an order is calculated from the sum of the line costs of the products in the order. The line cost of a product can be calculated from properties on the ORDERS relationship using the formula lineCost = quantity * unitPrice * (1 - discount).

View order line properties
MATCH (order:Order)-[line:ORDERS]-()
RETURN order.orderID, line.quantity, line.unitPrice, line.discount

Lesson Summary

In this challenge, you refactored the graph to improve performance and maintainability.

Chatbot

How can I help you today?