use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestTransformFilterEquality method equality_expression_1.
// JENA -1202
@Test
public void equality_expression_1() {
// Need to fold to a string or URI to trigger equality.
Op op = SSE.parseOp("(filter (= ?o (+ 'a' 'b')) (bgp (?x <http://p2> ?o)))");
// Fold constants.
Op op1 = Transformer.transform(new TransformCopy(), new ExprTransformConstantFold(), op);
// Then apply filter-equality.
check(op1, t_equality, "(assign ((?o 'ab')) (bgp (?x <http://p2> 'ab')) )");
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestPattern2Join method test.
private static void test(Op input, String... joinForm) {
Op op2 = Transformer.transform(new TransformPattern2Join(), input);
String x = StrUtils.strjoinNL(joinForm);
Op opExpected = SSE.parseOp("(prefix ((: <http://example/>)) " + x + ")");
assertEquals(opExpected, op2);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestTransformQuads method test.
private static void test(String patternString, boolean optimize, String... strExpected) {
Query q = QueryFactory.create("SELECT * WHERE " + patternString);
Op op = Algebra.compile(q);
if (optimize)
op = Algebra.optimize(op);
op = Algebra.toQuadForm(op);
Op op2 = SSE.parseOp(StrUtils.strjoinNL(strExpected));
assertEquals(op2, op);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestVarFinder method varfind.
private static void varfind(String string, String[] varsFixed, String[] varsOpt, String[] varsFilter, String[] varsFilterOnly) {
Op op = SSE.parseOp(string);
VarFinder vf = VarFinder.process(op);
if (varsFixed != null)
check(varsFixed, vf.getFixed());
if (varsOpt != null)
check(varsOpt, vf.getOpt());
if (varsFilter != null)
check(varsFilter, vf.getFilter());
if (varsFilterOnly != null)
check(varsFilterOnly, vf.getFilterOnly());
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class TestVarRename method checkRename.
private void checkRename(String queryString, String opExpectedString) {
Op opExpected = SSE.parseOp(opExpectedString);
queryString = "PREFIX : <http://example/>\n" + queryString;
Query query = QueryFactory.create(queryString);
Op op = Algebra.compile(query);
Op opRenamed = TransformScopeRename.transform(op);
assertEquals(opExpected, opRenamed);
}
Aggregations