Neo4j导入csv数据错误for header: [classId:ID, name:string, :LABEL]

网友投稿 458 2022-11-06


Neo4j导入csv数据错误for header: [classId:ID, name:string, :LABEL]

今天在用Neo4j的时候出现了下面的错误:

➜ installation-3.5.6 ./bin/neo4j-admin import --mode=csv --database=graph.db --nodes /Users/admin/Documents/data/knowledgeGraph/students.csv,/Users/admin/Documents/data/knowledgeGraph/classes.csv --relationships /Users/admin/Documents/data/knowledgeGraph/relations.csvNeo4j version: 3.5.6Importing the contents of these files into /Users/admin/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-42c2a528-01e9-4145-99ad-da0123d20d59/installation-3.5.6/data/databases/graph.db:Nodes: /Users/admin/Documents/data/knowledgeGraph/students.csv /Users/admin/Documents/data/knowledgeGraph/classes.csvRelationships: /Users/admin/Documents/data/knowledgeGraph/relations.csvAvailable resources: Total machine memory: 16.00 GB Free machine memory: 194.43 MB Max heap memory : 910.50 MB Processors: 8 Configured max memory: 13.60 GB High-IO: trueWARNING: 122.18 MB memory may not be sufficient to complete this import. Suggested memory distribution is:heap size: 1.00 GBminimum free and available memory excluding heap size: 1020.01 MBImport starting 2019-07-30 19:15:47.680+0800 Estimated number of nodes: 11.00 Estimated number of node properties: 22.00 Estimated number of relationships: 6.00 Estimated number of relationship properties: 0.00 Estimated disk space usage: 831.00 B Estimated required memory usage: 1020.01 MBInteractiveReporterInteractions command list (end with ENTER): c: Print more detailed information about current stage i: Print more detailed information(1/4) Node import 2019-07-30 19:15:47.715+0800 Estimated number of nodes: 11.00 Estimated disk space usage: 627.00 B Estimated required memory usage: 1020.01 MB.......... .......... .......... .......... .......... 5% ∆61ms.......... .......... .......... .......... .......... 10% ∆2ms.......... .......... .......... .......... .......... 15% ∆0ms.......... .......... .......... .......... .......... 20% ∆1ms.......... .......... .......... .......... .......... 25% ∆0ms.......... .......... .......... .......... .......... 30% ∆1ms.......... .......... .......... .......... .......... 35% ∆0ms.......... .......... .......... .......... .......... 40% ∆1ms.......... .......... .......... .......... .......... 45% ∆0ms.......... .......... .......... .......... .......... 50% ∆1ms.......... .......... .......... .......... .......... 55% ∆1ms.......... .......... .......... .......... .......... 60% ∆0ms.......... .......... .......... .......... .......... 65% ∆1ms.......... .......... .......... .......... .......... 70% ∆1ms.......... .......... .......... .......... .......... 75% ∆0ms.......... .......... .......... .......... .......... 80% ∆1ms.......... .......... .......... .......... .......... 85% ∆0ms.......... .......... .......... .......... .......... 90% ∆1ms.......... .......... .......... .......... .......... 95% ∆0ms.......... .......... .......... .......... .......... 100% ∆0msIMPORT FAILED in 262ms. Data statistics is not available.Peak memory usage: 0.00 BError in input dataCaused by:ERROR in input data source: BufferedCharSeeker[source:/Users/admin/Documents/data/knowledgeGraph/classes.csv, position:34, line:1] in field: :LABEL:4 for header: [classId:ID, name:string, :LABEL] raw field value: :LABEL original error: Extra column not present in header on line 1 in /Users/admin/Documents/data/knowledgeGraph/classes.csv with value :LABELWARNING Import failed. The store files in /Users/admin/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-42c2a528-01e9-4145-99ad-da0123d20d59/installation-3.5.6/data/databases/graph.db are left as they are, although they are likely in an unusable state. Starting a database on these store files will likely fail or observe inconsistent records so start at your own risk or delete the store manuallyunexpected error: ERROR in input data source: BufferedCharSeeker[source:/Users/admin/Documents/data/knowledgeGraph/classes.csv, position:34, line:1] in field: :LABEL:4 for header: [classId:ID, name:string, :LABEL] raw field value: :LABEL original error: Extra column not present in header on line 1 in /Users/admin/Documents/data/knowledgeGraph/classes.csv with value :LABEL

我的文件为class.csv:

studentId:ID,name,age:int,:LABELs1,"JM68",27,Students2,"JM6",22,Students3,"JM8",18,Students4,"JM",2,Student

students.csv:

classId:ID,name,:LABELc1,"MHT班",Classc2,"MY班",Classc3,"LYH班",Classc4,"RZF班",Class

relations.csv:

:START_ID,:END_ID,:TYPEs1,c4,FROMs2,c2,FROMs3,c3,FROMs4,c1,FROM

然后我运行的命令为:

./bin/neo4j-admin import --mode=csv --database=graph.db --nodes /Users/admin/Documents/data/knowledgeGraph/students.csv,/Users/admin/Documents/data/knowledgeGraph/classes.csv --relationships /Users/admin/Documents/data/knowledgeGraph/relations.csv

解决方法

./bin/neo4j-admin import --mode=csv --database=graph.db --nodes /Users/admin/Documents/data/knowledgeGraph/students.csv --nodes /Users/admin/Documents/data/knowledgeGraph/classes.csv --relationships /Users/admin/Documents/data/knowledgeGraph/relations.csv

原因是我只写了一个 nodes参数,然后读取了两个文件,neo4j以为格式都是一样的。最后分开读nodes文件就行了。

参考文献

[1]. 使用 官方 etl neo4j-import 导入 数据. ​​http://weikeqin.com/2017/04/11/neo4j-import/​​

[2]. Neo4j--数据导入. ​​https://jianshu.com/p/e968c5ccf34c​​


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:[leetcode] 324. Wiggle Sort II
下一篇:简单介绍java中equals以及==的用法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~