You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ti...@apache.org on 2018/02/10 17:05:45 UTC

[15/35] asterixdb-site git commit: Add 0.9.3 docs

http://git-wip-us.apache.org/repos/asf/asterixdb-site/blob/9c40a66d/docs/0.9.3/aql/js-sdk.html
----------------------------------------------------------------------
diff --git a/docs/0.9.3/aql/js-sdk.html b/docs/0.9.3/aql/js-sdk.html
new file mode 100644
index 0000000..cc92416
--- /dev/null
+++ b/docs/0.9.3/aql/js-sdk.html
@@ -0,0 +1,1001 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2018-02-09
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20180209" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>AsterixDB &#x2013; AsterixDB Javascript SDK</title>
+    <link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
+    <link rel="stylesheet" href="../css/site.css" />
+    <link rel="stylesheet" href="../css/print.css" media="print" />
+
+      
+    <script type="text/javascript" src="../js/apache-maven-fluido-1.3.0.min.js"></script>
+
+                          
+        
+<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+        ga('create', 'UA-41536543-1', 'uci.edu');
+        ga('send', 'pageview');</script>
+          
+            </head>
+        <body class="topBarDisabled">
+          
+                
+                    
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                                  <a href=".././" id="bannerLeft">
+                                                                                                <img src="../images/asterixlogo.png"  alt="AsterixDB"/>
+                </a>
+                      </div>
+        <div class="pull-right">  </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                  <li id="publishDate">Last Published: 2018-02-09</li>
+                      
+                
+                    
+                 <li id="projectVersion" class="pull-right">Version: 0.9.3</li>
+      
+                                            <li class="divider pull-right">|</li>
+                        
+    <li class="pull-right">              <a href="../index.html" title="Documentation Home">
+        Documentation Home</a>
+  </li>
+
+                        </ul>
+      </div>
+
+            
+      <div class="row-fluid">
+        <div id="leftColumn" class="span3">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Get Started - Installation</li>
+                                
+      <li>
+    
+                          <a href="../ncservice.html" title="Option 1: using NCService">
+          <i class="none"></i>
+        Option 1: using NCService</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../ansible.html" title="Option 2: using Ansible">
+          <i class="none"></i>
+        Option 2: using Ansible</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aws.html" title="Option 3: using Amazon Web Services">
+          <i class="none"></i>
+        Option 3: using Amazon Web Services</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../yarn.html" title="Option 4: using YARN">
+          <i class="none"></i>
+        Option 4: using YARN</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../install.html" title="Option 5: using Managix (deprecated)">
+          <i class="none"></i>
+        Option 5: using Managix (deprecated)</a>
+            </li>
+                              <li class="nav-header">AsterixDB Primer</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/primer-sqlpp.html" title="Option 1: using SQL++">
+          <i class="none"></i>
+        Option 1: using SQL++</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/primer.html" title="Option 2: using AQL">
+          <i class="none"></i>
+        Option 2: using AQL</a>
+            </li>
+                              <li class="nav-header">Data Model</li>
+                                
+      <li>
+    
+                          <a href="../datamodel.html" title="The Asterix Data Model">
+          <i class="none"></i>
+        The Asterix Data Model</a>
+            </li>
+                              <li class="nav-header">Queries - SQL++</li>
+                                
+      <li>
+    
+                          <a href="../sqlpp/manual.html" title="The SQL++ Query Language">
+          <i class="none"></i>
+        The SQL++ Query Language</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../sqlpp/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">Queries - AQL</li>
+                                
+      <li>
+    
+                          <a href="../aql/manual.html" title="The Asterix Query Language (AQL)">
+          <i class="none"></i>
+        The Asterix Query Language (AQL)</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/builtins.html" title="Builtin Functions">
+          <i class="none"></i>
+        Builtin Functions</a>
+            </li>
+                              <li class="nav-header">API/SDK</li>
+                                
+      <li>
+    
+                          <a href="../api.html" title="HTTP API">
+          <i class="none"></i>
+        HTTP API</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../csv.html" title="CSV Output">
+          <i class="none"></i>
+        CSV Output</a>
+            </li>
+                              <li class="nav-header">Advanced Features</li>
+                                
+      <li>
+    
+                          <a href="../aql/fulltext.html" title="Support of Full-text Queries">
+          <i class="none"></i>
+        Support of Full-text Queries</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/externaldata.html" title="Accessing External Data">
+          <i class="none"></i>
+        Accessing External Data</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../feeds/tutorial.html" title="Support for Data Ingestion">
+          <i class="none"></i>
+        Support for Data Ingestion</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../udf.html" title="User Defined Functions">
+          <i class="none"></i>
+        User Defined Functions</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/filters.html" title="Filter-Based LSM Index Acceleration">
+          <i class="none"></i>
+        Filter-Based LSM Index Acceleration</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="../aql/similarity.html" title="Support of Similarity Queries">
+          <i class="none"></i>
+        Support of Similarity Queries</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                                                                                                                         <a href=".././" title="AsterixDB" class="builtBy">
+        <img class="builtBy"  alt="AsterixDB" src="../images/asterixlogo.png"    />
+      </a>
+                      </div>
+          </div>
+        </div>
+        
+                
+        <div id="bodyColumn"  class="span9" >
+                                  
+            <!-- ! Licensed to the Apache Software Foundation (ASF) under one
+ ! or more contributor license agreements.  See the NOTICE file
+ ! distributed with this work for additional information
+ ! regarding copyright ownership.  The ASF licenses this file
+ ! to you under the Apache License, Version 2.0 (the
+ ! "License"); you may not use this file except in compliance
+ ! with the License.  You may obtain a copy of the License at
+ !
+ !   http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing,
+ ! software distributed under the License is distributed on an
+ ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ! KIND, either express or implied.  See the License for the
+ ! specific language governing permissions and limitations
+ ! under the License.
+ ! --><h1>AsterixDB Javascript SDK</h1>
+<div class="section">
+<h2><a name="Obtaining_and_Including"></a>Obtaining and Including</h2>
+<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>
+
+<div class="source">
+<div class="source">
+<pre>&lt;script src=&quot;path/to/asterix-sdk-stable.js&quot;&gt;&lt;/script&gt;
+</pre></div></div></div>
+<div class="section">
+<h2><a name="Interactive_Demos"></a>Interactive Demos</h2>
+<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>
+
+<ul>
+  
+<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>
+  
+<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>
+</ul></div>
+<div class="section">
+<h2><a name="The_javascript_SDK:_by_example"></a>The javascript SDK: by example</h2>
+<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>
+<div class="section">
+<h3><a name="Query_0-A_-_Exact-Match_Lookup"></a>Query 0-A - Exact-Match Lookup</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id = 8
+return $user;
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression0a = new FLWOGRExpression()
+    .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .WhereClause(new AExpression(&quot;$user.id = 8&quot;))
+    .ReturnClause(&quot;$user&quot;);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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 } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_0-B_-_Range_Scan"></a>Query 0-B - Range Scan</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id &gt;= 2 and $user.id &lt;= 4
+return $user;
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression0b = new FLWOGRExpression()
+    .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .WhereClause().and(new AExpression(&quot;$user.id &gt;= 2&quot;), new AExpression(&quot;$user.id &lt;= 4&quot;))
+    .ReturnClause(&quot;$user&quot;);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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 } ]} }
+{ &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} } ]} }
+{ &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 } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_1_-_Other_Query_Filters"></a>Query 1 - Other Query Filters</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.user-since &gt;= datetime('2010-07-22T00:00:00')
+and $user.user-since &lt;= datetime('2012-07-29T23:59:59')
+return $user;
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression1 = new FLWOGRExpression()
+    .ForClause(&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .WhereClause().and(
+       new AExpression(&quot;$user.user-since &gt;= datetime('2010-07-22T00:00:00')&quot;),
+       new AExpression(&quot;$user.user-since &lt;= datetime('2012-07-29T23:59:59')&quot;)
+    ).ReturnClause(&quot;$user&quot;);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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 } ]} }
+{ &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} } ]} }
+{ &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} } ]} }
+{ &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 } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_2-A_-_Equijoin"></a>Query 2-A - Equijoin</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id = $user.id
+return {
+    &quot;uname&quot;: $user.name,
+    &quot;message&quot;: $message.message
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression2a = new FLWOGRExpression()
+    .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .ForClause (&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
+    .WhereClause(new AExpression(&quot;$message.author-id = $user.id&quot;))
+    .ReturnClause({
+       &quot;uname&quot; : &quot;$user.name&quot;,
+       &quot;message&quot; : &quot;$message.message&quot;
+    });
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; dislike x-phone its touch-screen is horrible&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; like ccast the 3G is awesome:)&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand product-w the touch-screen is terrible&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand acast the network is horrible:(&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand acast its plan is terrible&quot; }
+{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like product-y the plan is amazing&quot; }
+{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like product-z its platform is mind-blowing&quot; }
+{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;message&quot;: &quot; love acast its 3G is good:)&quot; }
+{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; dislike x-phone the voice-command is bad:(&quot; }
+{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; can't stand product-z its voicemail-service is OMG:(&quot; }
+{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love product-b its shortcut-menu is awesome:)&quot; }
+{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love ccast its wireless is good&quot; }
+{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;message&quot;: &quot; love product-b the customization is mind-blowing&quot; }
+{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;message&quot;: &quot; like x-phone the voicemail-service is awesome&quot; }
+{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;message&quot;: &quot; dislike product-b the speed is horrible&quot; }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_2-B_-_Index_join"></a>Query 2-B - Index join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+for $message in dataset FacebookMessages
+where $message.author-id /*+ indexnl */  = $user.id
+return {
+    &quot;uname&quot;: $user.name,
+    &quot;message&quot;: $message.message
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression2b = new FLWOGRExpression()
+    .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .ForClause (&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
+    .WhereClause(new AExpression(&quot;$message.author-id /*+ indexnl */  = $user.id&quot;))
+    .ReturnClause({
+       &quot;uname&quot; : &quot;$user.name&quot;,
+       &quot;message&quot; : &quot;$message.message&quot;
+    });
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; dislike x-phone its touch-screen is horrible&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; like ccast the 3G is awesome:)&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand product-w the touch-screen is terrible&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand acast the network is horrible:(&quot; }
+{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;message&quot;: &quot; can't stand acast its plan is terrible&quot; }
+{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like product-y the plan is amazing&quot; }
+{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;message&quot;: &quot; like product-z its platform is mind-blowing&quot; }
+{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;message&quot;: &quot; love acast its 3G is good:)&quot; }
+{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; dislike x-phone the voice-command is bad:(&quot; }
+{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;message&quot;: &quot; can't stand product-z its voicemail-service is OMG:(&quot; }
+{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love product-b its shortcut-menu is awesome:)&quot; }
+{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;message&quot;: &quot; love ccast its wireless is good&quot; }
+{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;message&quot;: &quot; love product-b the customization is mind-blowing&quot; }
+{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;message&quot;: &quot; like x-phone the voicemail-service is awesome&quot; }
+{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;message&quot;: &quot; dislike product-b the speed is horrible&quot; }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_3_-_Nested_Outer_Join"></a>Query 3 - Nested Outer Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+return {
+    &quot;uname&quot;: $user.name,
+    &quot;messages&quot;: for $message in dataset FacebookMessages
+                where $message.author-id = $user.id
+                return $message.message
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression3messages = new FLWOGRExpression()
+    .ForClause(&quot;$message&quot;, new AExpression(&quot;dataset FacebookMessages&quot;))
+    .WhereClause(new AExpression(&quot;$message.author-id = $user.id&quot;))
+    .ReturnClause(&quot;$message.message&quot;);
+
+var expression3 = new FLWOGRExpression()
+    .ForClause (&quot;$user&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .ReturnClause({
+        &quot;uname&quot;: &quot;$user.name&quot;,
+        &quot;messages&quot; : expression3messages
+    });
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;uname&quot;: &quot;MargaritaStoddard&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike x-phone its touch-screen is horrible&quot;, &quot; like ccast the 3G is awesome:)&quot;, &quot; can't stand product-w the touch-screen is terrible&quot;, &quot; can't stand acast the network is horrible:(&quot;, &quot; can't stand acast its plan is terrible&quot; ]} }
+{ &quot;uname&quot;: &quot;IsbelDull&quot;, &quot;messages&quot;: { orderedlist: [&quot; like product-y the plan is amazing&quot;, &quot; like product-z its platform is mind-blowing&quot; ]} }
+{ &quot;uname&quot;: &quot;NilaMilliron&quot;, &quot;messages&quot;: { orderedlist: [ ]} }
+{ &quot;uname&quot;: &quot;WoodrowNehling&quot;, &quot;messages&quot;: { orderedlist: [&quot; love acast its 3G is good:)&quot; ]} }
+{ &quot;uname&quot;: &quot;BramHatch&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike x-phone the voice-command is bad:(&quot;, &quot; can't stand product-z its voicemail-service is OMG:(&quot; ]} }
+{ &quot;uname&quot;: &quot;EmoryUnk&quot;, &quot;messages&quot;: { orderedlist: [&quot; love product-b its shortcut-menu is awesome:)&quot;, &quot; love ccast its wireless is good&quot; ]} }
+{ &quot;uname&quot;: &quot;WillisWynne&quot;, &quot;messages&quot;: { orderedlist: [&quot; love product-b the customization is mind-blowing&quot; ]} }
+{ &quot;uname&quot;: &quot;SuzannaTillson&quot;, &quot;messages&quot;: { orderedlist: [&quot; like x-phone the voicemail-service is awesome&quot; ]} }
+{ &quot;uname&quot;: &quot;NicholasStroh&quot;, &quot;messages&quot;: { orderedlist: [ ]} }
+{ &quot;uname&quot;: &quot;VonKemble&quot;, &quot;messages&quot;: { orderedlist: [&quot; dislike product-b the speed is horrible&quot; ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_4_-_Theta_Join"></a>Query 4 - Theta Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+return {
+    &quot;message&quot;: $t.message-text,
+    &quot;nearby-messages&quot;: for $t2 in dataset TweetMessages
+                       where spatial-distance($t.sender-location, $t2.sender-location) &lt;= 1
+                       return { &quot;msgtxt&quot;:$t2.message-text}
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression4messages = new FLWOGRExpression()
+    .ForClause( &quot;$t2&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .WhereClause( new AExpression(&quot;spatial-distance($t.sender-location, $t2.sender-location) &lt;= 1&quot;))
+    .ReturnClause({ &quot;msgtxt&quot; : &quot;$t2.message-text&quot; });
+
+var expression4 = new FLWOGRExpression()
+    .ForClause( &quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .ReturnClause({
+        &quot;message&quot; : &quot;$t.message-text&quot;,
+        &quot;nearby-messages&quot; : expression4messages
+    });
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;message&quot;: &quot; hate ccast its voice-clarity is OMG:(&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; hate ccast its voice-clarity is OMG:(&quot; }, { &quot;msgtxt&quot;: &quot; like product-w the speed is good:)&quot; } ]} }
+{ &quot;message&quot;: &quot; like x-phone the voice-clarity is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like x-phone the voice-clarity is good:)&quot; } ]} }
+{ &quot;message&quot;: &quot; like product-y the platform is good&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like product-y the platform is good&quot; } ]} }
+{ &quot;message&quot;: &quot; love product-z its customization is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; love product-z its customization is good:)&quot; } ]} }
+{ &quot;message&quot;: &quot; like product-y the voice-command is amazing:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like product-y the voice-command is amazing:)&quot; } ]} }
+{ &quot;message&quot;: &quot; like product-w the speed is good:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; hate ccast its voice-clarity is OMG:(&quot; }, { &quot;msgtxt&quot;: &quot; like product-w the speed is good:)&quot; } ]} }
+{ &quot;message&quot;: &quot; love ccast its voicemail-service is awesome&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; love ccast its voicemail-service is awesome&quot; } ]} }
+{ &quot;message&quot;: &quot; can't stand product-w its speed is terrible:(&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; can't stand product-w its speed is terrible:(&quot; } ]} }
+{ &quot;message&quot;: &quot; like product-z the shortcut-menu is awesome:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like product-z the shortcut-menu is awesome:)&quot; } ]} }
+{ &quot;message&quot;: &quot; can't stand x-phone its platform is terrible&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; can't stand x-phone its platform is terrible&quot; } ]} }
+{ &quot;message&quot;: &quot; like ccast its shortcut-menu is awesome:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like ccast its shortcut-menu is awesome:)&quot; } ]} }
+{ &quot;message&quot;: &quot; like product-b the voice-command is mind-blowing:)&quot;, &quot;nearby-messages&quot;: { orderedlist: [{ &quot;msgtxt&quot;: &quot; like product-b the voice-command is mind-blowing:)&quot; } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_5_-_Fuzzy_Join"></a>Query 5 - Fuzzy Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+<p>use dataverse TinySocial;</p>
+
+<div class="source">
+<div class="source">
+<pre>set simfunction &quot;edit-distance&quot;;
+set simthreshold &quot;3&quot;;
+
+for $fbu in dataset FacebookUsers
+return {
+    &quot;id&quot;: $fbu.id,
+    &quot;name&quot;: $fbu.name,
+    &quot;similar-users&quot;: for $t in dataset TweetMessages
+                     let $tu := $t.user
+                     where $tu.name ~= $fbu.name
+                    return {
+                        &quot;twitter-screenname&quot;: $tu.screen-name,
+                        &quot;twitter-name&quot;: $tu.name
+                    }
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var similarUsersExpression = new FLWOGRExpression()
+    .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .LetClause (&quot;$tu&quot;, new AExpression(&quot;$t.user&quot;))
+    .WhereClause(new AExpression(&quot;$tu.name ~= $fbu.name&quot;))
+    .ReturnClause({
+        &quot;twitter-screenname&quot;: &quot;$tu.screen-name&quot;,
+        &quot;twitter-name&quot;: &quot;$tu.name&quot;
+    });
+
+var expression5 = new FLWOGRExpression()
+    .ForClause (&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .ReturnClause(
+        {
+            &quot;id&quot; : &quot;$fbu.id&quot;,
+            &quot;name&quot; : &quot;$fbu.name&quot;,
+            &quot;similar-users&quot; : similarUsersExpression
+        }
+    );
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;id&quot;: { int32: 1 } , &quot;name&quot;: &quot;MargaritaStoddard&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 2 } , &quot;name&quot;: &quot;IsbelDull&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &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; } ]} }
+{ &quot;id&quot;: { int32: 9 } , &quot;name&quot;: &quot;WoodrowNehling&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 10 } , &quot;name&quot;: &quot;BramHatch&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 3 } , &quot;name&quot;: &quot;EmoryUnk&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 6 } , &quot;name&quot;: &quot;WillisWynne&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 7 } , &quot;name&quot;: &quot;SuzannaTillson&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 4 } , &quot;name&quot;: &quot;NicholasStroh&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+{ &quot;id&quot;: { int32: 5 } , &quot;name&quot;: &quot;VonKemble&quot;, &quot;similar-users&quot;: { orderedlist: [ ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_6_-_Existential_Quantification"></a>Query 6 - Existential Quantification</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $fbu in dataset FacebookUsers
+where (some $e in $fbu.employment satisfies is-null($e.end-date))
+return $fbu;
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression6 = new FLWOGRExpression()
+    .ForClause (&quot;$fbu&quot;, new AQLClause().set(&quot;dataset FacebookUsers&quot;))
+    .WhereClause(
+        new QuantifiedExpression (
+            &quot;some&quot; ,
+            {&quot;$e&quot; : new AExpression(&quot;$fbu.employment&quot;) },
+            new FunctionExpression(&quot;is-null&quot;, new AExpression(&quot;$e.end-date&quot;))
+        )
+    )
+    .ReturnClause(&quot;$fbu&quot;);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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 } ]} }
+{ &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 } ]} }
+{ &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 } ]} }
+{ &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 } ]} }
+{ &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 } ]} }
+{ &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 } ]} }
+{ &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 } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_7_-_Universal_Quantification"></a>Query 7 - Universal Quantification</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $fbu in dataset FacebookUsers
+where (every $e in $fbu.employment satisfies not(is-null($e.end-date)))
+return $fbu;
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression7 = new FLWOGRExpression()
+    .ForClause(&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+    .WhereClause(
+        new QuantifiedExpression (
+            &quot;every&quot; ,
+            {&quot;$e&quot; : new AExpression(&quot;$fbu.employment&quot;) },
+            new FunctionExpression(&quot;not&quot;, new FunctionExpression(&quot;is-null&quot;, new AExpression(&quot;$e.end-date&quot;)))
+        )
+    )
+    .ReturnClause(&quot;$fbu&quot;);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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} } ]} }
+{ &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} } ]} }
+{ &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} } ]} }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_8_-_Simple_Aggregation"></a>Query 8 - Simple Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+count(for $fbu in dataset FacebookUsers return $fbu);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression8 = new FunctionExpression(
+    &quot;count&quot;,
+    new FLWOGRExpression()
+        .ForClause(&quot;$fbu&quot;, new AExpression(&quot;dataset FacebookUsers&quot;))
+        .ReturnClause(&quot;$fbu&quot;)
+);
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ int64: 10 }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_9-A_-_Grouping_and_Aggregation"></a>Query 9-A - Grouping and Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+return {
+    &quot;user&quot;: $uid,
+    &quot;count&quot;: count($t)
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression9a = new FLWOGRExpression()
+    .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
+    .ReturnClause(
+        {
+            &quot;user&quot; : &quot;$uid&quot;,
+            &quot;count&quot; : new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;))
+        }
+    );
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
+{ &quot;user&quot;: &quot;OliJackson_512&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;ChangEwing_573&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_9-B_-_Hash-Based_Grouping_and_Aggregation"></a>Query 9-B - (Hash-Based) Grouping and Aggregation</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+/*+ hash*/
+group by $uid := $t.user.screen-name with $t
+return {
+    &quot;user&quot;: $uid,
+    &quot;count&quot;: count($t)
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression9b = new FLWOGRExpression()
+    .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .AQLClause(&quot;/*+ hash*/&quot;)
+    .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
+    .ReturnClause(
+        {
+            &quot;user&quot; : &quot;$uid&quot;,
+            &quot;count&quot; : new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;))
+        }
+    );
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
+{ &quot;user&quot;: &quot;OliJackson_512&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;ChangEwing_573&quot;, &quot;count&quot;: { int64: 1 } }
+{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_10_-_Grouping_and_Limits"></a>Query 10 - Grouping and Limits</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+for $t in dataset TweetMessages
+group by $uid := $t.user.screen-name with $t
+let $c := count($t)
+order by $c desc
+limit 3
+return {
+    &quot;user&quot;: $uid,
+    &quot;count&quot;: $c
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression10 = new FLWOGRExpression()
+    .ForClause(&quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .GroupClause(&quot;$uid&quot;, new AExpression(&quot;$t.user.screen-name&quot;), &quot;with&quot;, &quot;$t&quot;)
+    .LetClause(&quot;$c&quot;, new FunctionExpression(&quot;count&quot;, new AExpression(&quot;$t&quot;)))
+    .OrderbyClause( new AExpression(&quot;$c&quot;), &quot;desc&quot; )
+    .LimitClause(new AExpression(&quot;3&quot;))
+    .ReturnClause(
+        {
+            &quot;user&quot; : &quot;$uid&quot;,
+            &quot;count&quot; : &quot;$c&quot;
+        }
+    );
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<pre>{ &quot;user&quot;: &quot;NathanGiesen@211&quot;, &quot;count&quot;: { int64: 6 } }
+{ &quot;user&quot;: &quot;ColineGeyer@63&quot;, &quot;count&quot;: { int64: 3 } }
+{ &quot;user&quot;: &quot;NilaMilliron_tw&quot;, &quot;count&quot;: { int64: 1 } }
+</pre></div></div></div></div></div></div>
+<div class="section">
+<h3><a name="Query_11_-_Left_Outer_Fuzzy_Join"></a>Query 11 - Left Outer Fuzzy Join</h3>
+<div class="section">
+<div class="section">
+<div class="section">
+<h6><a name="AQL"></a>AQL</h6>
+
+<div class="source">
+<div class="source">
+<pre>use dataverse TinySocial;
+
+set simfunction &quot;jaccard&quot;;
+set simthreshold &quot;0.3&quot;;
+
+for $t in dataset TweetMessages
+return {
+    &quot;tweet&quot;: $t,
+    &quot;similar-tweets&quot;: for $t2 in dataset TweetMessages
+    where  $t2.referred-topics ~= $t.referred-topics
+    and $t2.tweetid != $t.tweetid
+    return $t2.referred-topics
+};
+</pre></div></div></div>
+<div class="section">
+<h6><a name="JS"></a>JS</h6>
+
+<div class="source">
+<div class="source">
+<pre>var expression11 = new FLWOGRExpression()
+    .ForClause( &quot;$t&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+    .ReturnClause({
+        &quot;tweet&quot;         : new AExpression(&quot;$t&quot;),
+        &quot;similar-tweets&quot;: new FLWOGRExpression()
+                            .ForClause( &quot;$t2&quot;, new AExpression(&quot;dataset TweetMessages&quot;))
+                            .WhereClause().and(
+                                new AExpression(&quot;$t2.referred-topics ~= $t.referred-topics&quot;),
+                                new AExpression(&quot;$t2.tweetid != $t.tweetid&quot;)
+                             )
+                            .ReturnClause(&quot;$t2.referred-topics&quot;)
+    });
+</pre></div></div></div>
+<div class="section">
+<h6><a name="Results"></a>Results</h6>
+
+<div class="source">
+<div class="source">
+<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;ccast&quot;, &quot;voice-clarity&quot; ]}, &quot;message-text&quot;: &quot; hate ccast its voice-clarity is OMG:(&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;x-phone&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;ccast&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;ccast&quot;, &quot;voicemail-service&quot; ]} ]} }
+{ &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;x-phone&quot;, &quot;voice-clarity&quot; ]}, &quot;message-text&quot;: &quot; like x-phone the voice-clarity is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;ccast&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;x-phone&quot;, &quot;platform&quot; ]} ]} }
+{ &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;product-y&quot;, &quot;platform&quot; ]}, &quot;message-text&quot;: &quot; like product-y the platform is good&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;x-phone&quot;, &quot;platform&quot; ]}, { unorderedlist: [&quot;product-y&quot;, &quot;voice-command&quot; ]} ]} }
+{ &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;product-z&quot;, &quot;customization&quot; ]}, &quot;message-text&quot;: &quot; love product-z its customization is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-z&quot;, &quot;shortcut-menu&quot; ]} ]} }
+{ &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;product-y&quot;, &quot;voice-command&quot; ]}, &quot;message-text&quot;: &quot; like product-y the voice-command is amazing:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-y&quot;, &quot;platform&quot; ]}, { unorderedlist: [&quot;product-b&quot;, &quot;voice-command&quot; ]} ]} }
+{ &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;product-w&quot;, &quot;speed&quot; ]}, &quot;message-text&quot;: &quot; like product-w the speed is good:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-w&quot;, &quot;speed&quot; ]} ]} }
+{ &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;ccast&quot;, &quot;voicemail-service&quot; ]}, &quot;message-text&quot;: &quot; love ccast its voicemail-service is awesome&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;ccast&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;ccast&quot;, &quot;shortcut-menu&quot; ]} ]} }
+{ &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;product-w&quot;, &quot;speed&quot; ]}, &quot;message-text&quot;: &quot; can't stand product-w its speed is terrible:(&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-w&quot;, &quot;speed&quot; ]} ]} }
+{ &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;product-z&quot;, &quot;shortcut-menu&quot; ]}, &quot;message-text&quot;: &quot; like product-z the shortcut-menu is awesome:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;ccast&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;product-z&quot;, &quot;customization&quot; ]} ]} }
+{ &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;x-phone&quot;, &quot;platform&quot; ]}, &quot;message-text&quot;: &quot; can't stand x-phone its platform is terrible&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;x-phone&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;product-y&quot;, &quot;platform&quot; ]} ]} }
+{ &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;ccast&quot;, &quot;shortcut-menu&quot; ]}, &quot;message-text&quot;: &quot; like ccast its shortcut-menu is awesome:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-z&quot;, &quot;shortcut-menu&quot; ]}, { unorderedlist: [&quot;ccast&quot;, &quot;voice-clarity&quot; ]}, { unorderedlist: [&quot;ccast&quot;, &quot;voicemail-service&quot; ]} ]} }
+{ &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;product-b&quot;, &quot;voice-command&quot; ]}, &quot;message-text&quot;: &quot; like product-b the voice-command is mind-blowing:)&quot; }, &quot;similar-tweets&quot;: { orderedlist: [{ unorderedlist: [&quot;product-y&quot;, &quot;voice-command&quot; ]} ]} }
+</pre></div></div></div></div></div></div></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                    2018
+                        <a href="https://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+                                                                  <?xml version="1.0" encoding="UTF-8"?>
+<div class="row-fluid">Apache AsterixDB, AsterixDB, Apache, the Apache
+        feather logo, and the Apache AsterixDB project logo are either
+        registered trademarks or trademarks of The Apache Software
+        Foundation in the United States and other countries.
+        All other marks mentioned may be trademarks or registered
+        trademarks of their respective owners.</div>
+                  
+        
+                </div>
+    </footer>
+  </body>
+</html>