我尝试使用导入工具2.2.0从CSV导入数据。 我一直在来自messages.log文件:
2015-02-10 16:14:44.792+0000 INFO [org.neo4j]: Import starting
2015-02-10 16:14:45.032+0000 INFO [org.neo4j]: Creating new db @ C:\path\to\file\Neo4j\test.graphdb\neostore
2015-02-10 16:14:47.727+0000 ERROR [org.neo4j]: Error during import Missing header of type START_ID
java.lang.RuntimeException: Missing header of type START_ID
at org.neo4j.unsafe.impl.batchimport.staging.StageExecution.stillExecuting(StageExecution.java:61)
at org.neo4j.unsafe.impl.batchimport.staging.ExecutionSupervisor.anyStillExecuting(ExecutionSupervisor.java:70)
at org.neo4j.unsafe.impl.batchimport.staging.ExecutionSupervisor.finishAwareSleep(ExecutionSupervisor.java:93)
at org.neo4j.unsafe.impl.batchimport.staging.ExecutionSupervisor.supervise(ExecutionSupervisor.java:55)
at org.neo4j.unsafe.impl.batchimport.ParallelBatchImporter.executeStages(ParallelBatchImporter.java:263)
at org.neo4j.unsafe.impl.batchimport.ParallelBatchImporter.doImport(ParallelBatchImporter.java:153)
at org.neo4j.tooling.ImportTool.main(ImportTool.java:213)
Caused by: org.neo4j.unsafe.impl.batchimport.input.MissingHeaderException: Missing header of type START_ID
at org.neo4j.unsafe.impl.batchimport.input.csv.DataFactories$AbstractDefaultFileHeaderParser.validateHeader(DataFactories.java:366)
at org.neo4j.unsafe.impl.batchimport.input.csv.DataFactories$AbstractDefaultFileHeaderParser.create(DataFactories.java:315)
at org.neo4j.unsafe.impl.batchimport.input.csv.InputGroupsDeserializer.createNestedIterator(InputGroupsDeserializer.java:65)
at org.neo4j.unsafe.impl.batchimport.input.csv.InputGroupsDeserializer.createNestedIterator(InputGroupsDeserializer.java:35)
at org.neo4j.helpers.collection.NestingIterator.fetchNextOrNull(NestingIterator.java:67)
at org.neo4j.helpers.collection.PrefetchingIterator.peek(PrefetchingIterator.java:60)
at org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:46)
at org.neo4j.unsafe.impl.batchimport.staging.IteratorBatcherStep.nextOrNull(IteratorBatcherStep.java:41)
at org.neo4j.unsafe.impl.batchimport.staging.ProducerStep.process(ProducerStep.java:72)
at org.neo4j.unsafe.impl.batchimport.staging.ProducerStep$1.run(ProducerStep.java:54)
我尝试导入的三个文件的前五行如下所示: loctest.csv
LOCATION:ID;LOC_TYPE:int;NUM_MILE:int;STREET_PRE;STREETNAME;STREETTYPE;STREETSUF;APT_NO;X_STREET;:LABEL
895WTWELFTHST;1;895;W;TWELFTH;ST;;107;;LOCATION
145SFRANKLINST;1;145;S;FRANKLIN;ST;;;;LOCATION
11735GLACIERHWY;1;11735;;GLACIER;HWY;;;;LOCATION
MENDENHALL LOOPUNIVERSITY DRRDUNIVERSITY DR;2;;;MENDENHALL LOOPUNIVERSITY DR;RD;;;UNIVERSITY DR;LOCATION
zip5.csv
ZIP5:ID;ZIP4;:LABEL
99801;;ZIP5
99824;;ZIP5
99821;;ZIP5
99803;;ZIP5
locziptest.csv
:START_ID;CITY;:END_ID;:TYPE
895WTWELFTHST;JUNEAU;99801;CITY
145SFRANKLINST;JUNEAU;99801;CITY
11735GLACIERHWY;JUNEAU;99801;CITY
MENDENHALL LOOPUNIVERSITY DRRDUNIVERSITY DR;JUNEAU;99801;CITY
违规文件似乎是关系文件(locziptest.csv),但标题看起来是正确配置的。是ID字段中的查找字符串的问题?它需要完全是数字吗?
答案 0 :(得分:3)
我尝试了一下,并使用参数
导入了您的示例数据
--into graph.db
--nodes loctest.csv
--nodes zip5.csv
--relationships locziptest.csv
--delimiter ;
--array-delimiter "|"
请不要引用CSV文件中的分号。我认为讨论是在命令提示符中引用分号,不需要引用
答案 1 :(得分:1)
您的csv使用分号作为字段分隔符。 neo4j-import
默认为逗号,因此请修改为neo4j-import
来电:
--delimiter ";" --array-delimiter ","
数组分隔符设置是必要的,因为这个默认为分号,两者都不能相同。