Neo4j重复输入id异常

时间:2017-06-06 02:43:30

标签: neo4j

我是neo4j的新手,我正在尝试使用它构建比特币交易图。我正在关注此链接behas/bitcoingraph这样做,我遇到了neo4j import命令来创建数据库

$NEO4J_HOME/bin/neo4j-import --into $NEO4J_HOME/data/graph.db \ 
  --nodes:Block blocks_header.csv,blocks.csv \ 
  --nodes:Transaction transactions_header.csv,transactions.csv \
  --nodes:Output outputs_header.csv,outputs.csv \  .......

执行上述命令后,我遇到了错误

Exception in thread "Thread-1" org.neo4j.unsafe.impl.batchimport.cache.idmapping.string.DuplicateInputIdException: Id '00000000f079868ed92cd4e7b7f50a5f8a2bb459ab957dd5402af7be7bd8ea6b' is defined more than once in Block, at least at /home/nikhil/Desktop/Thesis/bitcoingraph/blocks_0_1000/blocks.csv:409 and /home/nikhil/Desktop/Thesis/bitcoingraph/blocks_0_1000/blocks.csv:1410

这是block_header。 csv

hash:ID(Block),height:int,timestamp:int

有谁知道如何修复它?我读过id-spaces中有一个解决方案,但我不确定如何使用它。在此先感谢您的任何帮助

1 个答案:

答案 0 :(得分:3)

--skip-duplicate-nodes标志将跳过导入具有相同ID的节点,而不是中止导入。

例如:

$NEO4J_HOME/bin/neo4j-import --into $NEO4J_HOME/data/graph.db \ 
  --nodes:Block blocks_header.csv,blocks.csv --skip-duplicate-nodes \ 
  --nodes:Transaction transactions_header.csv,transactions.csv \
  --nodes:Output outputs_header.csv,outputs.csv \  .......