i trying come query following data model in neo4j.
readable-[:readby]-student | [:owns] | readable-[:readby]-student | [:owns] ----------------------------------------- | | readable-[:readby]-student readable-[:readby]-student | [:owns] | readable-[:readby]-student
the query:
return students distance first readable
in map.
match (:readable{name:'book'})-[:owns*0..3]-(r:readable) match (r)-[:readby]-(s:student) return s
that query seems correctly traverse tree , find each student @ each distance, can't seem record distance each student return @ end.
i think you're looking length
function.
match p = (:readable{name:'book'})-[:owns*0..3]-(:readable)-[:readby]-(s:student) return s.name, length(p);
edit: map length (key) , collection of students (value):
match p = (:readable{name:'book'})-[:owns*0..3]-(:readable)-[:readby]-(s:student) length(p) len, collect(s) students return {length: len, students: students};
Comments
Post a Comment