[英]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.