ONgDB批量导入CSV文件

 

Here’s the table of contents:

  1. 版本
  2. cypher-shell执行批量提交的脚本
  3. browser中执行批量提交的CYPHER

版本

ongdb-enterprise-3.5.22

cypher-shell执行批量提交的脚本

USING PERIODIC COMMIT 10000
LOAD CSV FROM 'file:/xbe' AS line
	WITH TOINT(line[1]) AS ybId,TOINT(line[2]) AS kwId,apoc.convert.toFloat(line[3]) AS weight
MATCH (yb:研报)-[r:包含]->(kw:关键词) WHERE ID(yb)=ybId AND ID(kw)=kwId AND NOT EXISTS(r.weight)
	WITH yb,kw
CREATE (yb)-[r:包含]->(kw) SET r.weight=weight;

browser中执行批量提交的CYPHER

// 增加了自动提交auto标记
:auto USING PERIODIC COMMIT 10000
LOAD CSV FROM 'file:/xbe' AS line
	WITH TOINT(line[1]) AS ybId,TOINT(line[2]) AS kwId,apoc.convert.toFloat(line[3]) AS weight
MATCH (yb:研报)-[r:包含]->(kw:关键词) WHERE ID(yb)=ybId AND ID(kw)=kwId AND NOT EXISTS(r.weight)
	WITH yb,kw
CREATE (yb)-[r:包含]->(kw) SET r.weight=weight;