Search in sources :

Example 1 with SolutionModifierHandler

use of org.apache.jena.arq.querybuilder.handlers.SolutionModifierHandler in project jena by apache.

the class SolutionModifierHandlerTest method testAddAll.

@Test
public void testAddAll() throws ParseException {
    SolutionModifierHandler solutionModifier2 = new SolutionModifierHandler(new Query());
    solutionModifier2.addOrderBy(Var.alloc("orderBy"));
    solutionModifier2.addGroupBy(Var.alloc("groupBy"));
    solutionModifier2.addHaving("?having<10");
    solutionModifier2.setLimit(500);
    solutionModifier2.setOffset(200);
    solutionModifier.addAll(solutionModifier2);
    String[] s = byLine(query.toString());
    assertContainsRegex(GROUP_BY + var("groupBy"), s);
    assertContainsRegex(HAVING + OPEN_PAREN + var("having") + OPT_SPACE + LT + OPT_SPACE + "10" + CLOSE_PAREN, s);
    assertContainsRegex(ORDER_BY + var("orderBy"), s);
    assertContainsRegex(LIMIT + "500", s);
    assertContainsRegex(OFFSET + "200", s);
}
Also used : SolutionModifierHandler(org.apache.jena.arq.querybuilder.handlers.SolutionModifierHandler) Query(org.apache.jena.query.Query) Test(org.junit.Test)

Example 2 with SolutionModifierHandler

use of org.apache.jena.arq.querybuilder.handlers.SolutionModifierHandler in project jena by apache.

the class SolutionModifierHandlerTest method setup.

@Before
public void setup() {
    query = new Query();
    solutionModifier = new SolutionModifierHandler(query);
}
Also used : SolutionModifierHandler(org.apache.jena.arq.querybuilder.handlers.SolutionModifierHandler) Query(org.apache.jena.query.Query) Before(org.junit.Before)

Aggregations

SolutionModifierHandler (org.apache.jena.arq.querybuilder.handlers.SolutionModifierHandler)2 Query (org.apache.jena.query.Query)2 Before (org.junit.Before)1 Test (org.junit.Test)1