【问题标题】:Error when importing csv using import tool使用导入工具导入 csv 时出错
【发布时间】:2019-07-21 05:37:08
【问题描述】:

我正在尝试加载包含两个节点(Autor、Paper)和与导入工具的关系的图表,现在我有这两个文件,据我了解,它们必须是:

作者.csv: :Author(Autor) :Adscription(Autor) :PMID(Paper) 作者 1 血液科。 31207293

论文.csv :PMID(论文) :PaperName(论文) :AuthorList(Autor)
31207293 巨大的论文名 Author1,Author2,

这些文件存储在 /var/lib/neo4j/import 中

考虑到这一点,我运行以下代码

sudo neo4j-admin import --database=graph.db --id-type=STRING --mode=csv --delimiter="  " --nodes :Autor:Paper="authors.csv,Papers.csv"

但我得到了

WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Expected '--nodes' to have at least 1 valid item, but had 0 []
usage: neo4j-admin import [--mode=csv] [--database=<name>]
                      [--additional-config=<config-file-path>]
                      [--report-file=<filename>]
                      [--nodes[:Label1:Label2]=<"file1,file2,...">]
                      [--relationships[:RELATIONSHIP_TYPE]=<"file1,file2,...">]

现在,我只是尝试加载节点 Paper 和 Author,我可以通过以下方式在浏览器中执行此操作

USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM   "file:///authors.csv" AS row
MERGE ( c:Autor{ Name:row.Autor  , Adscription: row.Adscription, PMID=row.PMID } )

但是这样做所花费的时间很长。

【问题讨论】:

    标签: neo4j load-csv


    【解决方案1】:

    此警告可能不会影响您,但请参阅here 了解更多信息。

    如果您要导入大量数据,那么您的 Cypher 需要这么长时间的原因是 MERGE。如果您知道authors.csv 包含每个作者的唯一条目,那么您不需要执行MERGE,因为它永远不会匹配现有节点。

    尝试将MERGE 切换为CREATE。它应该更快。

    【讨论】:

      猜你喜欢
      • 2015-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-03
      • 2010-10-12
      • 2015-11-21
      • 2011-01-16
      • 1970-01-01
      相关资源
      最近更新 更多