简体   繁体   中英

Neo4j/Cypher display labels (match path)

one of my questions was already answered:

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

The final query was :

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")

I need to be able to RETURN a label for each ps.p and ps.c in the same query. I've tried few things withot success. Please advise.

Thanks.

Peter

您是否尝试过在末尾(又称为RETURN )修改, labels(ps.p), labels(ps.c) )?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM