use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testNumeric.
private static void testNumeric(String string, BigInteger integer) {
Expr expr = parse(string);
NodeValue v = expr.eval(BindingFactory.binding(), new FunctionEnvBase());
assertTrue(v.isInteger());
assertEquals(integer, v.getInteger());
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testNumeric.
private static void testNumeric(String string, BigDecimal decimal) {
Expr expr = parse(string);
NodeValue v = expr.eval(BindingFactory.binding(), new FunctionEnvBase());
assertTrue(v.isDecimal());
assertEquals(decimal, v.getDecimal());
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testURI.
private static void testURI(String string, String uri) {
Expr expr = parse(string);
NodeValue v = expr.eval(env, new FunctionEnvBase());
assertTrue(v.isIRI());
assertEquals(uri, v.getNode().getURI());
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testString.
private static void testString(String string) {
Expr expr = parse(string);
NodeValue v = expr.eval(env, new FunctionEnvBase());
assertTrue(v.isString());
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class AggregationHandler method add.
/**
* Add and expression aggregator and variable to the mapping.
*
* if the expr parameter is not an instance of ExprAggregator then no action is taken.
*
* @param expr The expression to add.
* @param var The variable that it is bound to.
*/
public void add(Expr expr, Var var) {
if (expr instanceof ExprAggregator) {
ExprAggregator eAgg = (ExprAggregator) expr;
Expr expr2 = query.allocAggregate(eAgg.getAggregator());
aggMap.put(var, (ExprAggregator) expr2);
}
}
Aggregations