use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class SelectClauseTest method testAddVarString.
@ContractTest
public void testAddVarString() throws Exception {
Var v = Var.alloc("one");
SelectClause<?> selectClause = getProducer().newInstance();
selectClause.addVar("one");
Query query = getQuery(selectClause.addVar("one"));
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
assertTrue(expr.contains(v));
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class SelectClauseTest method testAddExprVar.
@ContractTest
public void testAddExprVar() throws Exception {
SelectClause<?> selectClause = getProducer().newInstance();
AbstractQueryBuilder<?> aqb = selectClause.addVar(new E_Random(), Var.alloc("foo"));
Query query = getQuery(aqb);
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
Expr e = expr.getExpr(Var.alloc("foo"));
assertNotNull("expression should not be null", e);
assertTrue("Should be an E_Random", e instanceof E_Random);
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class SelectHandlerTest method testAddVar.
@Test
public void testAddVar() {
Var v = Var.alloc("one");
handler.addVar(v);
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
assertTrue(expr.contains(v));
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class SelectHandlerTest method testAddStringVar.
@Test
public void testAddStringVar() {
Var v = Var.alloc("foo");
handler.addVar("rand()", v);
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
Expr e = expr.getExpr(Var.alloc("foo"));
assertNotNull("expression should not be null", e);
assertTrue("Should be an E_Random", e instanceof E_Random);
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class ApplyTransformVisitor method visit.
@Override
public void visit(OpExtend opExtend) {
VarExprList varExpr = opExtend.getVarExprList();
VarExprList varExpr2 = collect(varExpr);
OpExtend opExtend2 = opExtend;
if (varExpr != varExpr2)
opExtend2 = OpExtend.create(opExtend.getSubOp(), varExpr2);
visit1(opExtend2);
}
Aggregations