p已经声明错误

时间:2013-12-21 14:12:40

标签: neo4j cypher

我正在运行以下查询:

START root=node:people(id="$personOrFamilyId"), descendant=node:people(id="$descendant") 
MATCH p=shortestPath(root-[p:child|descendant*..25]->descendant) 
RETURN EXTRACT( n in nodes(p) : n.id ) as node_ids_on_path

并收到以下错误:

p already declared

它在1.9中工作,但在2.0中它失败了。我错过了什么?

1 个答案:

答案 0 :(得分:1)

您正在为来自shortestPath的路径以及模式内部的关系标识符重用标识符p

START root=node:people(id="$personOrFamilyId"), descendant=node:people(id="$descendant") 
MATCH p=shortestPath(root-[:child|descendant*..25]->descendant) 
RETURN EXTRACT( n in nodes(p) | n.id ) as node_ids_on_path