APOC 节点一对多关系的创建
batch 格式: [{from: yourIDInNeo4j, to: [yourIDInNeo4j-1,yourIDInNeo4j-2], properties: {key:vaule}, type: relName}] from和to的值是你在Neo4j能够唯一标识该节点的属性值,properties中以json格式存放想要增添到关系relName中的属性信息 我是在Neo4j Brower中利用apoc进行的多节点关系创建,我是参考了官网的APOC:
语句为UNWIND {batch} as row MATCH (from:Company) WHERE from.uuid = row.from MATCH (to:Company) where to.uuid in row.to CALL apoc.create.relationship(from,row.type,row.properties,to) yield rel RETURN count(*) *这里对于键值key(from,to…)不要加单引号或双引号,否则会报错,运行结果如下: 运行前 运行后