';匹配';on OrientDB返回的路径不为';不存在

';匹配';on OrientDB返回的路径不为';不存在,orientdb,Orientdb,我使用OrientDB“match”根据条件获取路径(在图上),但得到的结果路径不存在 我有一个“Person”顶点,它有一个到另一个“Person”顶点的“PhoneCall”边-只有一个路径应该是匹配的! 所以我想得到一个结果:vertex1-edgeX-vertex2 例如,“jonn Smith--phoneCallX--dan Smith” 我实际得到的是两条路径: vertex1-edgeX-vertex2(jonn Smith--phoneCallX--dan Smith),但也:

我使用OrientDB“match”根据条件获取路径(在图上),但得到的结果路径不存在

我有一个“Person”顶点,它有一个到另一个“Person”顶点的“PhoneCall”边-只有一个路径应该是匹配的! 所以我想得到一个结果:vertex1-edgeX-vertex2 例如,“jonn Smith--phoneCallX--dan Smith”

我实际得到的是两条路径:

  • vertex1-edgeX-vertex2(jonn Smith--phoneCallX--dan Smith),但也:
  • vertex1 edgeX vertex1-这不是真的,因为它是与第一个结果相同的边-@rid,而且它不是自边:jonn Smith--phoneCallX--jonn Smith
  • 查询:

    MATCH {class:person, as:E1, where:( (   firstName IN ['John']   ) )}.bothE(){class:phoneCall, as:R0}.bothV(){class:person, as:E0, where:( (   lastName IN ['Smith']   ) )} RETURN $paths
    
    我认为这是因为“both()”方法具有第一个顶点应用于两个过滤器的事实:

  • 名字在['John']
  • ['Smith']中的列表项lastName
  • 但是,我仍然想找到“John phoneCall Smith”的所有路径,我在这个John和他自己之间获得了一个优势(这是不存在的),仅仅因为他的名字是Smith(这应该是这个关系的另一个实体的条件))


    请帮助我-我做错了什么?

    您可以明确指定两个顶点必须不同。 在E2的WHERE条件下,语法为,
    $matched.E1$currentMatch

    MATCH 
       {class:person, as:E1, where:( (   firstName IN ['John']   ) )}
          .bothE(){class:phoneCall, as:R0}
          .bothV(){class:person, as:E0, where:(lastName IN ['Smith'] AND $matched.E1 <> $currentMatch)} 
    RETURN $paths
    
    匹配
    {class:person,as:E1,其中:((约翰的名字)}
    .bothE(){class:phoneCall,as:R0}
    .bothV(){class:person,as:E0,其中:(lastName IN['Smith']和$matched.E1$currentMatch)}
    返回$path
    
    谢谢!真的很有帮助。(但我也支持自边,因此只有在不属于自边的情况下,我才需要使用您的解决方案条件。)无论如何,是否有诸如“$matched”和“$currentMatch”之类的“系统变量”的名称/标题?我想查看整个列表当然,这里有一个列表(实际上很短)