use of org.apache.rya.indexing.external.tupleSet.SimpleExternalTupleSet in project incubator-rya by apache.
the class PrecompJoinOptimizerTest2 method testThreeIndexGeoFreeCompareFilterMix2.
@Test
public void testThreeIndexGeoFreeCompareFilterMix2() throws Exception {
final SPARQLParser parser1 = new SPARQLParser();
final SPARQLParser parser2 = new SPARQLParser();
final SPARQLParser parser3 = new SPARQLParser();
final SPARQLParser parser4 = new SPARQLParser();
final ParsedQuery pq1 = parser1.parseQuery(q27, null);
final ParsedQuery pq2 = parser2.parseQuery(q23, null);
final ParsedQuery pq3 = parser3.parseQuery(q26, null);
final ParsedQuery pq4 = parser4.parseQuery(q28, null);
final SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(new Projection(pq2.getTupleExpr()));
final SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(new Projection(pq3.getTupleExpr()));
final SimpleExternalTupleSet extTup3 = new SimpleExternalTupleSet(new Projection(pq4.getTupleExpr()));
final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
list.add(extTup1);
list.add(extTup3);
list.add(extTup2);
final TupleExpr tup = pq1.getTupleExpr().clone();
provider.setIndices(list);
final PCJOptimizer pcj = new PCJOptimizer(list, false, provider);
pcj.optimize(tup, null, null);
final Set<StatementPattern> qSet = Sets.newHashSet(StatementPatternCollector.process(pq1.getTupleExpr()));
final Set<QueryModelNode> eTupSet = PcjIntegrationTestingUtil.getTupleSets(tup);
final Set<StatementPattern> set = Sets.newHashSet();
for (final QueryModelNode s : eTupSet) {
set.addAll(StatementPatternCollector.process(((ExternalTupleSet) s).getTupleExpr()));
}
Assert.assertTrue(qSet.containsAll(set));
}
use of org.apache.rya.indexing.external.tupleSet.SimpleExternalTupleSet in project incubator-rya by apache.
the class PrecompJoinOptimizerTest2 method testSingleIndexLargeQuery.
@Test
public void testSingleIndexLargeQuery() throws Exception {
final SPARQLParser parser1 = new SPARQLParser();
final SPARQLParser parser2 = new SPARQLParser();
final ParsedQuery pq1 = parser1.parseQuery(q8, null);
final ParsedQuery pq2 = parser2.parseQuery(q7, null);
final SimpleExternalTupleSet extTup = new SimpleExternalTupleSet(new Projection(pq2.getTupleExpr()));
final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
list.add(extTup);
final TupleExpr tup = pq1.getTupleExpr().clone();
provider.setIndices(list);
final PCJOptimizer pcj = new PCJOptimizer(list, false, provider);
pcj.optimize(tup, null, null);
final Set<StatementPattern> qSet = Sets.newHashSet(StatementPatternCollector.process(pq1.getTupleExpr()));
final Set<QueryModelNode> eTupSet = PcjIntegrationTestingUtil.getTupleSets(tup);
final Set<StatementPattern> set = Sets.newHashSet();
for (final QueryModelNode s : eTupSet) {
set.addAll(StatementPatternCollector.process(((ExternalTupleSet) s).getTupleExpr()));
}
Assert.assertTrue(set.equals(qSet));
}
use of org.apache.rya.indexing.external.tupleSet.SimpleExternalTupleSet in project incubator-rya by apache.
the class PrecompJoinOptimizerTest2 method testFreeTextIndexFunction.
@Test
public void testFreeTextIndexFunction() throws Exception {
final SPARQLParser parser1 = new SPARQLParser();
final SPARQLParser parser2 = new SPARQLParser();
final ParsedQuery pq1 = parser1.parseQuery(q22, null);
final ParsedQuery pq2 = parser2.parseQuery(q24, null);
System.out.println("Query is " + pq1.getTupleExpr());
System.out.println("Index is " + pq2.getTupleExpr());
final SimpleExternalTupleSet extTup = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
list.add(extTup);
final TupleExpr tup = pq1.getTupleExpr().clone();
provider.setIndices(list);
final PCJOptimizer pcj = new PCJOptimizer(list, false, provider);
pcj.optimize(tup, null, null);
final Set<StatementPattern> qSet = Sets.newHashSet(StatementPatternCollector.process(pq1.getTupleExpr()));
final Set<QueryModelNode> eTupSet = PcjIntegrationTestingUtil.getTupleSets(tup);
final Set<StatementPattern> set = Sets.newHashSet();
for (final QueryModelNode s : eTupSet) {
set.addAll(StatementPatternCollector.process(((ExternalTupleSet) s).getTupleExpr()));
}
Assert.assertTrue(qSet.containsAll(set) && set.size() != 0);
}
use of org.apache.rya.indexing.external.tupleSet.SimpleExternalTupleSet in project incubator-rya by apache.
the class PrecompJoinOptimizerTest2 method testBindingSetAssignment2.
@Test
public void testBindingSetAssignment2() throws Exception {
final SPARQLParser parser = new SPARQLParser();
final ParsedQuery pq1 = parser.parseQuery(q41, null);
final ParsedQuery pq2 = parser.parseQuery(q42, null);
final ParsedQuery pq3 = parser.parseQuery(q43, null);
final SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(new Projection(pq2.getTupleExpr()));
final SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(new Projection(pq3.getTupleExpr()));
final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
list.add(extTup1);
list.add(extTup2);
final TupleExpr tup = pq1.getTupleExpr().clone();
provider.setIndices(list);
final PCJOptimizer pcj = new PCJOptimizer(list, false, provider);
pcj.optimize(tup, null, null);
final Set<StatementPattern> qSet = Sets.newHashSet(StatementPatternCollector.process(pq1.getTupleExpr()));
final Set<QueryModelNode> eTupSet = PcjIntegrationTestingUtil.getTupleSets(tup);
final Set<StatementPattern> set = Sets.newHashSet();
for (final QueryModelNode s : eTupSet) {
set.addAll(StatementPatternCollector.process(((ExternalTupleSet) s).getTupleExpr()));
}
Assert.assertEquals(2, eTupSet.size());
Assert.assertEquals(qSet, set);
final BindingSetAssignmentCollector bsac1 = new BindingSetAssignmentCollector();
final BindingSetAssignmentCollector bsac2 = new BindingSetAssignmentCollector();
pq1.getTupleExpr().visit(bsac1);
tup.visit(bsac2);
Assert.assertEquals(bsac1.getBindingSetAssignments(), bsac2.getBindingSetAssignments());
}
use of org.apache.rya.indexing.external.tupleSet.SimpleExternalTupleSet in project incubator-rya by apache.
the class PrecompJoinOptimizerTest2 method testContextFilter1.
@Test
public void testContextFilter1() throws Exception {
final SPARQLParser parser1 = new SPARQLParser();
final SPARQLParser parser2 = new SPARQLParser();
final SPARQLParser parser3 = new SPARQLParser();
final SPARQLParser parser4 = new SPARQLParser();
final ParsedQuery pq1 = parser1.parseQuery(q15, null);
final ParsedQuery pq2 = parser2.parseQuery(q16, null);
final ParsedQuery pq3 = parser3.parseQuery(q17, null);
final ParsedQuery pq4 = parser4.parseQuery(q18, null);
System.out.println("Query is " + pq1.getTupleExpr());
System.out.println("Indexes are " + pq2.getTupleExpr() + " , " + pq3.getTupleExpr() + " , " + pq4.getTupleExpr());
final SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
final SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet((Projection) pq3.getTupleExpr());
final SimpleExternalTupleSet extTup3 = new SimpleExternalTupleSet((Projection) pq4.getTupleExpr());
final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
list.add(extTup1);
list.add(extTup2);
list.add(extTup3);
final TupleExpr tup = pq1.getTupleExpr().clone();
provider.setIndices(list);
final PCJOptimizer pcj = new PCJOptimizer(list, false, provider);
pcj.optimize(tup, null, null);
final Set<StatementPattern> qSet = Sets.newHashSet(StatementPatternCollector.process(pq1.getTupleExpr()));
final Set<QueryModelNode> eTupSet = PcjIntegrationTestingUtil.getTupleSets(tup);
final Set<StatementPattern> set = Sets.newHashSet();
for (final QueryModelNode s : eTupSet) {
set.addAll(StatementPatternCollector.process(((ExternalTupleSet) s).getTupleExpr()));
}
Assert.assertTrue(qSet.containsAll(set));
Assert.assertEquals(3, eTupSet.size());
}
Aggregations