Search in sources :

Example 11 with FunctionEnvBase

use of org.apache.jena.sparql.function.FunctionEnvBase in project jena by apache.

the class TestExpressions method testNumeric.

private static void testNumeric(String string, int i) {
    Expr expr = parse(string);
    NodeValue v = expr.eval(BindingFactory.binding(), new FunctionEnvBase());
    assertTrue(v.isInteger());
    assertEquals(i, v.getInteger().intValue());
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) Expr(org.apache.jena.sparql.expr.Expr) FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 12 with FunctionEnvBase

use of org.apache.jena.sparql.function.FunctionEnvBase in project jena by apache.

the class TestExpressions method testBoolean.

private static void testBoolean(String string, boolean b, Binding env) {
    Expr expr = parse(string);
    NodeValue v = expr.eval(env, new FunctionEnvBase());
    assertTrue(v.isBoolean());
    assertEquals(b, v.getBoolean());
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) Expr(org.apache.jena.sparql.expr.Expr) FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 13 with FunctionEnvBase

use of org.apache.jena.sparql.function.FunctionEnvBase in project jena by apache.

the class TestExpressions method testNumeric.

private static void testNumeric(String string, double d) {
    Expr expr = parse(string);
    NodeValue v = expr.eval(BindingFactory.binding(), new FunctionEnvBase());
    assertTrue(v.isDouble());
    assertEquals(d, v.getDouble(), 0);
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) Expr(org.apache.jena.sparql.expr.Expr) FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Aggregations

FunctionEnvBase (org.apache.jena.sparql.function.FunctionEnvBase)13 Expr (org.apache.jena.sparql.expr.Expr)9 NodeValue (org.apache.jena.sparql.expr.NodeValue)9 Node (org.apache.jena.graph.Node)1