Skip to content

Commit f50396f

Browse files
committed
Add a property column as an identifier
1 parent 20f6834 commit f50396f

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

modules/ROOT/pages/tools/neo4j-admin/neo4j-admin-import.adoc

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,6 @@ The `id` property of the nodes in the `persons` group will be stored as `long` t
14301430
== Applying changes to data via CSV files
14311431

14321432
You can use CSV files to update existing nodes, relationships, labels, or properties during incremental import.
1433-
To be able to do that, each entity in the dataset must be associated with a unique ID.
14341433

14351434
[NOTE]
14361435
====
@@ -1451,7 +1450,7 @@ The following actions are supported:
14511450
Deleting a node also deletes its relationships (`DETACH DELETE`).
14521451

14531452

1454-
.Using actions in CSV files to update data
1453+
.Using actions in CSV files to update nodes
14551454
[source, cypher, role="nocopy"]
14561455
----
14571456
:ACTION,personId:ID,name,:LABEL
@@ -1460,6 +1459,32 @@ UPDATE,2,"Laurence Fishburne",Actor
14601459
DELETE,4
14611460
----
14621461

1462+
Nodes are identified by their unique property value for the key/label combination that the header specifies.
1463+
1464+
.Using actions in CSV files to update relationships
1465+
[source, cypher, role="nocopy"]
1466+
----
1467+
:ACTION,:START_ID,:END_ID,:TYPE,role
1468+
CREATE,1,2,ACTED_IN,"Neo"
1469+
UPDATE,1,2,ACTED_IN,"Morpheus"
1470+
DELETE,1,3,ACTED_IN
1471+
----
1472+
1473+
Relationships are identified non-uniquely by their start and end node IDs, and their type.
1474+
1475+
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).
1476+
1477+
.Using actions in CSV files to update relationships with identifier properties
1478+
[source, cypher, role="nocopy"]
1479+
----
1480+
:ACTION,:START_ID,:TYPE,:END_ID,p1{identifier:true},name,p4
1481+
U,1,KNOWS,2,abc,"Keanu Reeves","Hello Morpheus"
1482+
U,1,KNOWS,2,def,"Laurence Fishburne","Hello Neo"
1483+
----
1484+
1485+
The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist.
1486+
Identifier properties will match the selected relationships and as such not be set on the relationships (they already have it).
1487+
14631488
=== Update existing labels
14641489

14651490
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
14801505
----
14811506

14821507
In this case, all labels in the second column are added and all the labels in the third column are removed (if they exist).
1483-
The nodes are identified by their `:ID`.
14841508

14851509
=== Remove existing properties
14861510

@@ -1495,7 +1519,7 @@ For example:
14951519
person1,Actor,55,New York
14961520
----
14971521

1498-
Properties `age` and `hometown` are removed from the node with the `:ID` `person1`.
1522+
Properties `age` and `hometown` are removed from the node with the `:ID` `person1` and label `Actor`.
14991523

15001524
.Remove relationships' properties
15011525
[source, cypher, role="nocopy"]

0 commit comments

Comments
 (0)