Find places that people also like who favorite this place:
Query.
START place=node:node_auto_index(name = "CoffeeShop1") MATCH place<-[:favorite]-person-[:favorite]->stuff RETURN stuff.name, count(*) ORDER BY count(*) DESC, stuff.name
The list of places that are favorited by people that favorited the start place.
Try this query live. (1) {"name":"SaunaX"} (2) {"name":"CoffeeShop1"} (3) {"name":"MelsPlace"} (4) {"name":"CoffeeShop3"} (5) {"name":"Cool"} (6) {"name":"CoffeeShop2"} (7) {"name":"CoffeShop2"} (8) {"name":"Cosy"} (9) {"name":"Jill"} (10) {"name":"Joe"} (2)-[:tagged]->(5) {} (2)-[:tagged]->(8) {} (3)-[:tagged]->(8) {} (3)-[:tagged]->(5) {} (4)-[:tagged]->(8) {} (6)-[:tagged]->(5) {} (9)-[:favorite]->(2) {} (9)-[:favorite]->(3) {} (9)-[:favorite]->(7) {} (10)-[:favorite]->(2) {} (10)-[:favorite]->(1) {} (10)-[:favorite]->(3) {} START place=node:node_auto_index(name = "CoffeeShop1") MATCH place<-[:favorite]-person-[:favorite]->stuff RETURN stuff.name, count(*) ORDER BY count(*) DESC, stuff.name
Find places that are tagged with the same tags:
Query.
START place=node:node_auto_index(name = "CoffeeShop1") MATCH place-[:tagged]->tag<-[:tagged]-otherPlace RETURN otherPlace.name, collect(tag.name) ORDER BY length(collect(tag.name)) DESC, otherPlace.name
This query returns other places than CoffeeShop1 which share the same tags; they are ranked by the number of tags.
Result
otherPlace.name | collect(tag.name) |
---|---|
3 rows | |
|
|
|
|
|
|
Try this query live. (1) {"name":"SaunaX"} (2) {"name":"CoffeeShop1"} (3) {"name":"MelsPlace"} (4) {"name":"CoffeeShop3"} (5) {"name":"Cool"} (6) {"name":"CoffeeShop2"} (7) {"name":"CoffeShop2"} (8) {"name":"Cosy"} (9) {"name":"Jill"} (10) {"name":"Joe"} (2)-[:tagged]->(5) {} (2)-[:tagged]->(8) {} (3)-[:tagged]->(8) {} (3)-[:tagged]->(5) {} (4)-[:tagged]->(8) {} (6)-[:tagged]->(5) {} (9)-[:favorite]->(2) {} (9)-[:favorite]->(3) {} (9)-[:favorite]->(7) {} (10)-[:favorite]->(2) {} (10)-[:favorite]->(1) {} (10)-[:favorite]->(3) {} START place=node:node_auto_index(name = "CoffeeShop1") MATCH place-[:tagged]->tag<-[:tagged]-otherPlace RETURN otherPlace.name, collect(tag.name) ORDER BY length(collect(tag.name)) DESC, otherPlace.name
Copyright © 2013 Neo Technology