use of org.apache.jena.query.Query in project jena by apache.
the class TestOpAsQuery method roundTripQuery.
// query->algebra->OpAsQuery->query
private static Query[] roundTripQuery(String query) {
Query orig = QueryFactory.create(query, Syntax.syntaxSPARQL_11);
Op toReconstruct = Algebra.compile(orig);
Query got = OpAsQuery.asQuery(toReconstruct);
Query[] r = { orig, got };
return r;
}
use of org.apache.jena.query.Query in project jena by apache.
the class TestOpAsQuery method roundTripQueryQuad.
// query->algebra/quads->OpAsQuery->query
private static Query[] roundTripQueryQuad(String query) {
Query orig = QueryFactory.create(query, Syntax.syntaxSPARQL_11);
Op toReconstruct = Algebra.compile(orig);
toReconstruct = Algebra.toQuadForm(toReconstruct);
Query got = OpAsQuery.asQuery(toReconstruct);
Query[] r = { orig, got };
return r;
}
use of org.apache.jena.query.Query in project jena by apache.
the class TestOpAsQuery method test_AlgebraToQuery.
// algebra->OpAsQuery->query
public static void test_AlgebraToQuery(String input, String expected) {
Op op = SSE.parseOp(input);
Query orig = QueryFactory.create(expected, Syntax.syntaxSPARQL_11);
stripNamespacesAndBase(orig);
Query got = OpAsQuery.asQuery(op);
Assert.assertEquals(orig, got);
}
use of org.apache.jena.query.Query in project jena by apache.
the class TestPattern2Join method test3.
private static void test3(String pattern, String... joinForm) {
Query q = QueryFactory.create("PREFIX : <http://example/> SELECT * " + pattern);
Op op = Algebra.compile(q.getQueryPattern());
test(op, joinForm);
}
use of org.apache.jena.query.Query in project jena by apache.
the class TestClassify method classifyJ.
public static void classifyJ(String pattern, boolean expected) {
String qs1 = "PREFIX : <http://example/>\n";
String qs = qs1 + "SELECT * " + pattern;
Query query = QueryFactory.create(qs, Syntax.syntaxARQ);
Op op = Algebra.compile(query.getQueryPattern());
if (!(op instanceof OpJoin))
fail("Not a join: " + pattern);
boolean nonLinear = JoinClassifier.isLinear((OpJoin) op);
assertEquals("Join: " + pattern, expected, nonLinear);
}
Aggregations