use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class AbstractTestTransform method test.
public void test(Op op1, Transform transform, String... output) {
Op op2 = Transformer.transform(transform, op1);
if (output == null) {
// No transformation.
Assert.assertEquals(op1, op2);
return;
}
Op op3 = SSE.parseOp(StrUtils.strjoinNL(output));
Assert.assertEquals(op3, op2);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class AbstractTestTransform method testOptimize.
public void testOptimize(String input, String... output) {
Query q = QueryFactory.create(input);
Op op = Algebra.compile(q);
check(op, StrUtils.strjoinNL(output));
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class AbstractTestTransform method check.
public static void check(String queryString, String opExpectedString) {
queryString = "PREFIX : <http://example/>\n" + queryString;
Query query = QueryFactory.create(queryString);
Op opQuery = Algebra.compile(query);
// Safe copy
Op op1 = Algebra.compile(query);
check(opQuery, opExpectedString);
assertEquals("Modification of input during optimization", op1, opQuery);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class AbstractTestTransform method check.
public static void check(Op opToOptimize, Transform additionalOptimizer, String opExpectedString) {
Op opOptimize = Algebra.optimize(opToOptimize);
opOptimize = Transformer.transform(additionalOptimizer, opOptimize);
Op opExpected = SSE.parseOp(opExpectedString);
assertEquals(opExpected, opOptimize);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestOptimizer method combine_assign_03.
@Test
public void combine_assign_03() {
Op assign = OpAssign.create(OpTable.unit(), new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
assign = OpAssign.create(assign, new VarExprList(Var.alloc("x"), new NodeValueInteger(2)));
String opExpectedString = StrUtils.strjoinNL("(assign ((?x 2))", " (assign ((?x 1))", " (table unit)))");
check(assign, new TransformExtendCombine(), opExpectedString);
}
Aggregations