forked from ldbc/ldbc_snb_interactive_v1_impls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bi-19.cypher
30 lines (30 loc) · 863 Bytes
/
bi-19.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
// Q19. Stranger's interaction
/*
:param {
date: 19890101,
tagClass1: 'MusicalArtist',
tagClass2: 'OfficeHolder'
}
*/
MATCH
(:TagClass {name: $tagClass1})<-[:HAS_TYPE]-(:Tag)<-[:HAS_TAG]-
(forum1:Forum)-[:HAS_MEMBER]->(stranger:Person)
WITH DISTINCT stranger
MATCH
(:TagClass {name: $tagClass2})<-[:HAS_TYPE]-(:Tag)<-[:HAS_TAG]-
(forum2:Forum)-[:HAS_MEMBER]->(stranger)
WITH DISTINCT stranger
MATCH
(person:Person)<-[:HAS_CREATOR]-(comment:Comment)-[:REPLY_OF*]->(message:Message)-[:HAS_CREATOR]->(stranger)
WHERE person.birthday > $date
AND person <> stranger
AND NOT (person)-[:KNOWS]-(stranger)
AND NOT (message)-[:REPLY_OF*]->(:Message)-[:HAS_CREATOR]->(stranger)
RETURN
person.id,
count(DISTINCT stranger) AS strangersCount,
count(comment) AS interactionCount
ORDER BY
interactionCount DESC,
person.id ASC
LIMIT 100