我是Cypher的新手,我正试图弄清楚如何在某些情况下从查询中排除节点.
该图由朋友(我 - [朋友] - 人)和朋友关系(我 - [fof] -person)组成
我需要找到所有朋友关系的朋友(很容易),但排除那些也是"朋友"的朋友的朋友
我以为我能做到:
START me=node(0)
MATCH me-[r:fof]->fof, me-[f?:friend]->fof
WHERE f is null and NOT(r is null)
and ... [other filters]
Run Code Online (Sandbox Code Playgroud)
但这似乎是错误的方式来获得不是朋友的朋友之友.
建议?
您可以根据WHERE子句中的现有关系进行过滤,当然您可以NOT用来否定任何条件:
START me=node(0)
MATCH me-[r:fof]->fof
WHERE NOT(me-[:friend]->fof)
and ... [other filters]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3719 次 |
| 最近记录: |