forked from ldbc/ldbc_snb_interactive_v1_impls
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bi-2.cypher
40 lines (40 loc) · 977 Bytes
/
bi-2.cypher
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Q2. Top tags for country, age, gender, time
/*
:param {
date1: 20091231230000000,
date2: 20101107230000000,
country1: 'Ethiopia',
country2: 'Belarus'
}
*/
MATCH
(country:Country)<-[:IS_PART_OF]-(:City)<-[:IS_LOCATED_IN]-(person:Person)
<-[:HAS_CREATOR]-(message:Message)-[:HAS_TAG]->(tag:Tag)
WHERE message.creationDate >= $startDate
AND message.creationDate <= $endDate
AND (country.name = $country1 OR country.name = $country2)
WITH
country.name AS countryName,
message.creationDate/100000000000%100 AS month,
person.gender AS gender,
floor((20130101 - person.birthday) / 10000 / 5.0) AS ageGroup,
tag.name AS tagName,
message
WITH
countryName, month, gender, ageGroup, tagName, count(message) AS messageCount
WHERE messageCount > 100
RETURN
countryName,
month,
gender,
ageGroup,
tagName,
messageCount
ORDER BY
messageCount DESC,
tagName ASC,
ageGroup ASC,
gender ASC,
month ASC,
countryName ASC
LIMIT 100