如何修复这个从CSV文件创建节点的Neo4j APOC查询? [英] How do I fix this Neo4j APOC query that creates nodes froma CSV file?
本文介绍了如何修复这个从CSV文件创建节点的Neo4j APOC查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望查询读取CSV文件并为文件中的每一行创建一个节点.
I want the query to read the CSV file and create a node for each row in the file.
以下是查询:
CALL apoc.load.csv('FILE:///C:/Temp/Test/Test/Neo4jTest/import/Neo4j_AttributeProvenance.csv',{sep:","}) YIELD map
CALL apoc.create.node(map.NodeType, {key:map.NodeID}) yield node return count(*)
这是错误:
Can't coerce `RootNode` to List<String>
这是数据文件:
NodeType,NodeID,SchemaName,TableName,AttributeName,DataType,PreviousNodeID
RootNode,queryprocessingtest.q01.testfieldatablec ,queryprocessingtest,q01,testfieldatablec ,varchar,
Node,queryprocessingtest.qc.testfieldatablec ,queryprocessingtest,qc,testfieldatablec ,varchar,queryprocessingtest.q01.testfieldatablec
Node,queryprocessingtest.ttablec.testfieldatablec ,queryprocessingtest,ttablec,testfieldatablec ,varchar,queryprocessingtest.q01.testfieldatablec
推荐答案
The first argument of the apoc.create.node
procedure must be an array.
因此您需要将map.NodeType
的值转换为数组:
So you need to convert the value of map.NodeType
into an array:
CALL apoc.load.csv('FILE:///C:/Temp/Test/Test/Neo4jTest/import/Neo4j_AttributeProvenance.csv',{sep:","}) YIELD map
CALL apoc.create.node([map.NodeType], {key:map.NodeID}) yield node return count(*)
这篇关于如何修复这个从CSV文件创建节点的Neo4j APOC查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文