+1 vote
in Databases by (56.5k points)
I want to check the number of a particular relationship for a given node in the Neo4J graph. What is the Cypher query for it?

1 Answer

+1 vote
by (348k points)
selected by
 
Best answer

Here is an example Cypher query based on the movie database of Neo4J. In this Cypher, I am trying to find the number "PRODUCED" relationship for the movie title "When Harry Met Sally".

MATCH (m:Movie)-[r:PRODUCED]-() WHERE m.title ='When Harry Met Sally' RETURN COUNT(r)

You can modify this query according to your database. 

MATCH (n:node_name)-[r:relationship_name]-() WHERE n.id = unique_value_for_the_node RETURN COUNT(r)


...