memgraph/tests/public_benchmark/ldbc/test_cases/queries/query_6.oc
florijan 21550d3bb1 LDBC queries checked
Summary:
- checked existing queries and added new ones
- minor changes to LDBC setup

Reviewers: teon.banek, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D737
2017-09-02 10:36:02 +02:00

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;