简体   繁体   English

使用关系属性时,Neo4j csv导入中的“ [null]不是受支持的属性值”

[英]“[null] is not a supported property value” in Neo4j csv import when using relationship properties

This is for Neo4j Milestone Release 2.1.0-M01. 这是针对Neo4j Milestone版本2.1.0-M01。 I have been trying to import this small .csv file: 我一直在尝试导入这个小的.csv文件:

Google Doc Google文件

I have tried four different formats for column D. 我为D列尝试了四种不同的格式。

  • type: "club" 类型:“俱乐部”
  • type: club 类型:俱乐部
  • type:club 类型:俱乐部
  • club 俱乐部

My Cypher query: 我的Cypher查询:

LOAD CSV FROM "file:<PATH_TO_FILE>/Soccer_players.csv" AS line
MERGE (p:Player {name: line[0]})
MERGE (t:Team {name: line[1]})
CREATE (p)-[:PLAYS_FOR {type: line[3]}]->(t)

When I don't include "{type: line[3]}", it imports fine. 当我不包括“ {type:line [3]}”时,它可以很好地导入。 When trying to add this relationship property I get the error message 尝试添加此关系属性时,出现错误消息

[null] is not a supported property value [null]不是受支持的属性值

Yes, I can import as a node, but why doesn't it work to set a property on a relationship in this way. 是的,我可以导入为节点,但是为什么以这种方式在关系上设置属性却不起作用。

I changed the fourth column back to club/national, and also your query to get team name from the third column and didn't have any problems. 我将第四列改回了俱乐部/国家队,也将您的查询从第三列改回了球队名称,并且没有任何问题。

See Google Doc for a copy of your sheet updated, and my Cypher: 请参阅Google文档以获取更新的工作表副本以及我的Cypher:

LOAD CSV FROM "file:filepath/Soccerplayers.csv" AS line
MERGE (p:Player {name: line[0]})
MERGE (t:Team {name: line[2]})
CREATE (p)-[:PLAYS_FOR {type: line[3]}]->(t)

neo4j-sh (?)$ match n-[r:PLAYS_FOR]->m return n.name,r.type,m.name limit 5;
+------------------------------------------------------------+
| n.name            | r.type     | m.name                    |
+------------------------------------------------------------+
| "Sergio Romero"   | "club"     | "Monaco"                  |
| "Sergio Romero"   | "national" | "Argentina National Team" |
| "Mariano Andœjar" | "club"     | "Catania"                 |
| "Mariano Andœjar" | "national" | "Argentina National Team" |
| "Agust’n Ori—n"   | "club"     | "Boca Juniors"            |
+------------------------------------------------------------+

I had the same problem. 我有同样的问题。 If the CSV file has 4 columns and you are pulling data from all the 4 its gives the null property error. 如果CSV文件有4列,而您要从所有4列中提取数据,则将给出null属性错误。 Hence the easy solution for me was to add a dummy 5th column in the end and load. 因此,对我来说,简单的解决方案是在末尾添加一个虚拟的第五列并加载。

Maybe the importer is looking for some EOL character or something. 也许进口商正在寻找某些EOL字符或其他内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM