Exterminated bugs with the fire of a thousand angry suns.
diff --git a/asterix-app/src/main/resources/sdk/static/example/demo.html b/asterix-app/src/main/resources/sdk/static/example/demo.html
index 9d98546..3afaaa4 100644
--- a/asterix-app/src/main/resources/sdk/static/example/demo.html
+++ b/asterix-app/src/main/resources/sdk/static/example/demo.html
@@ -45,14 +45,10 @@
</pre></div>
<div class="how-to-run"><pre><code class="javascript">
- var expression0a = new FLWOGRExpression({
- "dataverse" : "TinySocial",
- "success" : function(res) {
- $('#result0a').html(res["results"]);
- }
- })
- .bind( new ForClause("user", null, new AsterixExpression().set(["dataset FacebookUsers"])) )
- .bind( new WhereClause(new BooleanExpression("$user.id = 8")));
+ var expression0a = new FLWOGRExpression()
+ .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
+ .bind( new WhereClause(new AExpression().set("$user.id = 8")))
+ .ReturnClause("$user");
</code></pre></div>
<div class="result-output" id="result0a">
@@ -72,8 +68,15 @@
return $user;
</pre></div>
- <div class="how-to-run"><pre>
- </pre></div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression0b = new FLWOGRExpression()
+ .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
+ .bind( new WhereClause().and(
+ new AExpression().set("$user.id >= 2"),
+ new AExpression().set("$user.id <= 4")
+ ))
+ .ReturnClause("$user");
+ </code></pre></div>
<div class="result-output" id="result0b">
</div>
@@ -93,8 +96,15 @@
return $user;
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression1 = new FLWOGRExpression()
+ .bind( new ForClause("user", new AExpression().set("dataset FacebookUsers")))
+ .bind( new WhereClause().and(
+ new AExpression().set("$user.user-since >= datetime('2010-07-22T00:00:00')"),
+ new AExpression().set("$user.user-since <= datetime('2012-07-29T23:59:59')")
+ ))
+ .ReturnClause("$user");
+ </code></pre></div>
<div class="result-output" id="result1">
</div>
@@ -117,8 +127,16 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression2a = new FLWOGRExpression()
+ .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
+ .bind( new ForClause ("message", new AQLClause().set("dataset FacebookMessages")))
+ .bind( new WhereClause (new AExpression().set("$message.author-id = $user.id")))
+ .ReturnClause({
+ "uname" : "$user.name",
+ "message" : "$message.message"
+ });
+ </code></pre></div>
<div class="result-output" id="result2a">
</div>
@@ -141,8 +159,18 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression2b = new FLWOGRExpression()
+ .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
+ .bind( new ForClause ("message", new AQLClause().set("dataset FacebookMessages")))
+ .bind( new WhereClause (new AExpression().set("$message.author-id /*+ indexnl */ = $user.id")))
+ .ReturnClause(
+ {
+ "uname" : "$user.name",
+ "message" : "$message.message"
+ }
+ );
+ </code></pre></div>
<div class="result-output" id="result2b">
</div>
@@ -165,8 +193,19 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression3messages = new FLWOGRExpression()
+ .bind( new ForClause("message", new AExpression().set("dataset FacebookMessages")))
+ .bind( new WhereClause(new AExpression().set("$message.author-id = $user.id")))
+ .ReturnClause("$message.message");
+
+ var expression3 = new FLWOGRExpression()
+ .bind( new ForClause ("user", new AQLClause().set("dataset FacebookUsers")))
+ .ReturnClause({
+ "uname": "$user.name",
+ "messages" : expression3messages
+ });
+ </code></pre></div>
<div class="result-output" id="result3">
</div>
@@ -189,8 +228,19 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression4messages = new FLWOGRExpression()
+ .bind( new ForClause( "t2", new AExpression().set("dataset TweetMessages")))
+ .bind( new WhereClause( new AExpression().set("spatial-distance($t.sender-location, $t2.sender-location) <= 1")))
+ .ReturnClause({ "msgtxt" : "$t2.message-text" });
+
+ var expression4 = new FLWOGRExpression()
+ .bind( new ForClause( "t", new AExpression().set("dataset TweetMessages") ))
+ .ReturnClause({
+ "message" : "$t.message-text",
+ "nearby-messages" : expression4messages
+ });
+ </code></pre></div>
<div class="result-output" id="result4">
</div>
@@ -221,8 +271,26 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var similarUsersExpression = new FLWOGRExpression()
+ .bind( new ForClause ("t", new AQLClause().set("dataset TweetMessages")))
+ .bind( new LetClause ("tu", new AExpression().set("$t.user")))
+ .bind( new WhereClause (new AExpression().set("$tu.name ~= $fbu.name")))
+ .ReturnClause({
+ "twitter-screenname": "$tu.screen-name",
+ "twitter-name": "$tu.name"
+ });
+
+ var expression5 = new FLWOGRExpression()
+ .bind( new ForClause ("fbu", new AQLClause().set("dataset FacebookUsers")))
+ .ReturnClause(
+ {
+ "id" : "$fbu.id",
+ "name" : "$fbu.name",
+ "similar-users" : similarUsersExpression
+ }
+ );
+ </code></pre></div>
<div class="result-output" id="result5">
</div>
@@ -241,8 +309,18 @@
return $fbu;
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression6 = new FLWOGRExpression()
+ .bind( new ForClause ("fbu", new AQLClause().set("dataset FacebookUsers")))
+ .bind( new WhereClause (
+ new QuantifiedExpression (
+ "some" ,
+ {"$e" : new AQLClause().set("$fbu.employment") },
+ new AQLClause().set("is-null($e.end-date)")
+ )
+ ))
+ .ReturnClause("$fbu");
+ </code></pre></div>
<div class="result-output" id="result6">
</div>
@@ -261,8 +339,21 @@
return $fbu;
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression7 = new FLWOGRExpression()
+ .bind( new ForClause (
+ "fbu",
+ new AQLClause().set("dataset FacebookUsers")
+ ))
+ .bind( new WhereClause (
+ new QuantifiedExpression (
+ "every" ,
+ {"$e" : new AQLClause().set("$fbu.employment") },
+ new AQLClause().set("not(is-null($e.end-date))")
+ )
+ ))
+ .ReturnClause("$fbu");
+ </code></pre></div>
<div class="result-output" id="result7">
</div>
@@ -282,18 +373,10 @@
<div class="how-to-run"><pre><code class="javascript">
var expression8 = new FunctionExpression(
"count",
- new ForClause("fbu", null, new AQLClause().set("dataset FacebookUsers"))
- .bind(new ReturnClause("$fbu"))
+ new FLWOGRExpression()
+ .bind( new ForClause("fbu", new AQLClause().set("dataset FacebookUsers")))
+ .ReturnClause("$fbu")
);
-
- OR
-
- var expression8 = new FunctionExpression()
- .fn("count")
- .expression(
- new ForClause("fbu", null, new AQLClause().set("dataset FacebookUsers"))
- .bind(new ReturnClause("$fbu"))
- );
</code></pre></div>
<div class="result-output" id="result8">
@@ -316,8 +399,17 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression9a = new FLWOGRExpression()
+ .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
+ .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : new FunctionExpression("count", new AExpression().set("$t"))
+ }
+ );
+ </code></pre></div>
<div class="result-output" id="result9a">
</div>
@@ -340,8 +432,18 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression9b = new FLWOGRExpression()
+ .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
+ .bind( new AQLClause().set("/*+ hash*/"))
+ .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : new FunctionExpression("count", new AExpression().set("$t"))
+ }
+ );
+ </code></pre></div>
<div class="result-output" id="result9b">
</div>
@@ -366,8 +468,23 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression10 = new FLWOGRExpression()
+ .bind( new ForClause("t", new AExpression().set("dataset TweetMessages")))
+ .bind( new GroupClause("uid", new AExpression().set("$t.user.screen-name"), "with", "t") )
+ .bind( new LetClause(
+ "c",
+ new FunctionExpression("count", new AExpression().set("$t"))
+ ))
+ .bind( new OrderbyClause( new AExpression().set("$c"), "desc" ) )
+ .bind( new LimitClause(new AExpression().set("3")) )
+ .ReturnClause(
+ {
+ "user" : "$uid",
+ "count" : "$c"
+ }
+ );
+ </code></pre></div>
<div class="result-output" id="result10">
</div>
@@ -394,8 +511,20 @@
};
</pre></div>
- <div class="how-to-run">
- </div>
+ <div class="how-to-run"><pre><code class="javascript">
+ var expression11 = new FLWOGRExpression()
+ .bind( new ForClause( "t", new AExpression().set("dataset TweetMessages") ))
+ .ReturnClause({
+ "tweet" : new AExpression().set("$t"),
+ "similar-tweets": new FLWOGRExpression()
+ .bind( new ForClause( "t2", new AExpression().set("dataset TweetMessages") ))
+ .bind( new WhereClause().and(
+ new AExpression().set("$t2.referred-topics ~= $t.referred-topics"),
+ new AExpression().set("$t2.tweetid != $t.tweetid")
+ ))
+ .ReturnClause("$t2.referred-topics")
+ });
+ </code></pre></div>
<div class="result-output" id="result11">
</div>