Neo4j 导入工具出错

Error with Neo4j Import Tool

我正在尝试使用 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.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),但 header 看起来配置正确。 ID 字段中的查找字符串有问题吗?是否需要完全是数字?

您的 csv 使用分号作为字段分隔符。 neo4j-import 默认为逗号,因此请修改您的 neo4j-import 调用:

--delimiter ";" --array-delimiter ","

array-delimiter设置是必要的,因为这个默认为分号,两者不能相同。

我试了一下,并使用以下参数导入了您的示例数据:

--into graph.db --nodes loctest.csv --nodes zip5.csv --relationships locziptest.csv --delimiter ; --array-delimiter "|"

请不要在 CSV 文件中引用分号。我认为讨论是围绕命令提示符中分号的引号展开的,也不需要引号