Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-17-2021 01:17 PM
I created a nested json file that contains >10K nodes, each node has >150 properties, I successfully loaded it into neo4j (4.3.1), but, of course, nodes were not created. I know that I can use "CREATE/MERGE (n:PROPERTY) [ON CREATE] SET " method, but for the amount of sample data I have I need type 10K*150 times to "SET n.p1 = xxx, n.p2=xxx.....". I used java to create a cypher script to do that, but the result was that only the first node was created. So I hope some one can provide a sample cypher script file that can create multiple nodes and set properties.
Thanks.
11-19-2021 08:01 AM
The cypher script I created look like this:
begin
MERGE (n:PROPERTY) ON CREATE set
n.p1 = xxxx,
n.p2 = xxxx,
.......,
n.p155 = xxxx ;
commit
begin
MERGE (n:PROPERTY) ON CREATE set
n.p1 = xxxx,
n.p2 = xxxx,
.......
n.p155 = xxxx;
commit
the nodes creation repeats to the end of the cypher script.
This is the first time I tried to create nodes in a cypher script, I copied the format from internet search, but not sure that is correct format. So I need a sample, hope some one can provide a working sample. Thanks.
12-01-2021 10:56 AM
I solved my issue I posted above, but I have a new issue, I ran the cypher script twice, the first time it creates nodes, the second time it stops at first node creation, that is expected because the node has been created, so the error is "Node (0) already exists with label xxxxxx". Is it possible to skip this error. I may add more nodes creation to the cypher script file in the future, so I hope that repeatedly running the same script skips the creation of nodes that exist, only creates nodes that do not exist. Thanks.
12-01-2021 11:28 AM
Again I solved my question myself. If I need to add new node creations to the script, I add at the beginning of the cypher script.
All the sessions of the conference are now available online