Skip to content

Commit 759ac1a

Browse files
committed
update the examples again
1 parent 513d924 commit 759ac1a

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

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

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,10 +1453,10 @@ Deleting a node also deletes its relationships (`DETACH DELETE`).
14531453
.Using actions in CSV files to update nodes
14541454
[source, cypher, role="nocopy"]
14551455
----
1456-
:ACTION,personId:ID,name,:LABEL
1457-
CREATE,1,"Keanu Reeves",Actor
1458-
UPDATE,2,"Laurence Fishburne",Actor
1459-
DELETE,4
1456+
:ACTION,uid:ID(label:Person),name,:LABEL
1457+
CREATE,person1,"Keanu Reeves",Actor
1458+
UPDATE,person2,"Laurence Fishburne",Actor
1459+
DELETE,person4
14601460
----
14611461

14621462
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
14651465
[source, cypher, role="nocopy"]
14661466
----
14671467
: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
1468+
CREATE,person1,movie1,ACTED_IN,"Neo"
1469+
UPDATE,person2,movie1,ACTED_IN,"Morpheus"
1470+
DELETE,person3,movie1,ACTED_IN
14711471
----
14721472

14731473
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
14781478
[source, cypher, role="nocopy"]
14791479
----
14801480
: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"
1481+
U,person1,KNOWS,person2,abc,"Keanu Reeves","Hello Morpheus"
1482+
U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo"
14831483
----
14841484

14851485
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:
14971497

14981498
[source, csv]
14991499
----
1500-
:ID,:+LABEL,:-LABEL,name,age
1501-
person1,Actor,Person,"Keanu Reeves",55
1502-
person2,Actor;Director,Person,"Laurence Fishburne",60
1503-
person3,Actor,Person,"Carrie-Anne Moss",53
1500+
uid:ID(label:Person),:+LABEL,:-LABEL,name,age
1501+
person1,Actor,Producer,"Keanu Reeves",55
1502+
person2,Actor;Director,"Laurence Fishburne",60
15041503
----
15051504

15061505
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:
15151514
.Remove nodes' properties
15161515
[source, cypher, role="nocopy"]
15171516
----
1518-
:ACTION,:ID,:-PROPERTY
1519-
U,person1,Actor,55,New York
1517+
:ACTION,uid:ID(label:Person),:-PROPERTY
1518+
U,person1,55;New York
15201519
----
15211520

1522-
Properties `55` and `New York` are removed from the node with the `:ID` `person1`.
1521+
Properties `55` and `New York` are removed from the node with the `uid:ID` `person1`.
15231522

15241523
.Remove relationships' properties
15251524
[source, cypher, role="nocopy"]
15261525
----
1527-
:ACTION, :START_ID,:END_ID,:TYPE,:-PROPERTY
1528-
U,1,2,ACTED_IN,Neo,"The chosen one"
1526+
:ACTION,:START_ID,:END_ID,:TYPE,:-PROPERTY
1527+
U,person1,movie1,ACTED_IN,Neo;"The chosen one"
15291528
----
15301529

1531-
Properties Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `1`, `:END_ID` `2`, and `:TYPE` `ACTED_IN`.
1530+
Properties `Neo` and `"The chosen one"` are removed from the relationship with the `:START_ID` `person1`, `:END_ID` `movie1`, and `:TYPE` `ACTED_IN`.
1531+
1532+
.Using actions in CSV files to update labels and properties
1533+
[source, cypher, role="nocopy"]
1534+
----
1535+
:ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int
1536+
U,person1,Actor,Producer,46;New York,"Henry",185
1537+
----
1538+
1539+
One CSV entry can specify all types of updates to one entity at the same time.
1540+
In this example, the node `person1` is updated with:
1541+
1542+
* added `Actor` label
1543+
* removed `Producer` label
1544+
* removed `age` and `hometown` properties
1545+
* set `name="Henry"` property
1546+
* set `height=185` property
15321547

15331548
== Importing data that spans multiple lines
15341549

0 commit comments

Comments
 (0)