Skip to content

Commit 8581ef7

Browse files
Apply suggestions from code review
Co-authored-by: Jessica Wright <[email protected]>
1 parent 7cf61b3 commit 8581ef7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/ROOT/pages/cypher/updating.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,18 @@ RETURN j, r, m
269269

270270
The result is more duplication.
271271
`MERGE` tries to match the *entire* pattern, and if it doesn't exist, it is created.
272-
This happens because `MERGE` tries to find the information queried and, if it doesn't exist, it is then created.
273272

274273
Even though the graph already has Ann and Mark's nodes, the pattern `(Ann)-[:IS_FRIENDS_WITH]->(Mark)` doesn't exist, so all elements are created anew.
275274
To avoid the duplication, you need to first `MATCH` the nodes and then create the relationship.
276275

277-
[IMPORTANT]
276+
[NOTE]
278277
====
279278
If you created the previous duplication, you don't need to fix it before proceeding with the tutorial.
280279
However, if you didn't do it, you need to create a new node for Mark, as it was removed in xref:cypher/updating.adoc#_delete_a_node_and_its_relationships[the previous step].
281280
You can do it using either `CREATE` or `MERGE`.
282281
====
283282

284-
In order to create the new relationship, without duplications, you need to first `MATCH` Ann and Mark's nodes:
283+
In order to create the new relationship, without duplications, you need to first `MATCH` Ann and Mark's nodes and then `MERGE` (or `CREATE`) the relationship:
285284

286285
[source, cypher]
287286
----
@@ -291,7 +290,6 @@ MERGE (a)-[r:IS_FRIENDS_WITH]->(m)
291290
RETURN a, r, m
292291
----
293292

294-
`MATCH` finds both Mark and Ann's node before `MERGE` (finds or) creates the relationship between them.
295293

296294
image::ann-friends-mark.svg[Ann and Mark's nodes are connected through a is friends with relationship,width=400,role=popup]
297295

0 commit comments

Comments
 (0)