1

查询中的关系模式正在发生变化,但缺少文档。编写此查询时,我收到“待折旧”消息:

match path = (p:Person)-[r:father|mother*0..5]->(a:Person) 
return path limit 25

我如何写这个来确认新的要求?

它需要是这样的,但父亲|母亲*0..5 的某些部分移入了关系(路径)

 match path = (p:Person)-[r:father|mother*0..5]->(a:Person) 
 with *, relationships(path) as r
 return path limit 25

该查询运行正常,但错误消息仍然存在。

什么是正确的新格式?

4

1 回答 1

2

I assume Neo4j is complaining about the r . Can you try this:

 match path = (p:Person)-[:father|mother*0..5]->(a:Person) 
 with *, relationships(path) as r
 return path limit 25

The more complex case i would suggest to split the match

   match path1= (p:Person{RN:5242})-[:father|mother*0..15]->(mrca:Person),
       path2= (mrca)<-[:father|mother*0..15]-(b:Person{RN:1}) return length(path1), length(path2)
于 2021-10-29T10:10:42.613 回答