How to retrieve only the nodes from the path in Neo4J Cypher query? -
i have query of following kind:
match (u1:user{name:"user_name"}), (s1:statement), s1-[:by]->u1 distinct s1,u1 match (s2:statement), s2-[:by]->u1, p=s1<-[:of]-c-[:of]->s2 s1 <> s2 collect(p) coll, count(p) paths, s1, s2 return s1,s2,paths,coll order paths desc limit 2;
right returns list of paths p in coll
variable. want list nodes c
. how make possible?
maybe query not right, in case, i'm trying to
1) find statements made user;
2) find nodes connect 2 statements;
3) return statements, have nodes connecting them, order desc, including names of actual nodes connect them.
thank you!
i can't test @ moment, try
match (u:user {name:"user_name"})<-[:by]-(s1)<-[:of]-(c)-[:of]->(s2)-[:by]->(u) return s1, s2, collect(c) connections order length(connections) desc limit 2
Comments
Post a Comment