Question

I'm in the process of trying to learn Cypher for use with graph databases.

Using Neo4j's test database (http://www.neo4j.org/console?id=shakespeare) , how can I find all the performances of a particular play? I'm trying to establish how many times Julius Caesar was performed.

I have tried to use:

MATCH (title)<-[:PERFORMED]-(performance) 
WHERE (title: "Julias Caesar") 
RETURN title AS Productions;

I'm aware it's quite easy to recognise manually, but on a larger scale it wouldn't be possible.

Thank you

Était-ce utile?

La solution

You would have to count the number of performance nodes . You can use count to get the number of nodes.

MATCH (t)<-[:PERFORMED]-(performance) 
WHERE t.title = "Julias Caesar" 
RETURN DISTINCT t AS Productions,count(performance) AS count_of_performance
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top