use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class OpExtend method create.
/** Make a OpExtend - this does not aggregate (extend .. (extend ...)) */
public static Op create(Op op, Var var, Expr expr) {
VarExprList x = new VarExprList();
x.add(var, expr);
return new OpExtend(op, x);
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class PatternVarsVisitor method visit.
@Override
public void visit(ElementSubQuery el) {
el.getQuery().setResultVars();
VarExprList x = el.getQuery().getProject();
acc.addAll(x.getVars());
}
use of org.apache.jena.sparql.core.VarExprList in project jena by apache.
the class SelectClauseTest method testAddVarNode.
@ContractTest
public void testAddVarNode() throws Exception {
Var v = Var.alloc("one");
SelectClause<?> selectClause = getProducer().newInstance();
selectClause.addVar("one");
Query query = getQuery(selectClause.addVar(NodeFactory.createVariable("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 testAddStringVar.
@ContractTest
public void testAddStringVar() throws Exception {
SelectClause<?> selectClause = getProducer().newInstance();
AbstractQueryBuilder<?> aqb = selectClause.addVar("rand()", 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 SelectClauseTest method testAddVarAsterisk.
@ContractTest
public void testAddVarAsterisk() throws Exception {
SelectClause<?> selectClause = getProducer().newInstance();
selectClause.addVar("*");
Query query = getQuery(selectClause.addVar("*"));
VarExprList expr = query.getProject();
assertEquals(0, expr.size());
assertTrue(query.isQueryResultStar());
}
Aggregations