[英]Neo4j Rounding Relationship
everybody 大家
I have two nodes (S1,S2). 我有两个节点(S1,S2)。
S1 is S1是
USING PERIODIC COMMIT
LOAD CSV with HEADERS FROM "file:/S1.csv" AS line
CREATE (a:S1 {ID: TOINT (line.ID)})
set a.Depth_m =TOINT (line.depth );
The S1 node property vlaues are : S1节点属性vlaues是:
ID Depth_m
1 100.06
2 100.20
3 100.37
4 101.29
5 101.50
6 101.88
7 102.42
8 102.70
9 102.92
S2 is S2是
USING PERIODIC COMMIT
LOAD CSV with HEADERS FROM "file:/S2.csv" AS line
CREATE (b:S2 {ID: TOINT (line.ID)})
set b.Depth_m =TOINT (line.depth );
The S2 node property values are: S2节点属性值为:
ID Depth_m
1 100.25
2 101.55
3 102.75
So, I want to establish a relationship between the values of the two nodes, provided in which values (Depth_m) of S1 and S2 are approximately same (with a small difference ~ 0.5). 因此,我想在两个节点的值之间建立一种关系,条件是S1和S2的值(Depth_m)大致相同(相差约0.5)。
Eg, result should be: 例如,结果应为:
S1 S2
ID Depth_m ID Depth_m
1 100.20 =======>> 1 100.25
2 101.50 =======>> 2 101.55
3 102.70 =======>> 3 102.75
Can ROUND solves this issue? ROUND可以解决这个问题吗? If it can do something, How I can use it? 如果它可以做些什么,我该如何使用它?
Thanks) 谢谢)
This query (for handling the S2.csv
file) should do what you want: 此查询(用于处理S2.csv
文件)应执行您想要的操作:
USING PERIODIC COMMIT
LOAD CSV with HEADERS FROM "file:/S2.csv" AS line
CREATE (b:S2 {ID: TOINT(line.ID), Depth: TOINT(line.depth)})
WITH b
MATCH (a:S1) WHERE ABS(a.Depth-b.Depth) <= 0.5
CREATE (a)-[:SIMILAR]->(b);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.