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