forked from lloydtabb/imdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genre_matrix.malloynb
26 lines (26 loc) · 970 Bytes
/
genre_matrix.malloynb
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
[
{
"kind": 1,
"language": "markdown",
"value": "# Genres Matrix\nGenre combinations tell you what to expect in a movie. What are the top movies in each combination pair?",
"metadata": {}
},
{
"kind": 2,
"language": "malloy",
"value": "import \"imdb.malloy\"",
"metadata": {}
},
{
"kind": 1,
"language": "markdown",
"value": "## Genre matrix, top movies",
"metadata": {}
},
{
"kind": 2,
"language": "malloy",
"value": "query: movies + {\n join_many: x is from( movies-> {\n group_by: tconst, genres.value\n } ) on tconst = x.tconst\n}\n-> {\n where: genres.value != x.value\n group_by: genre1 is genres.value\n aggregate: title_count\n nest: genre is {\n group_by: \n genre1 is genres.value\n genre2 is x.value\n nest: by_title_list is {\n group_by: primaryTitle, ratings.numVotes\n order_by: 2 desc\n limit: 10\n }\n }\n}",
"metadata": {}
}
]