Match查询路径的问题

  • nebula 版本:2.6.1

  • 部署方式:单机

  • 安装方式:源码编译

  • 是否上生产环境:N

  • 问题的具体描述:我是用nebula官方文档上的例子,创建一个简单的图连接三个player和两条follow边
    连接情况是这样的:

+--------------------------------------------------------------------------------------------------------------------+
| p                                                                                                                  |
+--------------------------------------------------------------------------------------------------------------------+
| <(3 :player{age: 32})-[:follow@0 {degree: 9}]->(2 :player{age: 14})-[:follow@0 {degree: 1}]->(1 :player{age: 23})> |
+--------------------------------------------------------------------------------------------------------------------+

现在想使用以下语句对路径进行筛选,但是却返回空!

MATCH p=(v:player)-[e*1..3]->(v2) where id(v2)==1 and e.degree < 15 return e;
+---+
| e |
+---+
+---+

想知道是哪里出了问题,谢谢:pray:

上述的 where 中 e 是个 list,不是指定的某一条边,原因是 path pattern 中的 e 是个变长边,所以 where 中的过滤恒 false。正确的写法:

MATCH p=(v:player)-[e*1..3]->(v2) where id(v2)==1 and all(i in e where i.degree < 15) return e;

另外已经不推荐使用 v2.6.1 版本了,建议使用最新的3.x 版本,如果想在单机上体验 nebula,可以通过 docker compose 的方式,见:GitHub - vesoft-inc/nebula-docker-compose: Docker compose for Nebula Graph

1 个赞

谢谢,我明白了!

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。