Till Westmann | fd733ee | 2014-07-10 00:57:37 -0700 | [diff] [blame] | 1 | use dataverse TinySocial; |
2 | |||||
3 | set simfunction "jaccard"; | ||||
4 | set simthreshold "0.3"; | ||||
5 | |||||
6 | for $msg in dataset MugshotMessages | ||||
7 | let $msgsSimilarTags := ( | ||||
8 | for $m2 in dataset MugshotMessages | ||||
9 | where $m2.tags ~= $msg.tags | ||||
10 | and $m2.message-id != $msg.message-id | ||||
11 | return $m2.message | ||||
12 | ) | ||||
13 | where count($msgsSimilarTags) > 0 | ||||
14 | order by count($msgsSimilarTags) | ||||
15 | limit 10 | ||||
16 | return { | ||||
17 | "message" : $msg.message, | ||||
18 | "similarly tagged" : $msgsSimilarTags | ||||
19 | }; |