I have this query in Neo4j:
MATCH (sentence:Sentence)-[r*]->(n:Word )
WITH n, COUNT(r) AS c
RETURN n, c
My graph is a linguistic database containing words and dependency relations between them. This query should return depth of nodes, however the COUNT(r) always returns 1. When I ommit the COUNT function and write just
WITH n, r AS c
instead (trying in web browser neo4j interface), neo4j returns multiple relations for each word node "n" as expected. Can you please help me what am I doing wrong, how to count the length of path between sentence node and word node? thanks.