blob: 3afaaa4eb8b8347213aebc90501f901f1c652e57 [file] [log] [blame]
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -07001<!DOCTYPE html>
2
3<html>
4<head>
5 <title>AsterixDB TinySocial Demo</title>
6
7 <style>
8 .pretty-printed {
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -07009 background-color: #eeeeee;
10 margin-bottom: 1em;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070011 }
12
13 .how-to-run {
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070014 background-color: #c8c8c8;
15 margin-bottom: 1em;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070016 }
17
18 .result-output {
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070019 background-color: #BED8E5;
20 margin-bottom: 1em;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070021 }
22
23 body {
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070024 font-family : "Helvetica";
25 margin-bottom: 1em;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070026 }
27 </style>
28
29 <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
30 <script src="../js/asterix-sdk-stable.js"></script>
31 <script src="js/demo.js"></script>
32</head>
33<body>
34 <h1>AQL: Querying TinySocial AsterixDB</h1>
35
36 <h2>Query 0-A - Exact-Match Lookup</h2>
37 <div class="sample-query">
38
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070039 <div class="pretty-printed"><pre>
40 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070041
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070042 for $user in dataset FacebookUsers
43 where $user.id = 8
44 return $user;
45 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070046
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070047 <div class="how-to-run"><pre><code class="javascript">
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -070048 var expression0a = new FLWOGRExpression()
49 .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
50 .bind( new WhereClause(new AExpression().set("$user.id = 8")))
51 .ReturnClause("$user");
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070052 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070053
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070054 <div class="result-output" id="result0a">
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070055 </div>
56
57 <button id="run0a">Run #0-A</button>
58 </div>
59 <hr/>
60 <h2>Query 0-B - Range Scan</h2>
61 <div class="sample-query">
62
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070063 <div class="pretty-printed"><pre>
64 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070065
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070066 for $user in dataset FacebookUsers
67 where $user.id >= 2 and $user.id <= 4
68 return $user;
69 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070070
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -070071 <div class="how-to-run"><pre><code class="javascript">
72 var expression0b = new FLWOGRExpression()
73 .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
74 .bind( new WhereClause().and(
75 new AExpression().set("$user.id >= 2"),
76 new AExpression().set("$user.id <= 4")
77 ))
78 .ReturnClause("$user");
79 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070080
genia.likes.science@gmail.com38612632013-05-28 13:11:52 -070081 <div class="result-output" id="result0b">
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070082 </div>
83
84 <button id="run0b">Run #0-B</button>
85 </div>
86 <hr/>
87
88 <h2>Query 1 - Other Query Filters</h2>
89 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070090 <div class="pretty-printed"><pre>
91 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070092
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -070093 for $user in dataset FacebookUsers
94 where $user.user-since >= datetime('2010-07-22T00:00:00')
95 and $user.user-since <= datetime('2012-07-29T23:59:59')
96 return $user;
97 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -070098
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -070099 <div class="how-to-run"><pre><code class="javascript">
100 var expression1 = new FLWOGRExpression()
101 .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
102 .bind( new WhereClause().and(
103 new AExpression().set("$user.user-since >= datetime('2010-07-22T00:00:00')"),
104 new AExpression().set("$user.user-since <= datetime('2012-07-29T23:59:59')")
105 ))
106 .ReturnClause("$user");
107 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700108
109 <div class="result-output" id="result1">
110 </div>
111
112 <button id="run1">Run #1</button>
113 </div>
114 <hr/>
115
116 <h2>Query 2-A - Equijoin</h2>
117 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700118 <div class="pretty-printed"><pre>
119 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700120
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700121 for $user in dataset FacebookUsers
122 for $message in dataset FacebookMessages
123 where $message.author-id = $user.id
124 return {
125 "uname": $user.name,
126 "message": $message.message
127 };
128 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700129
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700130 <div class="how-to-run"><pre><code class="javascript">
131 var expression2a = new FLWOGRExpression()
132 .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
133 .bind( new ForClause ("message", new AQLClause().set("dataset FacebookMessages")))
134 .bind( new WhereClause (new AExpression().set("$message.author-id = $user.id")))
135 .ReturnClause({
136 "uname" : "$user.name",
137 "message" : "$message.message"
138 });
139 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700140
141 <div class="result-output" id="result2a">
142 </div>
143
144 <button id="run2a">Run #2-A</button>
145 </div>
146 <hr/>
147
148 <h2>Query 2-B - Index join</h2>
149 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700150 <div class="pretty-printed"><pre>
151 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700152
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700153 for $user in dataset FacebookUsers
154 for $message in dataset FacebookMessages
155 where $message.author-id /*+ indexnl */ = $user.id
156 return {
157 "uname": $user.name,
158 "message": $message.message
159 };
160 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700161
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700162 <div class="how-to-run"><pre><code class="javascript">
163 var expression2b = new FLWOGRExpression()
164 .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
165 .bind( new ForClause ("message", new AQLClause().set("dataset FacebookMessages")))
166 .bind( new WhereClause (new AExpression().set("$message.author-id /*+ indexnl */ = $user.id")))
167 .ReturnClause(
168 {
169 "uname" : "$user.name",
170 "message" : "$message.message"
171 }
172 );
173 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700174
175 <div class="result-output" id="result2b">
176 </div>
177
178 <button id="run2b">Run #2-B</button>
179 </div>
180 <hr/>
181
182 <h2>Query 3 - Nested Outer Join</h2>
183 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700184 <div class="pretty-printed"><pre>
185 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700186
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700187 for $user in dataset FacebookUsers
188 return {
189 "uname": $user.name,
190 "messages": for $message in dataset FacebookMessages
191 where $message.author-id = $user.id
192 return $message.message
193 };
194 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700195
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700196 <div class="how-to-run"><pre><code class="javascript">
197 var expression3messages = new FLWOGRExpression()
198 .bind( new ForClause("message", new AExpression().set("dataset FacebookMessages")))
199 .bind( new WhereClause(new AExpression().set("$message.author-id = $user.id")))
200 .ReturnClause("$message.message");
201
202 var expression3 = new FLWOGRExpression()
203 .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
204 .ReturnClause({
205 "uname": "$user.name",
206 "messages" : expression3messages
207 });
208 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700209
210 <div class="result-output" id="result3">
211 </div>
212
213 <button id="run3">Run #3</button>
214 </div>
215 <hr/>
216
217 <h2>Query 4 - Theta Join</h2>
218 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700219 <div class="pretty-printed"><pre>
220 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700221
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700222 for $t in dataset TweetMessages
223 return {
224 "message": $t.message-text,
225 "nearby-messages": for $t2 in dataset TweetMessages
226 where spatial-distance($t.sender-location, $t2.sender-location) <= 1
227 return { "msgtxt":$t2.message-text}
228 };
229 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700230
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700231 <div class="how-to-run"><pre><code class="javascript">
232 var expression4messages = new FLWOGRExpression()
233 .bind( new ForClause( "t2", new AExpression().set("dataset TweetMessages")))
234 .bind( new WhereClause( new AExpression().set("spatial-distance($t.sender-location, $t2.sender-location) <= 1")))
235 .ReturnClause({ "msgtxt" : "$t2.message-text" });
236
237 var expression4 = new FLWOGRExpression()
238 .bind( new ForClause( "t", new AExpression().set("dataset TweetMessages") ))
239 .ReturnClause({
240 "message" : "$t.message-text",
241 "nearby-messages" : expression4messages
242 });
243 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700244
245 <div class="result-output" id="result4">
246 </div>
247
248 <button id="run4">Run #4</button>
249 </div>
250 <hr/>
251
252 <h2>Query 5 - Fuzzy Join</h2>
253 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700254 <div class="pretty-printed"><pre>
255 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700256
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700257 set simfunction "edit-distance";
258 set simthreshold "3";
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700259
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700260 for $fbu in dataset FacebookUsers
261 return {
262 "id": $fbu.id,
263 "name": $fbu.name,
264 "similar-users": for $t in dataset TweetMessages
265 let $tu := $t.user
266 where $tu.name ~= $fbu.name
267 return {
268 "twitter-screenname": $tu.screen-name,
269 "twitter-name": $tu.name
270 }
271 };
272 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700273
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700274 <div class="how-to-run"><pre><code class="javascript">
275 var similarUsersExpression = new FLWOGRExpression()
276 .bind( new ForClause ("t", new AQLClause().set("dataset TweetMessages")))
277 .bind( new LetClause ("tu", new AExpression().set("$t.user")))
278 .bind( new WhereClause (new AExpression().set("$tu.name ~= $fbu.name")))
279 .ReturnClause({
280 "twitter-screenname": "$tu.screen-name",
281 "twitter-name": "$tu.name"
282 });
283
284 var expression5 = new FLWOGRExpression()
285 .bind( new ForClause ("fbu", new AQLClause().set("dataset FacebookUsers")))
286 .ReturnClause(
287 {
288 "id" : "$fbu.id",
289 "name" : "$fbu.name",
290 "similar-users" : similarUsersExpression
291 }
292 );
293 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700294
295 <div class="result-output" id="result5">
296 </div>
297
298 <button id="run5">Run #5</button>
299 </div>
300 <hr/>
301
302 <h2>Query 6 - Existential Quantification</h2>
303 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700304 <div class="pretty-printed"><pre>
305 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700306
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700307 for $fbu in dataset FacebookUsers
308 where (some $e in $fbu.employment satisfies is-null($e.end-date))
309 return $fbu;
310 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700311
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700312 <div class="how-to-run"><pre><code class="javascript">
313 var expression6 = new FLWOGRExpression()
314 .bind( new ForClause ("fbu", new AQLClause().set("dataset FacebookUsers")))
315 .bind( new WhereClause (
316 new QuantifiedExpression (
317 "some" ,
318 {"$e" : new AQLClause().set("$fbu.employment") },
319 new AQLClause().set("is-null($e.end-date)")
320 )
321 ))
322 .ReturnClause("$fbu");
323 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700324
325 <div class="result-output" id="result6">
326 </div>
327
328 <button id="run6">Run #6</button>
329 </div>
330 <hr/>
331
332 <h2>Query 7 - Universal Quantification</h2>
333 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700334 <div class="pretty-printed"><pre><pre>
335 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700336
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700337 for $fbu in dataset FacebookUsers
338 where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
339 return $fbu;
340 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700341
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700342 <div class="how-to-run"><pre><code class="javascript">
343 var expression7 = new FLWOGRExpression()
344 .bind( new ForClause (
345 "fbu",
346 new AQLClause().set("dataset FacebookUsers")
347 ))
348 .bind( new WhereClause (
349 new QuantifiedExpression (
350 "every" ,
351 {"$e" : new AQLClause().set("$fbu.employment") },
352 new AQLClause().set("not(is-null($e.end-date))")
353 )
354 ))
355 .ReturnClause("$fbu");
356 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700357
358 <div class="result-output" id="result7">
359 </div>
360
361 <button id="run7">Run #7</button>
362 </div>
363 <hr/>
364
365 <h2>Query 8 - Simple Aggregation</h2>
366 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700367 <div class="pretty-printed"><pre>
368 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700369
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700370 count(for $fbu in dataset FacebookUsers return $fbu);
371 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700372
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700373 <div class="how-to-run"><pre><code class="javascript">
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700374 var expression8 = new FunctionExpression(
375 "count",
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700376 new FLWOGRExpression()
377 .bind( new ForClause("fbu", new AQLClause().set("dataset FacebookUsers")))
378 .ReturnClause("$fbu")
genia.likes.science@gmail.com18f3bf22013-06-12 07:45:02 -0700379 );
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700380 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700381
382 <div class="result-output" id="result8">
383 </div>
384
385 <button id="run8">Run #8</button>
386 </div>
387 <hr/>
388
389 <h2>Query 9-A - Grouping and Aggregation</h2>
390 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700391 <div class="pretty-printed"><pre>
392 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700393
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700394 for $t in dataset TweetMessages
395 group by $uid := $t.user.screen-name with $t
396 return {
397 "user": $uid,
398 "count": count($t)
399 };
400 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700401
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700402 <div class="how-to-run"><pre><code class="javascript">
403 var expression9a = new FLWOGRExpression()
404 .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
405 .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
406 .ReturnClause(
407 {
408 "user" : "$uid",
409 "count" : new FunctionExpression("count", new AExpression().set("$t"))
410 }
411 );
412 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700413
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700414 <div class="result-output" id="result9a">
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700415 </div>
416
417 <button id="run9a">Run #9-A</button>
418 </div>
419 <hr/>
420
421 <h2>Query 9-B - (Hash-Based) Grouping and Aggregation</h2>
422 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700423 <div class="pretty-printed"><pre>
424 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700425
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700426 for $t in dataset TweetMessages
427 /*+ hash*/
428 group by $uid := $t.user.screen-name with $t
429 return {
430 "user": $uid,
431 "count": count($t)
432 };
433 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700434
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700435 <div class="how-to-run"><pre><code class="javascript">
436 var expression9b = new FLWOGRExpression()
437 .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
438 .bind( new AQLClause().set("/*+ hash*/"))
439 .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
440 .ReturnClause(
441 {
442 "user" : "$uid",
443 "count" : new FunctionExpression("count", new AExpression().set("$t"))
444 }
445 );
446 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700447
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700448 <div class="result-output" id="result9b">
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700449 </div>
450
451 <button id="run9b">Run #9-B</button>
452 </div>
453 <hr/>
454
455 <h2>Query 10 - Grouping and Limits</h2>
456 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700457 <div class="pretty-printed"><pre>
458 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700459
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700460 for $t in dataset TweetMessages
461 group by $uid := $t.user.screen-name with $t
462 let $c := count($t)
463 order by $c desc
464 limit 3
465 return {
466 "user": $uid,
467 "count": $c
468 };
469 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700470
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700471 <div class="how-to-run"><pre><code class="javascript">
472 var expression10 = new FLWOGRExpression()
473 .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
474 .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
475 .bind( new LetClause(
476 "c",
477 new FunctionExpression("count", new AExpression().set("$t"))
478 ))
479 .bind( new OrderbyClause( new AExpression().set("$c"), "desc" ) )
480 .bind( new LimitClause(new AExpression().set("3")) )
481 .ReturnClause(
482 {
483 "user" : "$uid",
484 "count" : "$c"
485 }
486 );
487 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700488
genia.likes.science@gmail.comfba7cc82013-05-31 04:04:08 -0700489 <div class="result-output" id="result10">
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700490 </div>
491
492 <button id="run10">Run #10</button>
493 </div>
494 <hr/>
495
496 <h2>Query 11 - Left Outer Fuzzy Join</h2>
497 <div class="sample-query">
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700498 <div class="pretty-printed"><pre>
499 use dataverse TinySocial;
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700500
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700501 set simfunction "jaccard";
502 set simthreshold "0.3";
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700503
genia.likes.science@gmail.com80121c92013-05-29 04:58:04 -0700504 for $t in dataset TweetMessages
505 return {
506 "tweet": $t,
507 "similar-tweets": for $t2 in dataset TweetMessages
508 where $t2.referred-topics ~= $t.referred-topics
509 and $t2.tweetid != $t.tweetid
510 return $t2.referred-topics
511 };
512 </pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700513
genia.likes.science@gmail.comf8cca192013-06-13 15:45:53 -0700514 <div class="how-to-run"><pre><code class="javascript">
515 var expression11 = new FLWOGRExpression()
516 .bind( new ForClause( "t", new AExpression().set("dataset TweetMessages") ))
517 .ReturnClause({
518 "tweet" : new AExpression().set("$t"),
519 "similar-tweets": new FLWOGRExpression()
520 .bind( new ForClause( "t2", new AExpression().set("dataset TweetMessages") ))
521 .bind( new WhereClause().and(
522 new AExpression().set("$t2.referred-topics ~= $t.referred-topics"),
523 new AExpression().set("$t2.tweetid != $t.tweetid")
524 ))
525 .ReturnClause("$t2.referred-topics")
526 });
527 </code></pre></div>
genia.likes.science@gmail.com512454d2013-05-28 03:32:20 -0700528
529 <div class="result-output" id="result11">
530 </div>
531
532 <button id="run11">Run #11</button>
533 </div>
534
535</body>
536</html>