1

我是 Neo4j 的新手,我将不胜感激......
我有以下简单的图表http://console.neo4j.org/?id=colc1f

基本上我想检索特定节点的关系,例如节点 ID: 1
想象一下,除了 FOLLOW,FRIEND 之外,还有更多的关系类型,但唯一的例外是 FRIEND 关系,因为我只关心传入的 FRIEND 关系上下文节点 (1),我想在一个查询中检索所有关系。

所以基本的密码查询是:

start profile=node(1) 
match profile-[r:FRIEND|FOLLOW|..]-other 
return type(r),other

但是如何过滤从同一查询中的上下文配置文件传出的 FRIEND 关系?

谢谢。

4

1 回答 1

3

您可以将额外的验证放入 where,并执行以下操作:

 start profile=node(1) 
 match profile-[r:FRIEND|FOLLOW]-other 
 where profile-[:FRIEND]->other 
    or type(r) <> "FRIEND" 
return type(r),other

http://console.neo4j.org/r/dgas8o

于 2012-10-10T08:34:47.580 回答