From 771f13754c6e55050ebbb4564a930a285c64fc89 Mon Sep 17 00:00:00 2001 From: mverkruyse Date: Fri, 25 Aug 2023 14:34:35 -0700 Subject: [PATCH 1/2] 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. --- .../02-openCypher/openCypher-Exercises-Answer-Key.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb b/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb index 63c40676..e3402885 100644 --- a/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb +++ b/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb @@ -373,7 +373,8 @@ "WITH [{first_name: 'Taylor', last_name: 'Hall'},{first_name: 'Kelvin', last_name: 'Fernsby'},{first_name: 'Ian', last_name: 'Rochester'}] as followers\n", "\n", "UNWIND followers as f\n", - "MERGE (n:person {first_name: f.first_name, last_name: f.last_name})-[r:follower]->(:person {first_name: 'Dave'})\n", + "MERGE (d:person {first_name: "Dave"})\n", + "MERGE (n:person {first_name: f.first_name, last_name: f.last_name})-[r:follower]->(d)\n", "ON CREATE\n", " SET r.creation='Created'\n", "ON MATCH\n", From e87da04a8cdbed25b4378bb482c1c33b5de9e9b6 Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Mon, 28 Aug 2023 19:46:32 -0700 Subject: [PATCH 2/2] Update openCypher-Exercises-Answer-Key.ipynb fix quotes --- .../02-openCypher/openCypher-Exercises-Answer-Key.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb b/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb index e3402885..ccb3c431 100644 --- a/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb +++ b/src/graph_notebook/notebooks/06-Language-Tutorials/02-openCypher/openCypher-Exercises-Answer-Key.ipynb @@ -373,7 +373,7 @@ "WITH [{first_name: 'Taylor', last_name: 'Hall'},{first_name: 'Kelvin', last_name: 'Fernsby'},{first_name: 'Ian', last_name: 'Rochester'}] as followers\n", "\n", "UNWIND followers as f\n", - "MERGE (d:person {first_name: "Dave"})\n", + "MERGE (d:person {first_name: 'Dave'})\n", "MERGE (n:person {first_name: f.first_name, last_name: f.last_name})-[r:follower]->(d)\n", "ON CREATE\n", " SET r.creation='Created'\n",