MATCH 深度查询

neo4j语句
MATCH p=(n:man)-[r:love]->(m:woman) where 1==1 and r.relation==“情侣” return p
neo4j深度查询
MATCH p=(n:man)-[r:love*1]->(m:woman) where 1==1 and r.relation==“情侣” return p

用nebula 第一条有数据,第二条虽然能执行但是没有数据。nebula的深度查询正确形式是什么呢?

发现了,好像这样做可以查询
MATCH p=(n:man)-[r:love*1{relation:“情侣”}]->(m:woman) return p

2 个赞

这实际上是一个容易犯的错误,因为 *1 的时候 r 不再是一个边,而是一串边

比如错误:

match path=(n:player{name: "Tim Duncan"})-[e:follow*1..2]-(m) \
    where e_.degree > 0 \
    return path

正确:

match path=(n:player{name: "Tim Duncan"})-[e:follow*1..2]-(m) \
    where ALL(e_ in e WHERE e_.degree > 0) \
    return path
1 个赞

比如深度为3,然后以其中第一条边的属性作为条件,查询点边关系,又应该怎么查呢?

match path=(n:player{name: "Tim Duncan"})-[e:follow*1..2]-(m)  \
where e[0].degree > 98 return path

OK

感谢你的提问,再次提醒我要在文档里强调这个情况。

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