use of org.apache.rya.indexing.external.PcjIntegrationTestingUtil.BindingSetAssignmentCollector 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());
}
Aggregations