blob: 19ceda0ed83422ba104cf1ce4d47ac0cedbbc8f1 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse rares03 if exists;
2
3create dataverse rares03;
4
5use dataverse rares03;
6
7create type UserType as open {
8 uid: int32,
9 name: string,
10 lottery_numbers: {{int32}}
11}
12
13create type VisitorType as open {
14 vid: int32,
15 name: string,
16 lottery_numbers: {{int32}}
17}
18
19create nodegroup group1 if not exists on nc1, nc2;
20
21create dataset Users(UserType)
ramangrover29669d8f62013-02-11 06:03:32 +000022 primary key uid on group1;
vinayakb38b7ca42012-03-05 05:44:15 +000023
24create dataset Visitors(VisitorType)
ramangrover29669d8f62013-02-11 06:03:32 +000025 primary key vid on group1;
vinayakb38b7ca42012-03-05 05:44:15 +000026
27
28// set simfunction "jaccard";
29// set simthreshold ".8";
30
31write output to nc1:"/tmp/rares03.adm";
32
33for $user in dataset('Users')
34let $tokens :=
35 for $lottery_number in $user.lottery_numbers
36 for $token at $i in
37 for $user in dataset('Users')
38 for $lottery_number in $user.lottery_numbers
39 group by $item := $lottery_number with $user
40 let $count := count($user)
41 order by $count desc
42 return $item
43 where $lottery_number = $token
44 order by $token
45 return $i
46return {"uid": $user.uid, "tokens": $tokens}