Neo4j: Expres path cypher query result in terms of nodes -
i have following node structure emp[e_id, e_name, e_bossid]
. more have recursive query exploit database in recursive traversal on self relation e_bossid-[reports_to]->e_id
match (e:employee) not (e)-[:reports_to]->() set e:root; match path = (b:root)<-[:reports_to*]-(e:employee) return path limit 1000;
however result path. have result in form of nodes not path. tried use nodes(path)
, gives me error:
org.codehaus.jackson.map.jsonmappingexception: reference node not available (through reference chain: java.util.arraylist[0]->java.util.hashmap["rel"]->java.util.hashmap["nodes(path)"]->java.util.arraylist[0]->org.neo4j.rest.graphdb.entity.restnode["restapi"]->org.neo4j.rest.graphdb.restapifacade["direct"]->org.neo4j.rest.graphdb.executingrestapi["referencenode"])
when query without nodes(path)
seems return paths.
how should done on ground of cypher query?
i'm not sure why want possible paths in organizational hierarchy. maybe want set of paths leaves of tree root of tree, , return each unique set row of nodes.
match (b:employee) not (b)-[:reports_to]->() match (l:employee) not (l)<-[:reports_to]-() match p = shortestpath((b)<-[:reports_to*]-(l)) return nodes(p) reports
as far error goes, looks bug, although don't know version of neo4j using. in likelihood, query won't complete because root
employees still member of employee
label. means pattern: match path = (b:root)<-[:reports_to*]-(e:employee)
matches root
employees on each side of variable length traversal.
give query try , let me know happens.
Comments
Post a Comment