Search in sources :

Example 1 with AggCount

use of org.apache.jena.sparql.expr.aggregate.AggCount in project jena by apache.

the class SelectHandlerTest method testAddAggregateStringVar.

@Test
public void testAddAggregateStringVar() {
    Var v = Var.alloc("foo");
    handler.addVar("count(*)", 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 ExprAggregator", e instanceof ExprAggregator);
    assertTrue("Should be AggCount", ((ExprAggregator) e).getAggregator() instanceof AggCount);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) Var(org.apache.jena.sparql.core.Var) AggCount(org.apache.jena.sparql.expr.aggregate.AggCount) ExprAggregator(org.apache.jena.sparql.expr.ExprAggregator) VarExprList(org.apache.jena.sparql.core.VarExprList) Test(org.junit.Test)

Aggregations

Var (org.apache.jena.sparql.core.Var)1 VarExprList (org.apache.jena.sparql.core.VarExprList)1 Expr (org.apache.jena.sparql.expr.Expr)1 ExprAggregator (org.apache.jena.sparql.expr.ExprAggregator)1 AggCount (org.apache.jena.sparql.expr.aggregate.AggCount)1 Test (org.junit.Test)1