Find places that people also like who favorite this place:
Query.
MATCH (place)<-[:favorite]-(person)-[:favorite]->(stuff) WHERE place.name = 'CoffeeShop1' 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. create (_0 {`name`:"SaunaX"}) create (_1 {`name`:"CoffeeShop1"}) create (_2 {`name`:"MelsPlace"}) create (_3 {`name`:"CoffeeShop3"}) create (_4 {`name`:"Cool"}) create (_5 {`name`:"CoffeeShop2"}) create (_6 {`name`:"CoffeShop2"}) create (_7 {`name`:"Cosy"}) create (_8 {`name`:"Jill"}) create (_9 {`name`:"Joe"}) create _1-[:`tagged`]->_4 create _1-[:`tagged`]->_7 create _2-[:`tagged`]->_7 create _2-[:`tagged`]->_4 create _3-[:`tagged`]->_7 create _5-[:`tagged`]->_4 create _8-[:`favorite`]->_1 create _8-[:`favorite`]->_2 create _8-[:`favorite`]->_6 create _9-[:`favorite`]->_1 create _9-[:`favorite`]->_0 create _9-[:`favorite`]->_2 MATCH (place)<-[:favorite]-(person)-[:favorite]->(stuff) WHERE place.name = 'CoffeeShop1' RETURN stuff.name, count(*) ORDER BY count(*) DESC, stuff.name
Find places that are tagged with the same tags:
Query.
MATCH (place)-[:tagged]->(tag)<-[:tagged]-(otherPlace) WHERE place.name = 'CoffeeShop1' 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. create (_0 {`name`:"SaunaX"}) create (_1 {`name`:"CoffeeShop1"}) create (_2 {`name`:"MelsPlace"}) create (_3 {`name`:"CoffeeShop3"}) create (_4 {`name`:"Cool"}) create (_5 {`name`:"CoffeeShop2"}) create (_6 {`name`:"CoffeShop2"}) create (_7 {`name`:"Cosy"}) create (_8 {`name`:"Jill"}) create (_9 {`name`:"Joe"}) create _1-[:`tagged`]->_4 create _1-[:`tagged`]->_7 create _2-[:`tagged`]->_7 create _2-[:`tagged`]->_4 create _3-[:`tagged`]->_7 create _5-[:`tagged`]->_4 create _8-[:`favorite`]->_1 create _8-[:`favorite`]->_2 create _8-[:`favorite`]->_6 create _9-[:`favorite`]->_1 create _9-[:`favorite`]->_0 create _9-[:`favorite`]->_2 MATCH (place)-[:tagged]->(tag)<-[:tagged]-(otherPlace) WHERE place.name = 'CoffeeShop1' RETURN otherPlace.name, collect(tag.name) ORDER BY length(collect(tag.name)) DESC, otherPlace.name
Copyright © 2014 Neo Technology