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!
Does this query fits your needs ?
Result :