Search in sources :

Example 1 with ElementTransformCleanGroupsOfOne

use of org.apache.jena.sparql.syntax.syntaxtransform.ElementTransformCleanGroupsOfOne in project jena by apache.

the class TestFlattenSyntax method test.

private static void test(String input, String expected) {
    if (expected == null)
        expected = input;
    String qs = gen(PRE, input);
    String qsExpected = gen(PRE, expected);
    Query query = QueryFactory.create(qs, Syntax.syntaxARQ);
    Query query2 = QueryTransformOps.transform(query, new ElementTransformCleanGroupsOfOne());
    Query queryExpected = QueryFactory.create(qsExpected, Syntax.syntaxARQ);
    Op op1 = Algebra.compile(query);
    Op op2 = Algebra.compile(query2);
    assertEquals("Algebra different", op1, op2);
    boolean modified = !query.equals(query2);
    boolean expectModification = !queryExpected.equals(query);
    assertEquals("Expect query modifed?", expectModification, modified);
}
Also used : Op(org.apache.jena.sparql.algebra.Op) Query(org.apache.jena.query.Query) ElementTransformCleanGroupsOfOne(org.apache.jena.sparql.syntax.syntaxtransform.ElementTransformCleanGroupsOfOne)

Aggregations

Query (org.apache.jena.query.Query)1 Op (org.apache.jena.sparql.algebra.Op)1 ElementTransformCleanGroupsOfOne (org.apache.jena.sparql.syntax.syntaxtransform.ElementTransformCleanGroupsOfOne)1