This came about from looking at using Cypher as a recommender. If person 1 likes A; person 2 likes A and B; then you would recommend B to person 1. I can do the first part in Cypher to list top common shared likes items, but how do I use that resulting table to get a list of user names that I should recommend?
This cypher query returns the top shared likes products.
START food = node:node_auto_index(type = "food"), user = node:node_auto_index(type = "user")
MATCH food<-[:IS_A]-x<-[:LIKE]-person-[:IS_A]->user
WITH person, x
MATCH person-[:LIKE]->y-[:IS_A]->cc
WHERE NOT x = y
WITH x, y, COUNT(*) AS cnt
ORDER BY cnt DESC
LIMIT 10;
How do I use WITH to get for each X, return the top Y. Then I can do,
MATCH person-[:LIKE]->x
WHERE NOT(person-[:LIKE]->y)
One expected result using the linked example is:
X, Y, names
apple, orange, Bob
etc. for each X and its corresponding top Y.