Database Reference
In-Depth Information
6.3.1. Creating new graph entities
To create a node with properties, you can use the following syntax:
Thecommand that creates graphentities is,unsurprisingly, create ,followed bythenode
identifier
. Following that, you specify a comma-separated list of properties to be ad-
ded to the node, enclosed with curly brackets
. Each property is specified by its name,
followedbyacolon,followedbyapropertyvalue
.Stringpropertyvaluesareenclosed
in single quotes, but numeric and Boolean properties don't need any quotes . Finally,
you return the newly created node using its identifier, just like in the previous Cypher ex-
amples.
Okay, you've created a node, so how about creating a relationship? Let's make the newly
added user Grace a friend of John:
You want to create a relationship between the existing two nodes, so you need to somehow
reference them first. This is done exactly the same way as specifying start nodes in a read-
only query, using the start clause and node lookup . Next, in the create clause,
yousimplyspecifythegraphpathasapatternreferencingstartingnodesbytheiridentifiers
and setting the relationship you want to create between them
.
Search WWH ::




Custom Search