Skip to content

Commit bca10f8

Browse files
Update openCypher-Exercises-Answer-Key.ipynb (#526)
* Update openCypher-Exercises-Answer-Key.ipynb As mentioned earlier in the notebook, the `MERGE` clause does not support partial pattern matches. When matching against patterns in `MERGE`, the matches are either the entire pattern, or the entire pattern is created. Because the pattern is a partial match, it currently creates a new "person {first_name: 'Dave'}" node for each of the new "person" added to the graph. By first doing a MERGE for (d:person {first_name: 'Dave'), when the partial match happens, the whole path is again created, but this time linking to the already existing "Dave" rather than creating new ones each time. * Update openCypher-Exercises-Answer-Key.ipynb fix quotes --------- Co-authored-by: Michael Chin <mchin188@yahoo.com>
1 parent 972e4a9 commit bca10f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@
373373
"WITH [{first_name: 'Taylor', last_name: 'Hall'},{first_name: 'Kelvin', last_name: 'Fernsby'},{first_name: 'Ian', last_name: 'Rochester'}] as followers\n",
374374
"\n",
375375
"UNWIND followers as f\n",
376-
"MERGE (n:person {first_name: f.first_name, last_name: f.last_name})-[r:follower]->(:person {first_name: 'Dave'})\n",
376+
"MERGE (d:person {first_name: 'Dave'})\n",
377+
"MERGE (n:person {first_name: f.first_name, last_name: f.last_name})-[r:follower]->(d)\n",
377378
"ON CREATE\n",
378379
" SET r.creation='Created'\n",
379380
"ON MATCH\n",

0 commit comments

Comments
 (0)