Neo4j / Cypher显示标签(匹配路径)

时间:2015-07-29 09:38:07

标签: neo4j cypher graph-databases

我的一个问题已经回答:

Neo4j: Display all connected nodes and their parent in tree-like graph

最终查询是:

query = CypherQuery(graph, "MATCH path=(n {name:{node}})<-[:DEPENDS_ON*]-() WITH NODES(path) AS np WITH REDUCE(s=[], i IN RANGE(0, LENGTH(np)-2, 1) | s + {p:np[i], c:np[i+1]}) AS cpairs UNWIND cpairs AS pairs WITH DISTINCT pairs AS ps RETURN ps.p, ps.c")

我需要能够在同一个查询中为每个ps.p和ps.c RETURN添加标签。我已经尝试了一些没有成功的事情。请指教。

感谢。

彼得

1 个答案:

答案 0 :(得分:1)

您是否曾尝试在最后修改, labels(ps.p), labels(ps.c)(又名RETURN)?