0
votes

I'm trying to create a about 27 millions relationships along with 15 million nodes, initially I was using Cypher, but it was taking a lot of time, so I switched neo4j-import tool utility.

I have confusion whether the result of cypher query is same as that of neo4j-import.

My Cypher query was:

load csv from "file://dataframe6.txt" as line fieldterminator" "
MERGE (A :concept{name:line[0]})
WITH line, A
MERGE (B :concept{name:line[1]})
WITH B,A
MERGE (A)-[:test]->(B);

Content in dataframe6 :

C0000005,C0036775,RB_
C0000039,C0000039,SY_sort_version_of
C0000039,C0000039,SY_entry_version_of
C0000039,C0000039,SY_permuted_term_of
C0000039,C0001555,AQ_
C0000039,C0001688,AQ_

My neo4j-import script:

neo4j-import --into graph.db --nodes:concept "nheader,MRREL-nodes" --relationships "rheader,MRREL-relations"  --skip-duplicate-node true

rheader : :START_ID,:END_ID,:TYPE

nheader : :ID,name

MRREL-nodes :

C0000005,C0000005
C0000039,C0000039
C0000052,C0000052
C0036775,C0036775
C0001555,C0001555

MRREL-relations

C0000005,C0036775,RB_
C0000039,C0000039,SY_sort_version_of
C0000039,C0000039,SY_entry_version_of
C0000039,C0000039,SY_permuted_term_of
C0000039,C0001555,AQ_
C0000039,C0001688,AQ_

Somehow I don't see same result

1

1 Answers

2
votes

[EDITED]

  1. If you want your relationships to have dynamically assigned types, then you need to change your Cypher code to make use of line[2] to specify the relationship type (e.g., via the APOC procedure apoc.create.relationship). It is currently always using test as the type.

  2. If, instead, you actually wanted all the relationships imported by neo4j-import to have the same test type, then you need to use the right syntax.

    Try removing ",:TYPE" from rheader, and use this import command line ( --relationships has been changed to --relationships:test):

    neo4j-import --into graph.db --nodes:concept "nheader,MRREL-nodes" --relationships:test "rheader,MRREL-relations"  --skip-duplicate-node true