Cannot Merge Node error: Neo4j

拜拜、爱过 提交于 2019-12-07 08:46:06

问题


I have 2 CSV files which I want to convert into a Neo4j database. They look like this:

first file:

name,enzyme
Aminomonas paucivorans,M1.Apa12260I
Aminomonas paucivorans,M2.Apa12260I
Bacillus cellulosilyticus,M1.BceNI
Bacillus cellulosilyticus,M2.BceNI

second file 

name,motif
Aminomonas paucivorans,GGAGNNNNNGGC
Aminomonas paucivorans,GGAGNNNNNGGC
Bacillus cellulosilyticus,CCCNNNNNCTC

As you can see the common factor is the Name of the organism and the. Each Organism will have a few Enzymes and each Enzyme will have 1 Motif. Motifs can be same between enzymes . I used the following statement to create my database:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:C:/Users/Desktop.n_e.csv" AS csvLine
MATCH (o:Organism { name: csvLine.name}),(e:Enzyme { name: csvLine.enzyme})
CREATE (o)-[:has_enzyme]->(e)

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:C:/Users/Desktop/n_m.csv" AS csvLine
MATCH (o:Organism { name: csvLine.name}),(m:Motif { name: csvLine.motif})
CREATE (o)-[:has_motif]->(m) 

However I keep getting the error Cannot merge node using null property value for name (Failure when processing URL 'file:C:/Users/Desktop/n_e.csv' on line 2. No rows seem to have been committed. Note that this information might not be accurate.). I googled the issue but got no working solution to this. I made sure my CSV is "vanilla" csv (no spaces, only comma separated). but I keep getting this problem. i am using the 2.1.3 version of Neo4j. Any help will be greately appreciated.

File 1: n_e.csv File 2: n_m.csv


回答1:


  1. Update to 2.1.5
  2. read this blog post on how to check that your data is read correctly.
  3. Also you might check that you don't have windows newlines or an UTF 2-byte file preamble
  4. check that you have an index for :Organism(name) and :Enzyme(name) and :Motif(name) in place

In general try this and check the outputs:

LOAD CSV WITH HEADERS FROM "file:C:/Users/Desktop.n_e.csv" AS csvLine
RETURN csvLine
LIMIT 5

LOAD CSV WITH HEADERS FROM "file:C:/Users/Desktop.n_e.csv" AS csvLine
RETURN csvLine.name,csvLine.enzyme 
LIMIT 5



回答2:


In my case the reason was the spaces in header line. For example, a CVS file:

Name, Surname, City
Jan, Kowalski, Gdansk

so, the Name was imported fine, but the Surname was not recognized (was null), as was space between comma and Surname, etc. After removing it, it started working.



来源:https://stackoverflow.com/questions/26267542/cannot-merge-node-error-neo4j

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!