blob: af57a038bcb05fa59169ef3f57aff19bee9cf6c2 [file] [log] [blame]
Ian Maxoned124d82015-05-29 18:44:11 -07001<!DOCTYPE html>
2<!--
3 | Generated by Apache Maven Doxia at 2015-05-29
4 | Rendered using Apache Maven Fluido Skin 1.3.0
5-->
6<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta charset="UTF-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10 <meta name="Date-Revision-yyyymmdd" content="20150529" />
11 <meta http-equiv="Content-Language" content="en" />
12 <title>AsterixDB - </title>
13 <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
14 <link rel="stylesheet" href="../css/site.css" />
15 <link rel="stylesheet" href="../css/print.css" media="print" />
16
17
18 <script type="text/javascript" src="../js/apache-maven-fluido-1.3.0.min.js"></script>
19
20
21 </head>
22 <body class="topBarDisabled">
23
24
25
26
27 <div class="container-fluid">
28 <div id="banner">
29 <div class="pull-left">
30 <a href=".././" id="bannerLeft">
31 <img src="../images/asterixlogo.png" alt="AsterixDB"/>
32 </a>
33 </div>
34 <div class="pull-right"> <a href="http://incubator.apache.org/" id="bannerRight">
35 <img src="../images/egg-logo.png" alt="Apache Software Foundation Incubator"/>
36 </a>
37 </div>
38 <div class="clear"><hr/></div>
39 </div>
40
41 <div id="breadcrumbs">
42 <ul class="breadcrumb">
43
44
45 <li id="publishDate">Last Published: 2015-05-29</li>
46
47
48
49 <li id="projectVersion" class="pull-right">Version: 0.8.7-SNAPSHOT</li>
50
51 <li class="divider pull-right">|</li>
52
53 <li class="pull-right"> <a href="../index.html" title="Home">
54 Home</a>
55 </li>
56
57 </ul>
58 </div>
59
60
61 <div class="row-fluid">
62 <div id="leftColumn" class="span3">
63 <div class="well sidebar-nav">
64
65
66 <ul class="nav nav-list">
67 <li class="nav-header">Apache Software Foundation</li>
68
69 <li>
70
71 <a href="http://www.apache.org/" class="externalLink" title="Home">
72 <i class="none"></i>
73 Home</a>
74 </li>
75
76 <li>
77
78 <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Donate">
79 <i class="none"></i>
80 Donate</a>
81 </li>
82
83 <li>
84
85 <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">
86 <i class="none"></i>
87 Thanks</a>
88 </li>
89
90 <li>
91
92 <a href="http://www.apache.org/security/" class="externalLink" title="Security">
93 <i class="none"></i>
94 Security</a>
95 </li>
96 <li class="nav-header">User Documentation</li>
97
98 <li>
99
100 <a href="../install.html" title="Installing and Managing AsterixDB using Managix">
101 <i class="none"></i>
102 Installing and Managing AsterixDB using Managix</a>
103 </li>
104
105 <li>
106
107 <a href="../aql/primer.html" title="AsterixDB 101: An ADM and AQL Primer">
108 <i class="none"></i>
109 AsterixDB 101: An ADM and AQL Primer</a>
110 </li>
111
112 <li>
113
114 <a href="../aql/primer-sql-like.html" title="AsterixDB 101: An ADM and AQL Primer (For SQL Fans)">
115 <i class="none"></i>
116 AsterixDB 101: An ADM and AQL Primer (For SQL Fans)</a>
117 </li>
118
119 <li class="active">
120
121 <a href="#"><i class="none"></i>AsterixDB Javascript SDK</a>
122 </li>
123
124 <li>
125
126 <a href="../aql/datamodel.html" title="Asterix Data Model (ADM)">
127 <i class="none"></i>
128 Asterix Data Model (ADM)</a>
129 </li>
130
131 <li>
132
133 <a href="../aql/manual.html" title="Asterix Query Language (AQL)">
134 <i class="none"></i>
135 Asterix Query Language (AQL)</a>
136 </li>
137
138 <li>
139
140 <a href="../aql/functions.html" title="AQL Functions">
141 <i class="none"></i>
142 AQL Functions</a>
143 </li>
144
145 <li>
146
147 <a href="../aql/allens.html" title="AQL Allen's Relations Functions">
148 <i class="none"></i>
149 AQL Allen's Relations Functions</a>
150 </li>
151
152 <li>
153
154 <a href="../aql/similarity.html" title="AQL Support of Similarity Queries">
155 <i class="none"></i>
156 AQL Support of Similarity Queries</a>
157 </li>
158
159 <li>
160
161 <a href="../aql/externaldata.html" title="Accessing External Data">
162 <i class="none"></i>
163 Accessing External Data</a>
164 </li>
165
166 <li>
167
168 <a href="../aql/filters.html" title="Filter-Based LSM Index Acceleration">
169 <i class="none"></i>
170 Filter-Based LSM Index Acceleration</a>
171 </li>
172
173 <li>
174
175 <a href="../api.html" title="REST API to AsterixDB">
176 <i class="none"></i>
177 REST API to AsterixDB</a>
178 </li>
179 </ul>
180
181
182
183 <hr class="divider" />
184
185 <div id="poweredBy">
186 <div class="clear"></div>
187 <div class="clear"></div>
188 <div class="clear"></div>
189 <a href=".././" title="Hyracks" class="builtBy">
190 <img class="builtBy" alt="Hyracks" src="../images/hyrax_ts.png" />
191 </a>
192 </div>
193 </div>
194 </div>
195
196
197 <div id="bodyColumn" class="span9" >
198
199 <h1>AsterixDB Javascript SDK</h1>
200<div class="section">
201<h2>Obtaining and Including<a name="Obtaining_and_Including"></a></h2>
202<p><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/bindings/asterix-sdk-stable.js">Download</a> the javascript SDK and include it like any other javascript library by adding the following line in the appropriate HTML file:</p>
203
204<div class="source">
205<pre>&lt;script src=&quot;path/to/asterix-sdk-stable.js&quot;&gt;&lt;/script&gt;
206</pre></div></div>
207<div class="section">
208<h2>Interactive Demos<a name="Interactive_Demos"></a></h2>
209<p>There are two interactive demos that are available for download. Both of the demos illustrate how the javascript API would be used in an application:</p>
210
211<ul>
212
213<li><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/demos/tweetbook-demo.zip">Tweetbook Demo</a>: a contrived geo-spatial application dealing with artificial Tweets allowing spatial, temporal, and keyword-based filtering.</li>
214
215<li><a class="externalLink" href="http://asterixdb.ics.uci.edu/download/demos/admaql101-demo.zip">ADM/AQL 101 Demo</a>: an interactive version of all of the examples that are provided in the following section.</li>
216</ul></div>
217<div class="section">
218<h2>The javascript SDK: by example<a name="The_javascript_SDK:_by_example"></a></h2>
219<p>In this section, we explore how to form AQL queries using the javascript SDK. The queries from <a href="primer.html">AsterixDB 101: An ADM and AQL Primer</a> are used as examples here. For each AQL statement, the equivalent javascript expression is shown below it, followed by the results of executing the query.</p>
220<div class="section">
221<h3>Query 0-A - Exact-Match Lookup<a name="Query_0-A_-_Exact-Match_Lookup"></a></h3>
222<div class="section">
223<div class="section">
224<div class="section">
225<h6>AQL<a name="AQL"></a></h6>
226
227<div class="source">
228<pre>use dataverse TinySocial;
229
230for $user in dataset FacebookUsers
231where $user.id = 8
232return $user;
233</pre></div></div>
234<div class="section">
235<h6>JS<a name="JS"></a></h6>
236
237<div class="source">
238<pre>var expression0a = new FLWOGRExpression()
239 .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
240 .WhereClause(new AExpression(&quot;$user.id = 8&quot;))
241 .ReturnClause(&quot;$user&quot;);
242</pre></div></div>
243<div class="section">
244<h6>Results<a name="Results"></a></h6>
245
246<div class="source">
247<pre>{ &quot;id&quot;: { int32: 8 } , &quot;alias&quot;: &quot;Nila&quot;, &quot;name&quot;: &quot;NilaMilliron&quot;, &quot;user-since&quot;: { datetime: 1199182200000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 3 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Plexlane&quot;, &quot;start-date&quot;: { date: 1267315200000}, &quot;end-date&quot;: null } ]} }
248</pre></div></div></div></div></div>
249<div class="section">
250<h3>Query 0-B - Range Scan<a name="Query_0-B_-_Range_Scan"></a></h3>
251<div class="section">
252<div class="section">
253<div class="section">
254<h6>AQL<a name="AQL"></a></h6>
255
256<div class="source">
257<pre>use dataverse TinySocial;
258
259for $user in dataset FacebookUsers
260where $user.id &gt;= 2 and $user.id &lt;= 4
261return $user;
262</pre></div></div>
263<div class="section">
264<h6>JS<a name="JS"></a></h6>
265
266<div class="source">
267<pre>var expression0b = new FLWOGRExpression()
268 .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
269 .WhereClause().and(new AExpression(&quot;$user.id &gt;= 2&quot;), new AExpression(&quot;$user.id &lt;= 4&quot;))
270 .ReturnClause(&quot;$user&quot;);
271</pre></div></div>
272<div class="section">
273<h6>Results<a name="Results"></a></h6>
274
275<div class="source">
276<pre>{ &quot;id&quot;: { int32: 2 } , &quot;alias&quot;: &quot;Isbel&quot;, &quot;name&quot;: &quot;IsbelDull&quot;, &quot;user-since&quot;: { datetime: 1295691000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Hexviafind&quot;, &quot;start-date&quot;: { date: 1272326400000}, &quot;end-date&quot;: null } ]} }
277{ &quot;id&quot;: { int32: 3 } , &quot;alias&quot;: &quot;Emory&quot;, &quot;name&quot;: &quot;EmoryUnk&quot;, &quot;user-since&quot;: { datetime: 1341915000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;geomedia&quot;, &quot;start-date&quot;: { date: 1276732800000}, &quot;end-date&quot;: { date: 1264464000000} } ]} }
278{ &quot;id&quot;: { int32: 4 } , &quot;alias&quot;: &quot;Nicholas&quot;, &quot;name&quot;: &quot;NicholasStroh&quot;, &quot;user-since&quot;: { datetime: 1293444600000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 2 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Zamcorporation&quot;, &quot;start-date&quot;: { date: 1275955200000}, &quot;end-date&quot;: null } ]} }
279</pre></div></div></div></div></div>
280<div class="section">
281<h3>Query 1 - Other Query Filters<a name="Query_1_-_Other_Query_Filters"></a></h3>
282<div class="section">
283<div class="section">
284<div class="section">
285<h6>AQL<a name="AQL"></a></h6>
286
287<div class="source">
288<pre>use dataverse TinySocial;
289
290for $user in dataset FacebookUsers
291where $user.user-since &gt;= datetime('2010-07-22T00:00:00')
292and $user.user-since &lt;= datetime('2012-07-29T23:59:59')
293return $user;
294</pre></div></div>
295<div class="section">
296<h6>JS<a name="JS"></a></h6>
297
298<div class="source">
299<pre>var expression1 = new FLWOGRExpression()
300 .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
301 .WhereClause().and(
302 new AExpression(&quot;$user.user-since &gt;= datetime('2010-07-22T00:00:00')&quot;),
303 new AExpression(&quot;$user.user-since &lt;= datetime('2012-07-29T23:59:59')&quot;)
304 ).ReturnClause(&quot;$user&quot;);
305</pre></div></div>
306<div class="section">
307<h6>Results<a name="Results"></a></h6>
308
309<div class="source">
310<pre>{ &quot;id&quot;: { int32: 2 } , &quot;alias&quot;: &quot;Isbel&quot;, &quot;name&quot;: &quot;IsbelDull&quot;, &quot;user-since&quot;: { datetime: 1295691000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Hexviafind&quot;, &quot;start-date&quot;: { date: 1272326400000}, &quot;end-date&quot;: null } ]} }
311{ &quot;id&quot;: { int32: 10 } , &quot;alias&quot;: &quot;Bram&quot;, &quot;name&quot;: &quot;BramHatch&quot;, &quot;user-since&quot;: { datetime: 1287223800000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 9 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;physcane&quot;, &quot;start-date&quot;: { date: 1181001600000}, &quot;end-date&quot;: { date: 1320451200000} } ]} }
312{ &quot;id&quot;: { int32: 3 } , &quot;alias&quot;: &quot;Emory&quot;, &quot;name&quot;: &quot;EmoryUnk&quot;, &quot;user-since&quot;: { datetime: 1341915000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;geomedia&quot;, &quot;start-date&quot;: { date: 1276732800000}, &quot;end-date&quot;: { date: 1264464000000} } ]} }
313{ &quot;id&quot;: { int32: 4 } , &quot;alias&quot;: &quot;Nicholas&quot;, &quot;name&quot;: &quot;NicholasStroh&quot;, &quot;user-since&quot;: { datetime: 1293444600000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 2 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Zamcorporation&quot;, &quot;start-date&quot;: { date: 1275955200000}, &quot;end-date&quot;: null } ]} }
314</pre></div></div></div></div></div>
315<div class="section">
316<h3>Query 2-A - Equijoin<a name="Query_2-A_-_Equijoin"></a></h3>
317<div class="section">
318<div class="section">
319<div class="section">
320<h6>AQL<a name="AQL"></a></h6>
321
322<div class="source">
323<pre>use dataverse TinySocial;
324
325for $user in dataset FacebookUsers
326for $message in dataset FacebookMessages
327where $message.author-id = $user.id
328return {
329 &quot;uname&quot;: $user.name,
330 &quot;message&quot;: $message.message
331};
332</pre></div></div>
333<div class="section">
334<h6>JS<a name="JS"></a></h6>
335
336<div class="source">
337<pre>var expression2a = new FLWOGRExpression()
338 .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
339 .ForClause (&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
340 .WhereClause(new AExpression(&quot;$message.author-id = $user.id&quot;))
341 .ReturnClause({
342 &quot;uname&quot; : &quot;$user.name&quot;,
343 &quot;message&quot; : &quot;$message.message&quot;
344 });
345</pre></div></div>
346<div class="section">
347<h6>Results<a name="Results"></a></h6>
348
349<div class="source">
350<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; dislike iphone its touch-screen is horrible&quot; }
351{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; like verizon the 3G is awesome:)&quot; }
352{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand motorola the touch-screen is terrible&quot; }
353{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand at&amp;t the network is horrible:(&quot; }
354{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand at&amp;t its plan is terrible&quot; }
355{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like samsung the plan is amazing&quot; }
356{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like t-mobile its platform is mind-blowing&quot; }
357{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;message&quot;: &quot; love at&amp;t its 3G is good:)&quot; }
358{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; dislike iphone the voice-command is bad:(&quot; }
359{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; can't stand t-mobile its voicemail-service is OMG:(&quot; }
360{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love sprint its shortcut-menu is awesome:)&quot; }
361{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love verizon its wireless is good&quot; }
362{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;message&quot;: &quot; love sprint the customization is mind-blowing&quot; }
363{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;message&quot;: &quot; like iphone the voicemail-service is awesome&quot; }
364{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;message&quot;: &quot; dislike sprint the speed is horrible&quot; }
365</pre></div></div></div></div></div>
366<div class="section">
367<h3>Query 2-B - Index join<a name="Query_2-B_-_Index_join"></a></h3>
368<div class="section">
369<div class="section">
370<div class="section">
371<h6>AQL<a name="AQL"></a></h6>
372
373<div class="source">
374<pre>use dataverse TinySocial;
375
376for $user in dataset FacebookUsers
377for $message in dataset FacebookMessages
378where $message.author-id /*+ indexnl */ = $user.id
379return {
380 &quot;uname&quot;: $user.name,
381 &quot;message&quot;: $message.message
382};
383</pre></div></div>
384<div class="section">
385<h6>JS<a name="JS"></a></h6>
386
387<div class="source">
388<pre>var expression2b = new FLWOGRExpression()
389 .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
390 .ForClause (&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
391 .WhereClause(new AExpression(&quot;$message.author-id /*+ indexnl */ = $user.id&quot;))
392 .ReturnClause({
393 &quot;uname&quot; : &quot;$user.name&quot;,
394 &quot;message&quot; : &quot;$message.message&quot;
395 });
396</pre></div></div>
397<div class="section">
398<h6>Results<a name="Results"></a></h6>
399
400<div class="source">
401<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; dislike iphone its touch-screen is horrible&quot; }
402{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; like verizon the 3G is awesome:)&quot; }
403{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand motorola the touch-screen is terrible&quot; }
404{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand at&amp;t the network is horrible:(&quot; }
405{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand at&amp;t its plan is terrible&quot; }
406{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like samsung the plan is amazing&quot; }
407{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like t-mobile its platform is mind-blowing&quot; }
408{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;message&quot;: &quot; love at&amp;t its 3G is good:)&quot; }
409{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; dislike iphone the voice-command is bad:(&quot; }
410{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; can't stand t-mobile its voicemail-service is OMG:(&quot; }
411{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love sprint its shortcut-menu is awesome:)&quot; }
412{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love verizon its wireless is good&quot; }
413{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;message&quot;: &quot; love sprint the customization is mind-blowing&quot; }
414{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;message&quot;: &quot; like iphone the voicemail-service is awesome&quot; }
415{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;message&quot;: &quot; dislike sprint the speed is horrible&quot; }
416</pre></div></div></div></div></div>
417<div class="section">
418<h3>Query 3 - Nested Outer Join<a name="Query_3_-_Nested_Outer_Join"></a></h3>
419<div class="section">
420<div class="section">
421<div class="section">
422<h6>AQL<a name="AQL"></a></h6>
423
424<div class="source">
425<pre>use dataverse TinySocial;
426
427for $user in dataset FacebookUsers
428return {
429 &quot;uname&quot;: $user.name,
430 &quot;messages&quot;: for $message in dataset FacebookMessages
431 where $message.author-id = $user.id
432 return $message.message
433};
434</pre></div></div>
435<div class="section">
436<h6>JS<a name="JS"></a></h6>
437
438<div class="source">
439<pre>var expression3messages = new FLWOGRExpression()
440 .ForClause(&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
441 .WhereClause(new AExpression(&quot;$message.author-id = $user.id&quot;))
442 .ReturnClause(&quot;$message.message&quot;);
443
444var expression3 = new FLWOGRExpression()
445 .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
446 .ReturnClause({
447 &quot;uname&quot;: &quot;$user.name&quot;,
448 &quot;messages&quot; : expression3messages
449 });
450</pre></div></div>
451<div class="section">
452<h6>Results<a name="Results"></a></h6>
453
454<div class="source">
455<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike iphone its touch-screen is horrible&quot;, &quot; like verizon the 3G is awesome:)&quot;, &quot; can't stand motorola the touch-screen is terrible&quot;, &quot; can't stand at&amp;t the network is horrible:(&quot;, &quot; can't stand at&amp;t its plan is terrible&quot; ]} }
456{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;messages&quot;: { orderedlist: [&quot; like samsung the plan is amazing&quot;, &quot; like t-mobile its platform is mind-blowing&quot; ]} }
457{ &quot;uname&quot;: &quot;NilaMilliron&quot;, &quot;messages&quot;: { orderedlist: [ ]} }
458{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;messages&quot;: { orderedlist: [&quot; love at&amp;t its 3G is good:)&quot; ]} }
459{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike iphone the voice-command is bad:(&quot;, &quot; can't stand t-mobile its voicemail-service is OMG:(&quot; ]} }
460{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;messages&quot;: { orderedlist: [&quot; love sprint its shortcut-menu is awesome:)&quot;, &quot; love verizon its wireless is good&quot; ]} }
461{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;messages&quot;: { orderedlist: [&quot; love sprint the customization is mind-blowing&quot; ]} }
462{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;messages&quot;: { orderedlist: [&quot; like iphone the voicemail-service is awesome&quot; ]} }
463{ &quot;uname&quot;: &quot;NicholasStroh&quot;, &quot;messages&quot;: { orderedlist: [ ]} }
464{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike sprint the speed is horrible&quot; ]} }
465</pre></div></div></div></div></div>
466<div class="section">
467<h3>Query 4 - Theta Join<a name="Query_4_-_Theta_Join"></a></h3>
468<div class="section">
469<div class="section">
470<div class="section">
471<h6>AQL<a name="AQL"></a></h6>
472
473<div class="source">
474<pre>use dataverse TinySocial;
475
476for $t in dataset TweetMessages
477return {
478 &quot;message&quot;: $t.message-text,
479 &quot;nearby-messages&quot;: for $t2 in dataset TweetMessages
480 where spatial-distance($t.sender-location, $t2.sender-location) &lt;= 1
481 return { &quot;msgtxt&quot;:$t2.message-text}
482};
483</pre></div></div>
484<div class="section">
485<h6>JS<a name="JS"></a></h6>
486
487<div class="source">
488<pre>var expression4messages = new FLWOGRExpression()
489 .ForClause( &quot;$t2&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
490 .WhereClause( new AExpression(&quot;spatial-distance($t.sender-location, $t2.sender-location) &lt;= 1&quot;))
491 .ReturnClause({ &quot;msgtxt&quot; : &quot;$t2.message-text&quot; });
492
493var expression4 = new FLWOGRExpression()
494 .ForClause( &quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
495 .ReturnClause({
496 &quot;message&quot; : &quot;$t.message-text&quot;,
497 &quot;nearby-messages&quot; : expression4messages
498 });
499</pre></div></div>
500<div class="section">
501<h6>Results<a name="Results"></a></h6>
502
503<div class="source">
504<pre>{ &quot;message&quot;: &quot; hate verizon its voice-clarity is OMG:(&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; hate verizon its voice-clarity is OMG:(&quot; }, { &quot;msgtxt&quot;: &quot; like motorola the speed is good:)&quot; } ]} }
505{ &quot;message&quot;: &quot; like iphone the voice-clarity is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like iphone the voice-clarity is good:)&quot; } ]} }
506{ &quot;message&quot;: &quot; like samsung the platform is good&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like samsung the platform is good&quot; } ]} }
507{ &quot;message&quot;: &quot; love t-mobile its customization is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; love t-mobile its customization is good:)&quot; } ]} }
508{ &quot;message&quot;: &quot; like samsung the voice-command is amazing:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like samsung the voice-command is amazing:)&quot; } ]} }
509{ &quot;message&quot;: &quot; like motorola the speed is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; hate verizon its voice-clarity is OMG:(&quot; }, { &quot;msgtxt&quot;: &quot; like motorola the speed is good:)&quot; } ]} }
510{ &quot;message&quot;: &quot; love verizon its voicemail-service is awesome&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; love verizon its voicemail-service is awesome&quot; } ]} }
511{ &quot;message&quot;: &quot; can't stand motorola its speed is terrible:(&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; can't stand motorola its speed is terrible:(&quot; } ]} }
512{ &quot;message&quot;: &quot; like t-mobile the shortcut-menu is awesome:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like t-mobile the shortcut-menu is awesome:)&quot; } ]} }
513{ &quot;message&quot;: &quot; can't stand iphone its platform is terrible&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; can't stand iphone its platform is terrible&quot; } ]} }
514{ &quot;message&quot;: &quot; like verizon its shortcut-menu is awesome:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like verizon its shortcut-menu is awesome:)&quot; } ]} }
515{ &quot;message&quot;: &quot; like sprint the voice-command is mind-blowing:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like sprint the voice-command is mind-blowing:)&quot; } ]} }
516</pre></div></div></div></div></div>
517<div class="section">
518<h3>Query 5 - Fuzzy Join<a name="Query_5_-_Fuzzy_Join"></a></h3>
519<div class="section">
520<div class="section">
521<div class="section">
522<h6>AQL<a name="AQL"></a></h6>
523<p>use dataverse TinySocial;</p>
524
525<div class="source">
526<pre>set simfunction &quot;edit-distance&quot;;
527set simthreshold &quot;3&quot;;
528
529for $fbu in dataset FacebookUsers
530return {
531 &quot;id&quot;: $fbu.id,
532 &quot;name&quot;: $fbu.name,
533 &quot;similar-users&quot;: for $t in dataset TweetMessages
534 let $tu := $t.user
535 where $tu.name ~= $fbu.name
536 return {
537 &quot;twitter-screenname&quot;: $tu.screen-name,
538 &quot;twitter-name&quot;: $tu.name
539 }
540};
541</pre></div></div>
542<div class="section">
543<h6>JS<a name="JS"></a></h6>
544
545<div class="source">
546<pre>var similarUsersExpression = new FLWOGRExpression()
547 .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
548 .LetClause (&quot;$tu&quot;, new AExpression(&quot;$t.user&quot;))
549 .WhereClause(new AExpression(&quot;$tu.name ~= $fbu.name&quot;))
550 .ReturnClause({
551 &quot;twitter-screenname&quot;: &quot;$tu.screen-name&quot;,
552 &quot;twitter-name&quot;: &quot;$tu.name&quot;
553 });
554
555var expression5 = new FLWOGRExpression()
556 .ForClause (&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
557 .ReturnClause(
558 {
559 &quot;id&quot; : &quot;$fbu.id&quot;,
560 &quot;name&quot; : &quot;$fbu.name&quot;,
561 &quot;similar-users&quot; : similarUsersExpression
562 }
563 );
564</pre></div></div>
565<div class="section">
566<h6>Results<a name="Results"></a></h6>
567
568<div class="source">
569<pre>{ &quot;id&quot;: { int32: 1 } , &quot;name&quot;: &quot;MargaritaStoddard&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
570{ &quot;id&quot;: { int32: 2 } , &quot;name&quot;: &quot;IsbelDull&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
571{ &quot;id&quot;: { int32: 8 } , &quot;name&quot;: &quot;NilaMilliron&quot;, &quot;similar-users&quot;: { orderedlist: [{ &quot;twitter-screenname&quot;: &quot;NilaMilliron_tw&quot;, &quot;twitter-name&quot;: &quot;Nila Milliron&quot; } ]} }
572{ &quot;id&quot;: { int32: 9 } , &quot;name&quot;: &quot;WoodrowNehling&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
573{ &quot;id&quot;: { int32: 10 } , &quot;name&quot;: &quot;BramHatch&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
574{ &quot;id&quot;: { int32: 3 } , &quot;name&quot;: &quot;EmoryUnk&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
575{ &quot;id&quot;: { int32: 6 } , &quot;name&quot;: &quot;WillisWynne&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
576{ &quot;id&quot;: { int32: 7 } , &quot;name&quot;: &quot;SuzannaTillson&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
577{ &quot;id&quot;: { int32: 4 } , &quot;name&quot;: &quot;NicholasStroh&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
578{ &quot;id&quot;: { int32: 5 } , &quot;name&quot;: &quot;VonKemble&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
579</pre></div></div></div></div></div>
580<div class="section">
581<h3>Query 6 - Existential Quantification<a name="Query_6_-_Existential_Quantification"></a></h3>
582<div class="section">
583<div class="section">
584<div class="section">
585<h6>AQL<a name="AQL"></a></h6>
586
587<div class="source">
588<pre>use dataverse TinySocial;
589
590for $fbu in dataset FacebookUsers
591where (some $e in $fbu.employment satisfies is-null($e.end-date))
592return $fbu;
593</pre></div></div>
594<div class="section">
595<h6>JS<a name="JS"></a></h6>
596
597<div class="source">
598<pre>var expression6 = new FLWOGRExpression()
599 .ForClause (&quot;$fbu&quot;, new AQLClause().set(&quot;dataset FacebookUsers&quot;))
600 .WhereClause(
601 new QuantifiedExpression (
602 &quot;some&quot; ,
603 {&quot;$e&quot; : new AExpression(&quot;$fbu.employment&quot;) },
604 new FunctionExpression(&quot;is-null&quot;, new AExpression(&quot;$e.end-date&quot;))
605 )
606 )
607 .ReturnClause(&quot;$fbu&quot;);
608</pre></div></div>
609<div class="section">
610<h6>Results<a name="Results"></a></h6>
611
612<div class="source">
613<pre>{ &quot;id&quot;: { int32: 1 } , &quot;alias&quot;: &quot;Margarita&quot;, &quot;name&quot;: &quot;MargaritaStoddard&quot;, &quot;user-since&quot;: { datetime: 1345457400000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 2 } , { int32: 3 } , { int32: 6 } , { int32: 10 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Codetechno&quot;, &quot;start-date&quot;: { date: 1154822400000}, &quot;end-date&quot;: null } ]} }
614{ &quot;id&quot;: { int32: 2 } , &quot;alias&quot;: &quot;Isbel&quot;, &quot;name&quot;: &quot;IsbelDull&quot;, &quot;user-since&quot;: { datetime: 1295691000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 4 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Hexviafind&quot;, &quot;start-date&quot;: { date: 1272326400000}, &quot;end-date&quot;: null } ]} }
615{ &quot;id&quot;: { int32: 8 } , &quot;alias&quot;: &quot;Nila&quot;, &quot;name&quot;: &quot;NilaMilliron&quot;, &quot;user-since&quot;: { datetime: 1199182200000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 3 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Plexlane&quot;, &quot;start-date&quot;: { date: 1267315200000}, &quot;end-date&quot;: null } ]} }
616{ &quot;id&quot;: { int32: 6 } , &quot;alias&quot;: &quot;Willis&quot;, &quot;name&quot;: &quot;WillisWynne&quot;, &quot;user-since&quot;: { datetime: 1105956600000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 3 } , { int32: 7 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;jaydax&quot;, &quot;start-date&quot;: { date: 1242345600000}, &quot;end-date&quot;: null } ]} }
617{ &quot;id&quot;: { int32: 7 } , &quot;alias&quot;: &quot;Suzanna&quot;, &quot;name&quot;: &quot;SuzannaTillson&quot;, &quot;user-since&quot;: { datetime: 1344334200000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 6 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Labzatron&quot;, &quot;start-date&quot;: { date: 1303171200000}, &quot;end-date&quot;: null } ]} }
618{ &quot;id&quot;: { int32: 4 } , &quot;alias&quot;: &quot;Nicholas&quot;, &quot;name&quot;: &quot;NicholasStroh&quot;, &quot;user-since&quot;: { datetime: 1293444600000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 2 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Zamcorporation&quot;, &quot;start-date&quot;: { date: 1275955200000}, &quot;end-date&quot;: null } ]} }
619{ &quot;id&quot;: { int32: 5 } , &quot;alias&quot;: &quot;Von&quot;, &quot;name&quot;: &quot;VonKemble&quot;, &quot;user-since&quot;: { datetime: 1262686200000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 3 } , { int32: 6 } , { int32: 10 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Kongreen&quot;, &quot;start-date&quot;: { date: 1290816000000}, &quot;end-date&quot;: null } ]} }
620</pre></div></div></div></div></div>
621<div class="section">
622<h3>Query 7 - Universal Quantification<a name="Query_7_-_Universal_Quantification"></a></h3>
623<div class="section">
624<div class="section">
625<div class="section">
626<h6>AQL<a name="AQL"></a></h6>
627
628<div class="source">
629<pre>use dataverse TinySocial;
630
631for $fbu in dataset FacebookUsers
632where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
633return $fbu;
634</pre></div></div>
635<div class="section">
636<h6>JS<a name="JS"></a></h6>
637
638<div class="source">
639<pre>var expression7 = new FLWOGRExpression()
640 .ForClause(&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
641 .WhereClause(
642 new QuantifiedExpression (
643 &quot;every&quot; ,
644 {&quot;$e&quot; : new AExpression(&quot;$fbu.employment&quot;) },
645 new FunctionExpression(&quot;not&quot;, new FunctionExpression(&quot;is-null&quot;, new AExpression(&quot;$e.end-date&quot;)))
646 )
647 )
648 .ReturnClause(&quot;$fbu&quot;);
649</pre></div></div>
650<div class="section">
651<h6>Results<a name="Results"></a></h6>
652
653<div class="source">
654<pre>{ &quot;id&quot;: { int32: 9 } , &quot;alias&quot;: &quot;Woodrow&quot;, &quot;name&quot;: &quot;WoodrowNehling&quot;, &quot;user-since&quot;: { datetime: 1127211000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 3 } , { int32: 10 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;Zuncan&quot;, &quot;start-date&quot;: { date: 1050969600000}, &quot;end-date&quot;: { date: 1260662400000} } ]} }
655{ &quot;id&quot;: { int32: 10 } , &quot;alias&quot;: &quot;Bram&quot;, &quot;name&quot;: &quot;BramHatch&quot;, &quot;user-since&quot;: { datetime: 1287223800000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 9 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;physcane&quot;, &quot;start-date&quot;: { date: 1181001600000}, &quot;end-date&quot;: { date: 1320451200000} } ]} }
656{ &quot;id&quot;: { int32: 3 } , &quot;alias&quot;: &quot;Emory&quot;, &quot;name&quot;: &quot;EmoryUnk&quot;, &quot;user-since&quot;: { datetime: 1341915000000}, &quot;friend-ids&quot;: { unorderedlist: [{ int32: 1 } , { int32: 5 } , { int32: 8 } , { int32: 9 } ]}, &quot;employment&quot;: { orderedlist: [{ &quot;organization-name&quot;: &quot;geomedia&quot;, &quot;start-date&quot;: { date: 1276732800000}, &quot;end-date&quot;: { date: 1264464000000} } ]} }
657</pre></div></div></div></div></div>
658<div class="section">
659<h3>Query 8 - Simple Aggregation<a name="Query_8_-_Simple_Aggregation"></a></h3>
660<div class="section">
661<div class="section">
662<div class="section">
663<h6>AQL<a name="AQL"></a></h6>
664
665<div class="source">
666<pre>use dataverse TinySocial;
667
668count(for $fbu in dataset FacebookUsers return $fbu);
669</pre></div></div>
670<div class="section">
671<h6>JS<a name="JS"></a></h6>
672
673<div class="source">
674<pre>var expression8 = new FunctionExpression(
675 &quot;count&quot;,
676 new FLWOGRExpression()
677 .ForClause(&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
678 .ReturnClause(&quot;$fbu&quot;)
679);
680</pre></div></div>
681<div class="section">
682<h6>Results<a name="Results"></a></h6>
683
684<div class="source">
685<pre>{ int64: 10 }
686</pre></div></div></div></div></div>
687<div class="section">
688<h3>Query 9-A - Grouping and Aggregation<a name="Query_9-A_-_Grouping_and_Aggregation"></a></h3>
689<div class="section">
690<div class="section">
691<div class="section">
692<h6>AQL<a name="AQL"></a></h6>
693
694<div class="source">
695<pre>use dataverse TinySocial;
696
697for $t in dataset TweetMessages
698group by $uid := $t.user.screen-name with $t
699return {
700 &quot;user&quot;: $uid,
701 &quot;count&quot;: count($t)
702};
703</pre></div></div>
704<div class="section">
705<h6>JS<a name="JS"></a></h6>
706
707<div class="source">
708<pre>var expression9a = new FLWOGRExpression()
709 .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
710 .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
711 .ReturnClause(
712 {
713 &quot;user&quot; : &quot;$uid&quot;,
714 &quot;count&quot; : new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;))
715 }
716 );
717</pre></div></div>
718<div class="section">
719<h6>Results<a name="Results"></a></h6>
720
721<div class="source">
722<pre>{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
723{ &quot;user&quot;: &quot;OliJackson_512&quot;, &quot;count&quot;: { int64: 1 } }
724{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
725{ &quot;user&quot;: &quot;ChangEwing_573&quot;, &quot;count&quot;: { int64: 1 } }
726{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
727</pre></div></div></div></div></div>
728<div class="section">
729<h3>Query 9-B - (Hash-Based) Grouping and Aggregation<a name="Query_9-B_-_Hash-Based_Grouping_and_Aggregation"></a></h3>
730<div class="section">
731<div class="section">
732<div class="section">
733<h6>AQL<a name="AQL"></a></h6>
734
735<div class="source">
736<pre>use dataverse TinySocial;
737
738for $t in dataset TweetMessages
739/*+ hash*/
740group by $uid := $t.user.screen-name with $t
741return {
742 &quot;user&quot;: $uid,
743 &quot;count&quot;: count($t)
744};
745</pre></div></div>
746<div class="section">
747<h6>JS<a name="JS"></a></h6>
748
749<div class="source">
750<pre>var expression9b = new FLWOGRExpression()
751 .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
752 .AQLClause(&quot;/*+ hash*/&quot;)
753 .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
754 .ReturnClause(
755 {
756 &quot;user&quot; : &quot;$uid&quot;,
757 &quot;count&quot; : new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;))
758 }
759 );
760</pre></div></div>
761<div class="section">
762<h6>Results<a name="Results"></a></h6>
763
764<div class="source">
765<pre>{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
766{ &quot;user&quot;: &quot;OliJackson_512&quot;, &quot;count&quot;: { int64: 1 } }
767{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
768{ &quot;user&quot;: &quot;ChangEwing_573&quot;, &quot;count&quot;: { int64: 1 } }
769{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
770</pre></div></div></div></div></div>
771<div class="section">
772<h3>Query 10 - Grouping and Limits<a name="Query_10_-_Grouping_and_Limits"></a></h3>
773<div class="section">
774<div class="section">
775<div class="section">
776<h6>AQL<a name="AQL"></a></h6>
777
778<div class="source">
779<pre>use dataverse TinySocial;
780
781for $t in dataset TweetMessages
782group by $uid := $t.user.screen-name with $t
783let $c := count($t)
784order by $c desc
785limit 3
786return {
787 &quot;user&quot;: $uid,
788 &quot;count&quot;: $c
789};
790</pre></div></div>
791<div class="section">
792<h6>JS<a name="JS"></a></h6>
793
794<div class="source">
795<pre>var expression10 = new FLWOGRExpression()
796 .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
797 .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
798 .LetClause(&quot;$c&quot;, new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;)))
799 .OrderbyClause( new AExpression(&quot;$c&quot;), &quot;desc&quot; )
800 .LimitClause(new AExpression(&quot;3&quot;))
801 .ReturnClause(
802 {
803 &quot;user&quot; : &quot;$uid&quot;,
804 &quot;count&quot; : &quot;$c&quot;
805 }
806 );
807</pre></div></div>
808<div class="section">
809<h6>Results<a name="Results"></a></h6>
810
811<div class="source">
812<pre>{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
813{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
814{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
815</pre></div></div></div></div></div>
816<div class="section">
817<h3>Query 11 - Left Outer Fuzzy Join<a name="Query_11_-_Left_Outer_Fuzzy_Join"></a></h3>
818<div class="section">
819<div class="section">
820<div class="section">
821<h6>AQL<a name="AQL"></a></h6>
822
823<div class="source">
824<pre>use dataverse TinySocial;
825
826set simfunction &quot;jaccard&quot;;
827set simthreshold &quot;0.3&quot;;
828
829for $t in dataset TweetMessages
830return {
831 &quot;tweet&quot;: $t,
832 &quot;similar-tweets&quot;: for $t2 in dataset TweetMessages
833 where $t2.referred-topics ~= $t.referred-topics
834 and $t2.tweetid != $t.tweetid
835 return $t2.referred-topics
836};
837</pre></div></div>
838<div class="section">
839<h6>JS<a name="JS"></a></h6>
840
841<div class="source">
842<pre>var expression11 = new FLWOGRExpression()
843 .ForClause( &quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
844 .ReturnClause({
845 &quot;tweet&quot; : new AExpression(&quot;$t&quot;),
846 &quot;similar-tweets&quot;: new FLWOGRExpression()
847 .ForClause( &quot;$t2&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
848 .WhereClause().and(
849 new AExpression(&quot;$t2.referred-topics ~= $t.referred-topics&quot;),
850 new AExpression(&quot;$t2.tweetid != $t.tweetid&quot;)
851 )
852 .ReturnClause(&quot;$t2.referred-topics&quot;)
853 });
854</pre></div></div>
855<div class="section">
856<h6>Results<a name="Results"></a></h6>
857
858<div class="source">
859<pre>{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;10&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;ColineGeyer@63&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 121 } , &quot;statuses_count&quot;: { int32: 362 } , &quot;name&quot;: &quot;Coline Geyer&quot;, &quot;followers_count&quot;: { int32: 17159 } }, &quot;sender-location&quot;: { point: [29.15, 76.53]}, &quot;send-time&quot;: { datetime: 1201342200000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;verizon&quot;, &quot;voice-clarity&quot; ]}, &quot;message-text&quot;: &quot; hate verizon its voice-clarity is OMG:(&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;iphone&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;verizon&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;verizon&quot;, &quot;voicemail-service&quot; ]} ]} }
860{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;6&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;ColineGeyer@63&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 121 } , &quot;statuses_count&quot;: { int32: 362 } , &quot;name&quot;: &quot;Coline Geyer&quot;, &quot;followers_count&quot;: { int32: 17159 } }, &quot;sender-location&quot;: { point: [47.51, 83.99]}, &quot;send-time&quot;: { datetime: 1273227000000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;iphone&quot;, &quot;voice-clarity&quot; ]}, &quot;message-text&quot;: &quot; like iphone the voice-clarity is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;verizon&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;iphone&quot;, &quot;platform&quot; ]} ]} }
861{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;7&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;ChangEwing_573&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 182 } , &quot;statuses_count&quot;: { int32: 394 } , &quot;name&quot;: &quot;Chang Ewing&quot;, &quot;followers_count&quot;: { int32: 32136 } }, &quot;sender-location&quot;: { point: [36.21, 72.6]}, &quot;send-time&quot;: { datetime: 1314267000000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;samsung&quot;, &quot;platform&quot; ]}, &quot;message-text&quot;: &quot; like samsung the platform is good&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;iphone&quot;, &quot;platform&quot; ]}, { unorderedlist: [&quot;samsung&quot;, &quot;voice-command&quot; ]} ]} }
862{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;1&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [47.44, 80.65]}, &quot;send-time&quot;: { datetime: 1209204600000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;t-mobile&quot;, &quot;customization&quot; ]}, &quot;message-text&quot;: &quot; love t-mobile its customization is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;t-mobile&quot;, &quot;shortcut-menu&quot; ]} ]} }
863{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;12&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;OliJackson_512&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 445 } , &quot;statuses_count&quot;: { int32: 164 } , &quot;name&quot;: &quot;Oli Jackson&quot;, &quot;followers_count&quot;: { int32: 22649 } }, &quot;sender-location&quot;: { point: [24.82, 94.63]}, &quot;send-time&quot;: { datetime: 1266055800000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;samsung&quot;, &quot;voice-command&quot; ]}, &quot;message-text&quot;: &quot; like samsung the voice-command is amazing:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;samsung&quot;, &quot;platform&quot; ]}, { unorderedlist: [&quot;sprint&quot;, &quot;voice-command&quot; ]} ]} }
864{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;3&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [29.72, 75.8]}, &quot;send-time&quot;: { datetime: 1162635000000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;motorola&quot;, &quot;speed&quot; ]}, &quot;message-text&quot;: &quot; like motorola the speed is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;motorola&quot;, &quot;speed&quot; ]} ]} }
865{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;9&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [36.86, 74.62]}, &quot;send-time&quot;: { datetime: 1342865400000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;verizon&quot;, &quot;voicemail-service&quot; ]}, &quot;message-text&quot;: &quot; love verizon its voicemail-service is awesome&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;verizon&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;verizon&quot;, &quot;shortcut-menu&quot; ]} ]} }
866{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;5&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [40.09, 92.69]}, &quot;send-time&quot;: { datetime: 1154686200000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;motorola&quot;, &quot;speed&quot; ]}, &quot;message-text&quot;: &quot; can't stand motorola its speed is terrible:(&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;motorola&quot;, &quot;speed&quot; ]} ]} }
867{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;8&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [46.05, 93.34]}, &quot;send-time&quot;: { datetime: 1129284600000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;t-mobile&quot;, &quot;shortcut-menu&quot; ]}, &quot;message-text&quot;: &quot; like t-mobile the shortcut-menu is awesome:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;verizon&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;t-mobile&quot;, &quot;customization&quot; ]} ]} }
868{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;11&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NilaMilliron_tw&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 445 } , &quot;statuses_count&quot;: { int32: 164 } , &quot;name&quot;: &quot;Nila Milliron&quot;, &quot;followers_count&quot;: { int32: 22649 } }, &quot;sender-location&quot;: { point: [37.59, 68.42]}, &quot;send-time&quot;: { datetime: 1205057400000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;iphone&quot;, &quot;platform&quot; ]}, &quot;message-text&quot;: &quot; can't stand iphone its platform is terrible&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;iphone&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;samsung&quot;, &quot;platform&quot; ]} ]} }
869{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;2&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;ColineGeyer@63&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 121 } , &quot;statuses_count&quot;: { int32: 362 } , &quot;name&quot;: &quot;Coline Geyer&quot;, &quot;followers_count&quot;: { int32: 17159 } }, &quot;sender-location&quot;: { point: [32.84, 67.14]}, &quot;send-time&quot;: { datetime: 1273745400000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;verizon&quot;, &quot;shortcut-menu&quot; ]}, &quot;message-text&quot;: &quot; like verizon its shortcut-menu is awesome:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;t-mobile&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;verizon&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;verizon&quot;, &quot;voicemail-service&quot; ]} ]} }
870{ &quot;tweet&quot;: { &quot;tweetid&quot;: &quot;4&quot;, &quot;user&quot;: { &quot;screen-name&quot;: &quot;NathanGiesen@211&quot;, &quot;lang&quot;: &quot;en&quot;, &quot;friends_count&quot;: { int32: 39339 } , &quot;statuses_count&quot;: { int32: 473 } , &quot;name&quot;: &quot;Nathan Giesen&quot;, &quot;followers_count&quot;: { int32: 49416 } }, &quot;sender-location&quot;: { point: [39.28, 70.48]}, &quot;send-time&quot;: { datetime: 1324894200000}, &quot;referred-topics&quot;: { unorderedlist: [&quot;sprint&quot;, &quot;voice-command&quot; ]}, &quot;message-text&quot;: &quot; like sprint the voice-command is mind-blowing:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;samsung&quot;, &quot;voice-command&quot; ]} ]} }
871</pre></div></div></div></div></div></div>
872 </div>
873 </div>
874 </div>
875
876 <hr/>
877
878 <footer>
879 <div class="container-fluid">
880 <div class="row span12">Copyright &copy; 2015.
881 All Rights Reserved.
882
883 </div>
884
885 <?xml version="1.0" encoding="UTF-8"?>
886<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
887 feather logo, and the Apache AsterixDB project logo are either
888 registered trademarks or trademarks of The Apache Software
889 Foundation in the United States and other countries.
890 All other marks mentioned may be trademarks or registered
891 trademarks of their respective owners.</div>
892
893
894 </div>
895 </footer>
896 </body>
897</html>