Implemented 6 & 7 (Quantified Expressions) but error when running original query in WebUI
diff --git a/asterix-app/src/main/resources/sdk/static/example/js/demo.js b/asterix-app/src/main/resources/sdk/static/example/js/demo.js
index 7298024..aafb6ae 100644
--- a/asterix-app/src/main/resources/sdk/static/example/js/demo.js
+++ b/asterix-app/src/main/resources/sdk/static/example/js/demo.js
@@ -129,7 +129,20 @@
alert(JSON.stringify(res));
$('#result6').html(res["results"]);
}
- });
+ })
+ .bind( new ForClause (
+ "fbu",
+ null,
+ 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)")
+ )
+ ))
+ .bind( new ReturnClause( new AQLClause().set("$fbu") ));
alert("EXPRESSION 6 " + expression6.val());
});
@@ -143,7 +156,20 @@
alert(JSON.stringify(res));
$('#result7').html(res["results"]);
}
- });
+ })
+ .bind( new ForClause (
+ "fbu",
+ null,
+ 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))")
+ )
+ ))
+ .bind(new ReturnClause( new AQLClause().set("$fbu") ));
alert("EXPRESSION 7 " + expression7.val());
});
diff --git a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
index 5867722..d24bca3 100644
--- a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
+++ b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
@@ -497,7 +497,7 @@
WhereClause.prototype.bind = function(expression) {
- if (expression instanceof BooleanExpression) {
+ if (expression instanceof AExpression) {
this._properties["stack"].push(expression);
}
};
@@ -513,7 +513,7 @@
}
return value;
-}
+};
// LimitClause
@@ -713,3 +713,8 @@
QuantifiedExpression.prototype = Object.create(AExpression.prototype);
QuantifiedExpression.prototype.constructor = QuantifiedExpression;
+
+QuantifiedExpression.prototype.val = function() {
+ var value = AExpression.prototype.val.call(this);
+ return "(" + value + ")";
+};