use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestCastXSD method cast.
private NodeValue cast(String input$) {
Expr input = ExprUtils.parse(input$);
ARQ.getContext().set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime());
FunctionEnv env = new ExecutionContext(ARQ.getContext(), null, null, null);
return input.eval(null, env);
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExprLib method testSafeEquality.
private static void testSafeEquality(String string, boolean b, boolean graphString, boolean graphNumber) {
Expr expr = ExprUtils.parse(string);
Assert.assertEquals(string, b, ExprLib.isAssignmentSafeEquality(expr, graphString, graphNumber));
}
use of org.apache.jena.sparql.expr.Expr in project jena by apache.
the class TestExpressions method testVar.
private static void testVar(String string, String rightVarName) {
Expr expr = parse(string);
assertTrue("Not a NodeVar: " + expr, expr.isVariable());
ExprVar v = (ExprVar) expr;
assertEquals("Different variable names", rightVarName, v.getVarName());
}
use of org.apache.jena.sparql.expr.Expr 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());
}
use of org.apache.jena.sparql.expr.Expr 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());
}
Aggregations