Neo4j creating relationships using csv -
i trying create relationships between 2 types of nodes using csv file loaded. have created movies , keywords nodes. created indexes on :movie(title) , :keyword(word).
my csv file looks like:
"title"|year|"word" //header
"into wild"|2007|"1990s" //line title, year , keyword
"into wild"|2007|"abandoned-bus"
my query:
load csv headers "file:/home/gondil/temp.csv" csv fieldterminator '|' match (m:movie {title:csv.title,year: toint(csv.year)}), (k:keyword {word:csv.word}) merge (m)-[:has {weight:1}]->(k);
query runs 1 hr , shows error "unknown error". redundant error description.
i thought due 160k keywords , on 1m movies , on 4m lines in csv. shorten csv 1 line , still running 15 minutes no stop.
where problem? how write query creating relationships between 2 created nodes?
i can delete nodes , build database other way improve not delete created nodes.
note: shouldn't have hardware problems cause utilize super pc our faculty.
be sure have schema indexes in place speed looking start nodes. before running import a:
create index on :movie(title) create index on :keyword(word)
make sure indexes populated , online (check :schema
command).
refactor cypher command 2 queries, create utilize of indexes - index consists of label , one property:
using periodic commit load csv headers "file:/home/gondil/temp.csv" csv fieldterminator '|' merge (m:movie {title:csv.title }) on create set m.year = toint(csv.year) merge (k:keyword {word:csv.word})
second pass on file
using periodic commit load csv headers "file:/home/gondil/temp.csv" csv fieldterminator '|' match (m:movie {title:csv.title }) match (k:keyword {word:csv.word}) merge (m)-[:has {weight:1}]->(k);
csv neo4j cypher relationships
No comments:
Post a Comment