【发布时间】:2021-08-23 20:00:14
【问题描述】:
我的图表上有一个节点 N1。该节点具有多个属性。我对属性 P1 和 P2 感兴趣。对于每个属性 P1,P2 可以有多个“行”。我想为节点 N1 中的每个 P1 提取前 10 个 P2。 我尝试了以下方法:
match (m:N1)
where m.P1 is not null
with m
match(n:N1{P1:m.P1})
where n.P2 is not null
return
m.P1 as P1_test, n.P2 as P2_test, count(*) as testCount
order by testCount desc
limit 10
以上没有给我正确的价值观。 我还尝试了以下方法:
match (n:N1) where n.P1 is not null
with n.P1 as P1_test
match (m:N1{P1:P1_test})
where m.P2 is not null
return
m.P1,
collect (m.P2) as P2_test
这不起作用,我无法在此处添加计数以限制查询的前 10 个结果。 我不确定我是否在这里遗漏了一些基本的东西。非常感谢您在正确方向上的任何帮助。
【问题讨论】: