简体   繁体   English

在Cypher之间创建具有共享属性且值为1和1.0的节点之间的关系

[英]Creating Relationships in Cypher Between Nodes with Shared properties with values that are 1 and 1.0

I have properties on two different node types. 我有两种不同节点类型的属性。 The properties are 1 and 1.0. 属性为1和1.0。 I want to connect these nodes with a relationship based on this shared property. 我想用基于此共享属性的关系连接这些节点。 There are about 45 million nodes to connect to another 1.2 million nodes. 大约有4500万个节点连接到另外120万个节点。 I generated the following query to do this but it keeps returning (no changes, no records) . 我生成了以下查询来执行此操作,但它一直返回(no changes, no records) Does anyone know the best way to go about doing this? 有谁知道这样做的最佳方法? Query is below. 查询如下。

MATCH (p:Post),(t:Thread) WHERE EXISTS (p.post_reply_number) AND EXISTS (t.pos) AND p.post_reply_number=t.pos CREATE (p)-[r:FIRST_POST]->(t) MATCH(p:Post),(t:Thread)WHERE EXISTS(p.post_reply_number)AND EXISTS(t.pos)AND p.post_reply_number = t.pos CREATE(p) - [r:FIRST_POST] - >(t)

I guess the data types are not consistent. 我猜数据类型不一致。 One of the properties is string and the other one is double(float). 其中一个属性是字符串,另一个属性是double(float)。 You can use the function toFloat to convert string to float then your query will work. 您可以使用函数toFloat将字符串转换为float,然后您的查询将起作用。

MATCH (p:Post),(t:Thread) 
WHERE EXISTS (p.post_reply_number) 
 AND EXISTS (t.pos) 
 AND toFloat(p.post_reply_number)=t.pos 
CREATE (p)-[r:FIRST_POST]->(t)

I tried creating sample nodes/properties using the data types int(post_reply_number) and float (pos) and your query works. 我尝试使用数据类型int(post_reply_number)和float(pos)创建示例节点/属性,并且您的查询有效。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM