简体   繁体   English

如何使用节点 ID 在两个现有节点之间创建关系?

[英]How to create relationship between two existing nodes by using node id?

I am trying to create a relationship between two existing nodes.我正在尝试在两个现有节点之间创建关系。 I am reading the node ID's from a CSV and creating the relationship with the following query:我正在从 CSV 读取节点 ID,并使用以下查询创建关系:

LOAD CSV WITH HEADERS FROM "file:///8245.csv" AS f
MATCH (Ev:Event) where id(Ev) =f.first 
MATCH (Ev_sec:Event) where id(Ev_sec) = f.second
WITH Ev, Ev_sec
MERGE  (Ev) - [:DF_mat] - > (Ev_sec)

However, it is not changing anything the database.但是,它不会更改数据库的任何内容。 How can I solve this problem?我怎么解决这个问题?

Thanks!谢谢!

I solved the problem.我解决了这个问题。 So, I again queried for the ID(node) and this time I exported them as a string (by using toString(ID(node)) ).因此,我再次查询了 ID(node),这次我将它们导出为字符串(通过使用 toString(ID(node)) )。 Then while loading to the database, I converted them to Integer.然后在加载到数据库时,我将它们转换为 Integer。 The query is as follows:查询如下:

LOAD CSV WITH HEADERS FROM "file:///8245_new.csv" AS csvLine
match (ev:Event) where id(ev)=toInteger(csvLine.first)
match (ev_sec:Event) where id(ev_sec)=toInteger(csvLine.second)
merge (ev)-[:DF_mat]-> (ev_sec)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在STRUCTR.org中创建两个现有节点之间的关系 - Create relationship between two existing nodes in STRUCTR.org 如何基于父节点在两个随机节点之间创建关系? - How can I create a relationship between two random nodes based on parent node? 更快的方式来创建现有节点之间的关系? - faster way to create relationship between existing nodes? 在(尚未)现有节点之间创建关系 - Create Relationship between (not yet) existing nodes 我如何保证在事务中的两个现有节点之间只创建一个新的唯一节点 - How I guarantee I create only one new unique node between two existing nodes in a transaction 如何在具有共同属性的两个节点之间创建关系? - How to create a relationship between two nodes with common properties? 如何在图数据库中的节点之间创建两个关系 - How to create two relationship between nodes in graph DB 如何使用C#Neo4jClient在两个节点之间创建关系? - How do I create a relationship between two nodes using C# Neo4jClient? 我想在 Neo4j 中的两个已经存在的节点之间添加一个关系——如何使用 Spring Data Neo4jRepository 来做到这一点? - I want to add a Relationship between two already existing nodes in Neo4j - how to do that using Spring Data Neo4jRepository? 检查Neo4J中2个节点之间是否存在关系,如果没有,则创建具有随机ID的节点 - Check if relationship exits between 2 nodes in Neo4J and if not create node with random id
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM