【问题标题】:neo4j cypher query filter specific relationneo4j 密码查询过滤器特定关系
【发布时间】:2012-09-30 14:40:02
【问题描述】:

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

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

所以基本的 cypher 查询是:

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

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

谢谢。

【问题讨论】:

    标签: neo4j cypher


    【解决方案1】:

    您可以将额外的验证放入 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 2014-03-15
      • 1970-01-01
      • 1970-01-01
      • 2018-08-25
      相关资源
      最近更新 更多