blob: 26684302ad2824183c787df3a7c0a6cc299526ed [file] [log] [blame]
khfaraaz82@gmail.comcd92f4f2012-10-23 19:08:19 +00001/*
2 * Description : Insert open data into internal dataset and query the open data
3 * Expected Result : Success
4 * Date : 23rd October 2012
5 * Notes : This test was written to cover the scenario which is used in the proposal.
6 */
7
8drop dataverse test if exists;
9create dataverse test;
10
11use dataverse test;
12
13create type TweetMessageType as open {
14tweetid : string,
15user : {
16 screen-name: string,
17 lang: string,
18 friends_count: int32,
19 statuses_count: int32,
20 name: string,
21 followers_count: int32
22}, sender-location: point?,
23 send-time: datetime,
24 referred-topics: {{ string }},
25 message-text: string
26};
27
28create dataset TweetMessages(TweetMessageType)
ramangrover29669d8f62013-02-11 06:03:32 +000029primary key tweetid;
khfaraaz82@gmail.comcd92f4f2012-10-23 19:08:19 +000030
31insert into dataset TweetMessages(
32 {
33 "tweetid": "1023",
34 "user": {
35 "screen-name": "dflynn24",
36 "lang": "en",
37 "friends_count": 46,
38 "statuses_count": 987,
39 "name": "danielle flynn",
40 "followers_count": 47
41 },
42 "sender-location": create-point(40.904177,-72.958996),
43 "send-time": datetime("2010-02-21T11:56:02-05:00"),
44 "referred-topics": {{ "verizon" }},
45 "message-text": "i need a #verizon phone like nowwwww! : ("
46 });
47
48insert into dataset TweetMessages(
49 {
50 "tweetid": "1024",
51 "user": {
52 "screen-name": "miriamorous",
53 "lang": "en",
54 "friends_count": 69,
55 "statuses_count": 1068,
56 "name": "Miriam Songco",
57 "followers_count": 78
58 },
59 "send-time": datetime("2010-02-21T11:11:43-08:00"),
60 "referred-topics": {{ "commercials", "verizon", "att" }},
61 "message-text": "#verizon & #att #commercials, so competitive"
62 });
63
64insert into dataset TweetMessages(
65 {
66 "tweetid": "1025",
67 "user": {
68 "screen-name": "dj33",
69 "lang": "en",
70 "friends_count": 96,
71 "send-time": "2010-02-21T11:56:02-05:00",
72 "statuses_count": 1696,
73 "name": "Don Jango",
74 "followers_count": 22
75 },
76 "send-time": datetime("2010-02-21T12:38:44-05:00"),
77 "referred-topics": {{ "charlotte" }},
78 "message-text": "Chillin at dca waiting for 900am flight to #charlotte and from there to providenciales"
79 });
80
81insert into dataset TweetMessages(
82 { "tweetid": "1026",
83 "user": {
84 "screen-name": "reallyleila",
85 "lang": "en",
86 "friends_count": 106,
87 "statuses_count": 107,
88 "name": "Leila Samii",
89 "followers_count": 52
90 },
91 "send-time": datetime("2010-02-21T21:31:57-06:00"),
92 "referred-topics": {{ "verizon", "at&t", "iphone" }},
93 "message-text": "I think a switch from #verizon to #at&t may be in my near future... my smartphone is like a land line compared to the #iphone!"
94});
95
96write output to nc1:"rttest/open-closed_query-proposal.adm";
97
98for $tp1 in (
99 for $tweet in dataset('TweetMessages')
100 where some $topic in $tweet.referred-topics satisfies contains($topic, 'verizon')
101 for $tp in $tweet.referred-topics
102 return
103 { "topic": $tp }
104)
105group by $tp2 := $tp1.topic with $tp1
106order by $tp2
107return { "topic": $tp2, "count": count($tp1) }