Creating More Nodes

We want to add a couple of User nodes to the graph so we can test the changes to our model.

Any User node will have the following properties:

  • userId - an integer (eg. 123)

  • name - a string (eg. User’s Name)

Replace the ??? in this MERGE query to create two User nodes with the following properties:

  1. userId = 534, name = Sandy Jones,

  2. userId = 105, name = Clinton Spencer,

cypher
MERGE (s:User {userId: ???})
SET s.name = "Sandy Jones"

MERGE (c:User {userId: ???})
SET c.name = "???"

Case sensitivity

The property names and values are case-sensitive. Make sure you use the correct case when entering the property names and values.

Run the query to create 2 User nodes.

You can run the following query to check the nodes have been created:

cypher
MATCH (u:User)
RETURN u.userId, u.name

Validate Results

Once you have run the query, click the Check Database button and we will check the database for you.

Hint

We are expecting two new User nodes in the Sandbox.

Add Sandy Jones and Clinton Spencer using MERGE, making sure we also add their userId values.

Solution

This Cypher will create the two User nodes, with the associated properties:

cypher
MERGE (s:User {userId: 534}) 
SET s.name = "Sandy Jones"

MERGE (c:User {userId: 105}) 
SET c.name = "Clinton Spencer"

Summary

In this challenge, you demonstrated that you can create some nodes to support your instance model.

Your instance model should now look like this:

Instance Model thus far

In the next module, you will learn how to add relationships to your model.