From 234d42e4bd0cb49deb1ae7234333bbf364542689 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Mon, 10 Mar 2025 18:46:45 +0000 Subject: [PATCH 01/25] Document update/change/delete in block format incremental import --- .../tools/neo4j-admin/neo4j-admin-import.adoc | 103 +++++++++++++++++- 1 file changed, 98 insertions(+), 5 deletions(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index c733fb3f1..f7361ad5a 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -607,12 +607,15 @@ For more information, see <>. ==== * New relationships between existing or new nodes. -The incremental import command cannot be used to: +Starting from 2025.01, the incremental import command can also be used for: -* Add new properties to existing nodes or relationships. -* Update or delete properties in nodes or relationships. -* Update or delete labels in nodes. -* Delete existing nodes and relationships. +* Adding new properties to existing nodes or relationships. +* Updating or deleting properties in nodes or relationships. +* Updating or deleting labels in nodes. +* Deleting existing nodes and relationships. + +This is supported only by `block` format. +See <<#_applying_changes_to_data_via_csv_files>> for more information. === Parameters @@ -1423,6 +1426,96 @@ neo4j_home$ --nodes persons.csv --nodes games.csv --id-type string The `id` property of the nodes in the `persons` group will be stored as `long` type, while the `id` property of the nodes in the `games` group will be stored as `string` type, as the global `id-type` is a string. ==== +[role=label--new-2025.01.0 label--block-only] +== Applying changes to data via CSV files + +You can use CSV files to update your data during incremental import. + +This feature is especially useful when you want to update existing nodes, relationships, labels, or properties in large datasets. +To be able to use this feature, each entity in the dataset must be associated with a unique ID. + +[NOTE] +==== +This feature is supported only by `block` format. +==== + +=== Set an explicit action for each row + +You can set an explicit action for each row in the CSV file by using the `:ACTION` keyword in the header file. +If no action is specified, the import tool works as in full import mode, creating new data. + +The following actions are supported: + +* `empty` = `CREATE` (default) +* `C`, `CREATE` - Creates a new entity. +* `U`, `UPDATE` - Updates an existing entity. +* `D`, `DELETE` - Deletes an existing entity. +Deleting a node also deletes its relationships (`DETACH DELETE`). + + +.Using actions in CSV files to update data +[source, cypher, role="nocopy"] +---- +:ACTION,personId:ID,name,:LABEL +CREATE,1,"Keanu Reeves",Actor +UPDATE,2,"Laurence Fishburne",Actor +DELETE,4 +---- + +=== Update existing labels + +You can add or remove one or more labels from an existing node by prepending the clause `LABEL` in the header with a a `+` (default) or `-`: + +* `:+LABEL` - Add one or more labels to an existing node. +* `:-LABEL` - Remove one or more labels (if they exist) from an existing node. + +Multiple labels are separated by a semicolon. + +For example, a file could have the following format: + +[source, csv] +---- +p0:ID,:+LABEL,:-LABEL,name,age +person1,Actor,Person,"Keanu Reeves",55 +person2,Actor;Director,Person,"Laurence Fishburne",60 +person3,Actor,Person,"Carrie-Anne Moss",53 +---- + +In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist). +The nodes are identified by their `p0` key. + +=== Update existing properties + +You can add or remove properties from an existing entity by prepending the clause `PROPERTY` in the header with a `+` or `-`: + +* `:+PROPERTY` - Add one or more properties (if they exist) to an existing entity. +* `:-PROPERTY` - Remove one or more properties (if they exist) from an existing entity. + +Multiple properties are separated by a semicolon. + +For example, a file could have the following format: + +.Update nodes' properties +[source, cypher, role="nocopy"] +---- +p0:ID,:LABEL,:+PROPERTY,:-PROPERTY +person1,Actor,role,description +person1,Actor;Director,role,description +person1,Actor,role,description +---- + +In this case, all properties in the third column are added and all the properties in the fourth column are removed (if they exist). +The nodes are identified by their `p0` key. + +.Update relationships' properties +[source, cypher, role="nocopy"] +---- +:START_ID,:END_ID,:TYPE,:+PROPERTY,:-PROPERTY +1,2,ACTED_IN,role,description +---- + +In this case, all properties in the fourth column are added and all the properties in the fifth column are removed (if they exist). +The relationships are identified by their `:START_ID`, `:END_ID`, and `:TYPE` keys. == Importing data that spans multiple lines From 4634b968b2b231ee67b78562caaa3c229dacb298 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Tue, 11 Mar 2025 15:22:54 +0000 Subject: [PATCH 02/25] update the actions descriptions --- .../ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index f7361ad5a..048036fa9 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1447,9 +1447,10 @@ If no action is specified, the import tool works as in full import mode, creatin The following actions are supported: * `empty` = `CREATE` (default) -* `C`, `CREATE` - Creates a new entity. -* `U`, `UPDATE` - Updates an existing entity. -* `D`, `DELETE` - Deletes an existing entity. +* `C`, `CREATE` - Creates new nodes and relationships with or without properties. +* `U`, `UPDATE` - Updates existing nodes, relationships, or properties. +Leaving the property identifier empty is like having a “*” wild card. +* `D`, `DELETE` - Deletes an existing node or relationship. Deleting a node also deletes its relationships (`DETACH DELETE`). From 20f6834e81184323f41a0613532333923dd4a3f7 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 13:50:00 +0000 Subject: [PATCH 03/25] update the Applying changes to data via CSV files section --- .../tools/neo4j-admin/neo4j-admin-import.adoc | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 048036fa9..d8cd7fc16 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1426,13 +1426,11 @@ neo4j_home$ --nodes persons.csv --nodes games.csv --id-type string The `id` property of the nodes in the `persons` group will be stored as `long` type, while the `id` property of the nodes in the `games` group will be stored as `string` type, as the global `id-type` is a string. ==== -[role=label--new-2025.01.0 label--block-only] +[role=label--new-2025.01.0] == Applying changes to data via CSV files -You can use CSV files to update your data during incremental import. - -This feature is especially useful when you want to update existing nodes, relationships, labels, or properties in large datasets. -To be able to use this feature, each entity in the dataset must be associated with a unique ID. +You can use CSV files to update existing nodes, relationships, labels, or properties during incremental import. +To be able to do that, each entity in the dataset must be associated with a unique ID. [NOTE] ==== @@ -1447,10 +1445,9 @@ If no action is specified, the import tool works as in full import mode, creatin The following actions are supported: * `empty` = `CREATE` (default) -* `C`, `CREATE` - Creates new nodes and relationships with or without properties. -* `U`, `UPDATE` - Updates existing nodes, relationships, or properties. -Leaving the property identifier empty is like having a “*” wild card. -* `D`, `DELETE` - Deletes an existing node or relationship. +* `C`, `CREATE` - Creates new nodes and relationships, with or without properties, as well as labels. +* `U`, `UPDATE` - Updates existing nodes, relationships, labels, and properties. +* `D`, `DELETE` - Deletes existing nodes or relationships. Deleting a node also deletes its relationships (`DETACH DELETE`). @@ -1465,58 +1462,49 @@ DELETE,4 === Update existing labels -You can add or remove one or more labels from an existing node by prepending the clause `LABEL` in the header with a a `+` (default) or `-`: +You can add or remove one or more labels from an existing node by prepending the clause `LABEL` in the header with a `+` (default) or `-`: * `:+LABEL` - Add one or more labels to an existing node. * `:-LABEL` - Remove one or more labels (if they exist) from an existing node. -Multiple labels are separated by a semicolon. +Multiple labels are separated by a semicolon (default). For example, a file could have the following format: [source, csv] ---- -p0:ID,:+LABEL,:-LABEL,name,age +:ID,:+LABEL,:-LABEL,name,age person1,Actor,Person,"Keanu Reeves",55 person2,Actor;Director,Person,"Laurence Fishburne",60 person3,Actor,Person,"Carrie-Anne Moss",53 ---- In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist). -The nodes are identified by their `p0` key. - -=== Update existing properties - -You can add or remove properties from an existing entity by prepending the clause `PROPERTY` in the header with a `+` or `-`: +The nodes are identified by their `:ID`. -* `:+PROPERTY` - Add one or more properties (if they exist) to an existing entity. -* `:-PROPERTY` - Remove one or more properties (if they exist) from an existing entity. +=== Remove existing properties -Multiple properties are separated by a semicolon. - -For example, a file could have the following format: +You can remove properties from existing nodes or relationships by specifying them after the keyword `:-PROPERTY` in the header file. +All nodes are identified by their `:ID` and all relationships by their `:START_ID`, `:END_ID`, and `:TYPE`. +For example: -.Update nodes' properties +.Remove nodes' properties [source, cypher, role="nocopy"] ---- -p0:ID,:LABEL,:+PROPERTY,:-PROPERTY -person1,Actor,role,description -person1,Actor;Director,role,description -person1,Actor,role,description +:ID,:LABEL,:-PROPERTY,age,hometown +person1,Actor,55,New York ---- -In this case, all properties in the third column are added and all the properties in the fourth column are removed (if they exist). -The nodes are identified by their `p0` key. +Properties `age` and `hometown` are removed from the node with the `:ID` `person1`. -.Update relationships' properties +.Remove relationships' properties [source, cypher, role="nocopy"] ---- -:START_ID,:END_ID,:TYPE,:+PROPERTY,:-PROPERTY +:START_ID,:END_ID,:TYPE,:-PROPERTY, role, description 1,2,ACTED_IN,role,description ---- -In this case, all properties in the fourth column are added and all the properties in the fifth column are removed (if they exist). -The relationships are identified by their `:START_ID`, `:END_ID`, and `:TYPE` keys. +Properties `role` and `description` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. == Importing data that spans multiple lines From f50396f78fa727ae588b2bced8edf5f1f9b2ae49 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 14:00:53 +0000 Subject: [PATCH 04/25] Add a property column as an identifier --- .../tools/neo4j-admin/neo4j-admin-import.adoc | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index d8cd7fc16..da82930cb 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1430,7 +1430,6 @@ The `id` property of the nodes in the `persons` group will be stored as `long` t == Applying changes to data via CSV files You can use CSV files to update existing nodes, relationships, labels, or properties during incremental import. -To be able to do that, each entity in the dataset must be associated with a unique ID. [NOTE] ==== @@ -1451,7 +1450,7 @@ The following actions are supported: Deleting a node also deletes its relationships (`DETACH DELETE`). -.Using actions in CSV files to update data +.Using actions in CSV files to update nodes [source, cypher, role="nocopy"] ---- :ACTION,personId:ID,name,:LABEL @@ -1460,6 +1459,32 @@ UPDATE,2,"Laurence Fishburne",Actor DELETE,4 ---- +Nodes are identified by their unique property value for the key/label combination that the header specifies. + +.Using actions in CSV files to update relationships +[source, cypher, role="nocopy"] +---- +:ACTION,:START_ID,:END_ID,:TYPE,role +CREATE,1,2,ACTED_IN,"Neo" +UPDATE,1,2,ACTED_IN,"Morpheus" +DELETE,1,3,ACTED_IN +---- + +Relationships are identified non-uniquely by their start and end node IDs, and their type. + +To further narrow down selection you can tag a property column as an identifier to help out in selecting relationships uniquely (or at least more uniquely). + +.Using actions in CSV files to update relationships with identifier properties +[source, cypher, role="nocopy"] +---- +:ACTION,:START_ID,:TYPE,:END_ID,p1{identifier:true},name,p4 +U,1,KNOWS,2,abc,"Keanu Reeves","Hello Morpheus" +U,1,KNOWS,2,def,"Laurence Fishburne","Hello Neo" +---- + +The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. +Identifier properties will match the selected relationships and as such not be set on the relationships (they already have it). + === Update existing labels You can add or remove one or more labels from an existing node by prepending the clause `LABEL` in the header with a `+` (default) or `-`: @@ -1480,7 +1505,6 @@ person3,Actor,Person,"Carrie-Anne Moss",53 ---- In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist). -The nodes are identified by their `:ID`. === Remove existing properties @@ -1495,7 +1519,7 @@ For example: person1,Actor,55,New York ---- -Properties `age` and `hometown` are removed from the node with the `:ID` `person1`. +Properties `age` and `hometown` are removed from the node with the `:ID` `person1` and label `Actor`. .Remove relationships' properties [source, cypher, role="nocopy"] From 0bc75b06422c16e4d4629a0af366f0e90ed0bb9f Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:42:36 +0000 Subject: [PATCH 05/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index da82930cb..c0dfac0e0 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1508,7 +1508,8 @@ In this case, all labels in the second column are added and all the labels in th === Remove existing properties -You can remove properties from existing nodes or relationships by specifying them after the keyword `:-PROPERTY` in the header file. +You can remove properties from existing nodes or relationships by a `:-PROPERTY` column in the header. +In the contents of this field you can add zero or more property names to remove from the entity. All nodes are identified by their `:ID` and all relationships by their `:START_ID`, `:END_ID`, and `:TYPE`. For example: From 8d338a52166b31bd8227bf07f9f2e29ad994a740 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:44:19 +0000 Subject: [PATCH 06/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index c0dfac0e0..78f7ef3f0 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1516,7 +1516,7 @@ For example: .Remove nodes' properties [source, cypher, role="nocopy"] ---- -:ID,:LABEL,:-PROPERTY,age,hometown +:ACTION,:ID,:-PROPERTY person1,Actor,55,New York ---- From c7c8c314180be09a74353a70ae4718c4b8b7c32c Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:45:28 +0000 Subject: [PATCH 07/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 78f7ef3f0..3c6300db9 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1517,7 +1517,7 @@ For example: [source, cypher, role="nocopy"] ---- :ACTION,:ID,:-PROPERTY -person1,Actor,55,New York +U,person1,Actor,55,New York ---- Properties `age` and `hometown` are removed from the node with the `:ID` `person1` and label `Actor`. From 04fb3403543cad7834be5774fad4ed3698f2b41d Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:46:01 +0000 Subject: [PATCH 08/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 3c6300db9..a6cd30391 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1520,7 +1520,7 @@ For example: U,person1,Actor,55,New York ---- -Properties `age` and `hometown` are removed from the node with the `:ID` `person1` and label `Actor`. +Properties `55` and `New York` are removed from the node with the `:ID` `person1`. .Remove relationships' properties [source, cypher, role="nocopy"] From 203b7e12b980a1d979418a95d344230cdf2d790d Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:46:15 +0000 Subject: [PATCH 09/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index a6cd30391..72ad54020 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1525,7 +1525,7 @@ Properties `55` and `New York` are removed from the node with the `:ID` `person1 .Remove relationships' properties [source, cypher, role="nocopy"] ---- -:START_ID,:END_ID,:TYPE,:-PROPERTY, role, description +:ACTION, :START_ID,:END_ID,:TYPE,:-PROPERTY 1,2,ACTED_IN,role,description ---- From 44a0467924cc2c2a6dd8954daa709e597523a1f9 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:46:39 +0000 Subject: [PATCH 10/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 72ad54020..e87622832 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1526,7 +1526,7 @@ Properties `55` and `New York` are removed from the node with the `:ID` `person1 [source, cypher, role="nocopy"] ---- :ACTION, :START_ID,:END_ID,:TYPE,:-PROPERTY -1,2,ACTED_IN,role,description +U, 1,2,ACTED_IN,Neo,"The chosen one" ---- Properties `role` and `description` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. From 932c9a07d02ea015200973d28befa4fe91d9612f Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:47:36 +0000 Subject: [PATCH 11/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index e87622832..b01f9566d 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1529,7 +1529,7 @@ Properties `55` and `New York` are removed from the node with the `:ID` `person1 U, 1,2,ACTED_IN,Neo,"The chosen one" ---- -Properties `role` and `description` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. +Properties Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. == Importing data that spans multiple lines From 36ec9aa6a5087900867416dff4481d4d38f3b35c Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:47:51 +0000 Subject: [PATCH 12/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index b01f9566d..a6b468792 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1526,7 +1526,7 @@ Properties `55` and `New York` are removed from the node with the `:ID` `person1 [source, cypher, role="nocopy"] ---- :ACTION, :START_ID,:END_ID,:TYPE,:-PROPERTY -U, 1,2,ACTED_IN,Neo,"The chosen one" +U,1,2,ACTED_IN,Neo,"The chosen one" ---- Properties Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. From 513d924816ccec4b5bf78a68394bb9f4fb8a033c Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 15:48:37 +0000 Subject: [PATCH 13/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index a6b468792..823c4fc48 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1492,7 +1492,6 @@ You can add or remove one or more labels from an existing node by prepending the * `:+LABEL` - Add one or more labels to an existing node. * `:-LABEL` - Remove one or more labels (if they exist) from an existing node. -Multiple labels are separated by a semicolon (default). For example, a file could have the following format: From 759ac1a9a65b109750090d88b7c38e130aaadea6 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Wed, 12 Mar 2025 16:06:33 +0000 Subject: [PATCH 14/25] update the examples again --- .../tools/neo4j-admin/neo4j-admin-import.adoc | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 823c4fc48..862e506f9 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1453,10 +1453,10 @@ Deleting a node also deletes its relationships (`DETACH DELETE`). .Using actions in CSV files to update nodes [source, cypher, role="nocopy"] ---- -:ACTION,personId:ID,name,:LABEL -CREATE,1,"Keanu Reeves",Actor -UPDATE,2,"Laurence Fishburne",Actor -DELETE,4 +:ACTION,uid:ID(label:Person),name,:LABEL +CREATE,person1,"Keanu Reeves",Actor +UPDATE,person2,"Laurence Fishburne",Actor +DELETE,person4 ---- Nodes are identified by their unique property value for the key/label combination that the header specifies. @@ -1465,9 +1465,9 @@ Nodes are identified by their unique property value for the key/label combinatio [source, cypher, role="nocopy"] ---- :ACTION,:START_ID,:END_ID,:TYPE,role -CREATE,1,2,ACTED_IN,"Neo" -UPDATE,1,2,ACTED_IN,"Morpheus" -DELETE,1,3,ACTED_IN +CREATE,person1,movie1,ACTED_IN,"Neo" +UPDATE,person2,movie1,ACTED_IN,"Morpheus" +DELETE,person3,movie1,ACTED_IN ---- Relationships are identified non-uniquely by their start and end node IDs, and their type. @@ -1478,8 +1478,8 @@ To further narrow down selection you can tag a property column as an identifier [source, cypher, role="nocopy"] ---- :ACTION,:START_ID,:TYPE,:END_ID,p1{identifier:true},name,p4 -U,1,KNOWS,2,abc,"Keanu Reeves","Hello Morpheus" -U,1,KNOWS,2,def,"Laurence Fishburne","Hello Neo" +U,person1,KNOWS,person2,abc,"Keanu Reeves","Hello Morpheus" +U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo" ---- The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. @@ -1497,10 +1497,9 @@ For example, a file could have the following format: [source, csv] ---- -:ID,:+LABEL,:-LABEL,name,age -person1,Actor,Person,"Keanu Reeves",55 -person2,Actor;Director,Person,"Laurence Fishburne",60 -person3,Actor,Person,"Carrie-Anne Moss",53 +uid:ID(label:Person),:+LABEL,:-LABEL,name,age +person1,Actor,Producer,"Keanu Reeves",55 +person2,Actor;Director,"Laurence Fishburne",60 ---- In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist). @@ -1515,20 +1514,36 @@ For example: .Remove nodes' properties [source, cypher, role="nocopy"] ---- -:ACTION,:ID,:-PROPERTY -U,person1,Actor,55,New York +:ACTION,uid:ID(label:Person),:-PROPERTY +U,person1,55;New York ---- -Properties `55` and `New York` are removed from the node with the `:ID` `person1`. +Properties `55` and `New York` are removed from the node with the `uid:ID` `person1`. .Remove relationships' properties [source, cypher, role="nocopy"] ---- -:ACTION, :START_ID,:END_ID,:TYPE,:-PROPERTY -U,1,2,ACTED_IN,Neo,"The chosen one" +:ACTION,:START_ID,:END_ID,:TYPE,:-PROPERTY +U,person1,movie1,ACTED_IN,Neo;"The chosen one" ---- -Properties Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`. +Properties `Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `person1`, `:END_ID` `movie1`, and `:TYPE` `ACTED_IN`. + +.Using actions in CSV files to update labels and properties +[source, cypher, role="nocopy"] +---- +:ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int +U,person1,Actor,Producer,46;New York,"Henry",185 +---- + +One CSV entry can specify all types of updates to one entity at the same time. +In this example, the node `person1` is updated with: + +* added `Actor` label +* removed `Producer` label +* removed `age` and `hometown` properties +* set `name="Henry"` property +* set `height=185` property == Importing data that spans multiple lines From 7788e0aed4e04567f6e6dfedd644e6ed48705761 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:46:47 +0000 Subject: [PATCH 15/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 862e506f9..c0aab62b4 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1456,7 +1456,7 @@ Deleting a node also deletes its relationships (`DETACH DELETE`). :ACTION,uid:ID(label:Person),name,:LABEL CREATE,person1,"Keanu Reeves",Actor UPDATE,person2,"Laurence Fishburne",Actor -DELETE,person4 +DELETE,person4,, ---- Nodes are identified by their unique property value for the key/label combination that the header specifies. From 3cf6e3da1432b93a7a8273ae29aec5f340b8b238 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:47:22 +0000 Subject: [PATCH 16/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index c0aab62b4..fbaa01f0b 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1482,7 +1482,7 @@ U,person1,KNOWS,person2,abc,"Keanu Reeves","Hello Morpheus" U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo" ---- -The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. +The data in the `p1` column for these relationships helps "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. Identifier properties will match the selected relationships and as such not be set on the relationships (they already have it). === Update existing labels From 2565704bea4dff622592d47373133083af208db1 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:49:36 +0000 Subject: [PATCH 17/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index fbaa01f0b..9382c2529 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1499,7 +1499,7 @@ For example, a file could have the following format: ---- uid:ID(label:Person),:+LABEL,:-LABEL,name,age person1,Actor,Producer,"Keanu Reeves",55 -person2,Actor;Director,"Laurence Fishburne",60 +person2,Actor;Director,,"Laurence Fishburne",60 ---- In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist). From 1cea76e7bd18df4bf5a3dabfcea3894d41e515dd Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:50:29 +0000 Subject: [PATCH 18/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 9382c2529..ecd2eeaae 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1515,7 +1515,7 @@ For example: [source, cypher, role="nocopy"] ---- :ACTION,uid:ID(label:Person),:-PROPERTY -U,person1,55;New York +U,person1,age;hometown ---- Properties `55` and `New York` are removed from the node with the `uid:ID` `person1`. From cd0be548e61d9c687e572e9a9c7a78fee653dc10 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:51:12 +0000 Subject: [PATCH 19/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index ecd2eeaae..91955e871 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1524,7 +1524,7 @@ Properties `55` and `New York` are removed from the node with the `uid:ID` `pers [source, cypher, role="nocopy"] ---- :ACTION,:START_ID,:END_ID,:TYPE,:-PROPERTY -U,person1,movie1,ACTED_IN,Neo;"The chosen one" +U,person1,movie1,ACTED_IN,role;description ---- Properties `Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `person1`, `:END_ID` `movie1`, and `:TYPE` `ACTED_IN`. From 0168201dc5f0b19e4bfa8325ccfc0d46e95feb96 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:51:45 +0000 Subject: [PATCH 20/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 91955e871..3f0df594b 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1533,7 +1533,7 @@ Properties `Neo` and `"The chosen one"` are removed from the relationship with t [source, cypher, role="nocopy"] ---- :ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int -U,person1,Actor,Producer,46;New York,"Henry",185 +U,person1,Actor,Producer,age;hometown,Henry",185 ---- One CSV entry can specify all types of updates to one entity at the same time. From d7a9a2a679b340bab5728d87a6f443ae9cf68d52 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 13:52:27 +0000 Subject: [PATCH 21/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 3f0df594b..c7423f46b 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1508,7 +1508,6 @@ In this case, all labels in the second column are added and all the labels in th You can remove properties from existing nodes or relationships by a `:-PROPERTY` column in the header. In the contents of this field you can add zero or more property names to remove from the entity. -All nodes are identified by their `:ID` and all relationships by their `:START_ID`, `:END_ID`, and `:TYPE`. For example: .Remove nodes' properties From a8313336886735c9cea65783b0e3740ff3168aa8 Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 14:01:32 +0000 Subject: [PATCH 22/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index c7423f46b..b01003830 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1483,7 +1483,7 @@ U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo" ---- The data in the `p1` column for these relationships helps "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. -Identifier properties will match the selected relationships and as such not be set on the relationships (they already have it). +Identifier properties match the selected relationships and will not be set on the relationships that already have them. === Update existing labels From 5993e6022cfeae465740f9aab8f6fac14f829f9f Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 14:01:39 +0000 Subject: [PATCH 23/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index b01003830..4779fb6e0 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1482,7 +1482,8 @@ U,person1,KNOWS,person2,abc,"Keanu Reeves","Hello Morpheus" U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo" ---- -The data in the `p1` column for these relationships helps "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist. +The data in the `p1` column for these relationships helps select relationships "more uniquely" if a multiple of `1,KNOWS,2` exists. +There can also be multiple identifier properties defined in the header. Identifier properties match the selected relationships and will not be set on the relationships that already have them. === Update existing labels From 84fdea735c38eb47685a9cfac56d8ffb559361fe Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 21:44:32 +0000 Subject: [PATCH 24/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 4779fb6e0..3a787d8d6 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1527,7 +1527,7 @@ Properties `55` and `New York` are removed from the node with the `uid:ID` `pers U,person1,movie1,ACTED_IN,role;description ---- -Properties `Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `person1`, `:END_ID` `movie1`, and `:TYPE` `ACTED_IN`. +Properties `role` and `description` are removed from the relationship with the `:START_ID` `person1`, `:END_ID` `movie1`, and `:TYPE` `ACTED_IN`. .Using actions in CSV files to update labels and properties [source, cypher, role="nocopy"] From 167c0bcc6fd79a46b85abe088302cab3fa0ed81e Mon Sep 17 00:00:00 2001 From: Reneta Popova Date: Thu, 13 Mar 2025 21:44:56 +0000 Subject: [PATCH 25/25] Update modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc --- modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc index 3a787d8d6..50053323a 100644 --- a/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc +++ b/modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc @@ -1518,7 +1518,7 @@ For example: U,person1,age;hometown ---- -Properties `55` and `New York` are removed from the node with the `uid:ID` `person1`. +Properties `age` and `hometown` are removed from the node with the `uid:ID` `person1`. .Remove relationships' properties [source, cypher, role="nocopy"]