Skip to content

Commit 1f9ed8b

Browse files
Apply suggestions from code review
Co-authored-by: Jessica Wright <[email protected]>
1 parent 2e42a50 commit 1f9ed8b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

modules/ROOT/pages/cypher/updating.adoc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ image::update-graph.svg[All nodes added to the graph,width=500]
6262

6363
== Add a property to a node
6464

65-
If you want to add a birthday for the person named Jennifer, you can use this query:
65+
If you want to add a birthday for the person named Jennifer, you can add this information as a _property_ with this query:
6666

6767
[source, cypher]
6868
--
@@ -71,7 +71,7 @@ SET p.birthdate = date('1980-01-01')
7171
RETURN p
7272
--
7373

74-
What this query does is:
74+
This query does the following:
7575

7676
. Find Jennifer's node with the `MATCH` clause.
7777
. Use `SET` to create the new property `birthday` (with syntax `variable.property`) and set its value.
@@ -90,7 +90,7 @@ This is the tabular result:
9090

9191
== Update a property
9292

93-
To change Jennifer's birthdate, you can use the same query from the previous example to find Jennifer's node again, and then add a different date with the `SET` clause:
93+
To change Jennifer's birthdate, you can use the same query from the previous example to find Jennifer's node again, and change the property value by adding a different date with the `SET` clause:
9494

9595
[source, cypher]
9696
--
@@ -157,10 +157,10 @@ This is the result:
157157

158158
== Delete a relationship
159159

160-
You can use the `DELETE` clause for deleting both relationships and nodes.
160+
You can use the `DELETE` clause to delete both relationships and nodes.
161161
However, because Neo4j is ACID-compliant, you cannot delete a node if it still has relationships.
162162

163-
Therefore, if you want to xref:cypher/updating.adoc#_delete_a_node[delete a node], for example, Jennifer's node, you need to first delete the relationships appended to it:
163+
Therefore, if you want to xref:cypher/updating.adoc#_delete_a_node[delete a node], for example Jennifer's node, you need to first delete the relationships appended to it:
164164

165165
[source,cypher]
166166
--
@@ -199,7 +199,7 @@ The result is the following message: "Deleted 1 node, deleted 2 relationships".
199199
== Add new data
200200

201201
If you want to add new data to your graph, it's important to avoid duplication.
202-
For example, if you want to create a node that already exists in the graph using `CREATE`:
202+
For example, if you try to create a node that already exists in the graph using `CREATE`:
203203

204204
[source, cypher]
205205
--
@@ -291,8 +291,7 @@ RETURN j, r, m
291291
----
292292

293293
`MATCH` finds both Mark and Jennifer's node before `MERGE` (finds or) creates the relationship between them.
294-
This time, it's better not to use `CREATE` optionally because, if you run the statement again, it will duplicate the `IS_FRIENDS_WITH` relationship, but not the nodes.
295-
Therefore, it is recommended to use `MERGE` to avoid such scenarios.
294+
You can use `CREATE` for the relationship, but you would then risk creating a duplicate relationship (if it already exists).
296295

297296
Since this relationship didn't exist after xref:cypher/updating.adoc#_delete_a_node_and_its_relationships[Mark's node and appended relationships] were deleted, the result is a newly created relationship:
298297

0 commit comments

Comments
 (0)