Search in sources :

Example 6 with FunctionEnvBase

use of org.apache.jena.sparql.function.FunctionEnvBase 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());
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) Expr(org.apache.jena.sparql.expr.Expr) FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 7 with FunctionEnvBase

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

the class LibTestExpr method eval.

static NodeValue eval(String exprString) {
    Expr expr = ExprUtils.parse(exprString, pmap);
    NodeValue result = expr.eval(null, new FunctionEnvBase());
    return result;
}
Also used : FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 8 with FunctionEnvBase

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

the class LibTestExpr method test.

static void test(String exprString, Node result) {
    Expr expr = ExprUtils.parse(exprString, pmap);
    NodeValue actual = expr.eval(null, new FunctionEnvBase());
    NodeValue expected = NodeValue.makeNode(result);
    assertTrue("Expected = " + expected + " : Actual = " + actual, NodeValue.sameAs(expected, actual));
}
Also used : FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 9 with FunctionEnvBase

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

the class LibTestExpr method testDouble.

static void testDouble(String exprString, Node result, double delta) {
    Expr expr = ExprUtils.parse(exprString, pmap);
    NodeValue actual = expr.eval(null, new FunctionEnvBase());
    NodeValue expected = NodeValue.makeNode(result);
    // between how things like doubles are expressed
    if (NodeValue.sameAs(expected, actual))
        return;
    testDouble(exprString, expected.getDouble(), delta);
    ;
}
Also used : FunctionEnvBase(org.apache.jena.sparql.function.FunctionEnvBase)

Example 10 with FunctionEnvBase

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

the class LibTestExpr method testError.

static void testError(String exprString) {
    Expr expr = ExprUtils.parse(exprString, pmap);
    expr.eval(null, new FunctionEnvBase());
}
Also used : 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