I have a relation like this:
context-[EXPRESSED_AS]->root
Assume that I have two contexts. The first has roots with base_forms of "temperature", "cool" and "hot". The second has roots with base_forms of "cool" and "hot". I want to find all contexts, sorted by the number of matches for the set ["cool", "temperature"].
I attempted it using this Cypher query, which doesn't work since the IN operator returns true or false instead of the matches:
"MATCH (w:`context`), s-[EXPRESSED_AS]->n1 WHERE n1.base_form in ["cool", "temperature"] WITH s, COUNT(n1.base_form in ["cool", "temperature"]) AS rootCount RETURN s.name, rootCount ORDER BY rootCount
Any help is appreciated!
I'm basically looking for the closest matches with their counts, based on the number of 'hits' from roots in the set.
(I've moved the question to http://stackoverflow.com/questions/27691969/neo4j-query-on-number-of-matches-in-a-set)