17 lines
613 B
Plaintext
17 lines
613 B
Plaintext
|
MATCH
|
||
|
(person:Person {id:"30786325583618"})-[:KNOWS*1..2]-(friend:Person),
|
||
|
(friend)<-[:HAS_CREATOR]-(friendPost:Post)-[:HAS_TAG]->(knownTag:Tag {name:"Angola"})
|
||
|
WHERE not(person=friend)
|
||
|
MATCH (friendPost)-[:HAS_TAG]->(commonTag:Tag)
|
||
|
WHERE not(commonTag=knownTag)
|
||
|
WITH DISTINCT commonTag, knownTag, friend
|
||
|
MATCH (commonTag)<-[:HAS_TAG]-(commonPost:Post)-[:HAS_TAG]->(knownTag)
|
||
|
OPTIONAL MATCH (commonPost)-[cpCreator:HAS_CREATOR]->(friend)
|
||
|
WITH commonTag, commonPost
|
||
|
WHERE cpCreator is not null
|
||
|
RETURN
|
||
|
commonTag.name AS tagName,
|
||
|
count(commonPost) AS postCount
|
||
|
ORDER BY postCount DESC, tagName ASC
|
||
|
LIMIT 20;
|