Search in sources :

Example 1 with Transform

use of org.apache.jena.sparql.algebra.Transform in project jena by apache.

the class TestTransformTopN method test.

private void test(String input, String output) {
    Transform transform = new TransformTopN();
    testOp(input, transform, output);
}
Also used : AbstractTestTransform(org.apache.jena.sparql.algebra.optimize.AbstractTestTransform) Transform(org.apache.jena.sparql.algebra.Transform) TransformTopN(org.apache.jena.sparql.algebra.optimize.TransformTopN)

Example 2 with Transform

use of org.apache.jena.sparql.algebra.Transform in project jena by apache.

the class QueryEngineRef method modifyOp.

@Override
protected Op modifyOp(Op op) {
    // Just property functions
    Transform t = new TransformPropertyFunction(context);
    op = Transformer.transform(t, op);
    return op;
}
Also used : Transform(org.apache.jena.sparql.algebra.Transform) TransformPropertyFunction(org.apache.jena.sparql.algebra.optimize.TransformPropertyFunction)

Example 3 with Transform

use of org.apache.jena.sparql.algebra.Transform in project jena by apache.

the class TestTransformFilterPlacement method test$.

public static void test$(String input, String output, boolean includeBGPs) {
    Transform t_placement = new TransformFilterPlacement(includeBGPs);
    Op op1 = SSE.parseOp(input);
    Op op2 = Transformer.transform(t_placement, op1);
    if (output == null) {
        // No transformation.
        Assert.assertEquals(op1, op2);
        return;
    }
    Op op3 = SSE.parseOp(output);
    if (!Objects.equals(op2, op3)) {
        System.out.println("Expected:");
        System.out.println(op3);
        System.out.println("Got:");
        System.out.println(op2);
    }
    Assert.assertEquals(op3, op2);
}
Also used : Op(org.apache.jena.sparql.algebra.Op) Transform(org.apache.jena.sparql.algebra.Transform)

Example 4 with Transform

use of org.apache.jena.sparql.algebra.Transform in project jena by apache.

the class TestTransformFilters method nested_02.

@Test
public void nested_02() {
    Transform tableChanger = new TransformCopy() {

        @Override
        public Op transform(OpTable opTable) {
            // Always a new object
            return OpTable.create(opTable.getTable());
        }
    };
    testOp("(filter (?A) (filter (?B) (table unit)))", tableChanger, "(filter (exprlist ?B ?A) (table unit))");
}
Also used : TransformCopy(org.apache.jena.sparql.algebra.TransformCopy) OpTable(org.apache.jena.sparql.algebra.op.OpTable) Transform(org.apache.jena.sparql.algebra.Transform) Test(org.junit.Test)

Example 5 with Transform

use of org.apache.jena.sparql.algebra.Transform in project jena by apache.

the class TestTransformTopN method testQuery.

// ---- From query to transfomed algebra.
private void testQuery(String input, String output) {
    Transform transform = new TransformTopN();
    testQuery(input, transform, output);
}
Also used : AbstractTestTransform(org.apache.jena.sparql.algebra.optimize.AbstractTestTransform) Transform(org.apache.jena.sparql.algebra.Transform) TransformTopN(org.apache.jena.sparql.algebra.optimize.TransformTopN)

Aggregations

Transform (org.apache.jena.sparql.algebra.Transform)8 AbstractTestTransform (org.apache.jena.sparql.algebra.optimize.AbstractTestTransform)2 TransformTopN (org.apache.jena.sparql.algebra.optimize.TransformTopN)2 Op (org.apache.jena.sparql.algebra.Op)1 TransformCopy (org.apache.jena.sparql.algebra.TransformCopy)1 OpTable (org.apache.jena.sparql.algebra.op.OpTable)1 TransformPropertyFunction (org.apache.jena.sparql.algebra.optimize.TransformPropertyFunction)1 ExprTransform (org.apache.jena.sparql.expr.ExprTransform)1 Test (org.junit.Test)1