@Test public void testTwoIndexLargeQuery() throws Exception { SPARQLParser parser = new SPARQLParser(); ParsedQuery pq1 = parser.parseQuery(q11, null); ParsedQuery pq2 = parser.parseQuery(q7, null); ParsedQuery pq3 = parser.parseQuery(q12, null); ParsedQuery pq4 = parser.parseQuery(q13, null); ParsedQuery pq5 = parser.parseQuery(q8, null); ParsedQuery pq6 = parser.parseQuery(q14, null); System.out.println("Query is " + pq1.getTupleExpr()); SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet( (Projection) pq2.getTupleExpr()); SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet( (Projection) pq3.getTupleExpr()); SimpleExternalTupleSet extTup3 = new SimpleExternalTupleSet( (Projection) pq4.getTupleExpr()); SimpleExternalTupleSet extTup4 = new SimpleExternalTupleSet( (Projection) pq5.getTupleExpr()); SimpleExternalTupleSet extTup5 = new SimpleExternalTupleSet( (Projection) pq6.getTupleExpr()); List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>(); list.add(extTup1); list.add(extTup2); list.add(extTup3); list.add(extTup4); list.add(extTup5); VarConstantIndexListPruner vci = new VarConstantIndexListPruner( pq1.getTupleExpr()); List<ExternalTupleSet> processedIndexSet = vci.getRelevantIndices(list); System.out.println("Relevant indexes are: "); for (ExternalTupleSet e : processedIndexSet) { System.out.println(e); } Set<ExternalTupleSet> indexSet = Sets.newHashSet(); indexSet.add(extTup1); indexSet.add(extTup2); indexSet.add(extTup4); Assert.assertTrue(Sets.intersection(indexSet, Sets.newHashSet(processedIndexSet)) .equals(Sets.newHashSet(processedIndexSet))); }
@Override public List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList) { List<ExternalTupleSet> relIndexSet = new ArrayList<>(); for (ExternalTupleSet e : indexList) { if (isRelevant(e.getTupleExpr())) { relIndexSet.add(e); } } return relIndexSet; }
VarConstantIndexListPruner implements IndexListPruner { @Override public List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList) { List<ExternalTupleSet> relIndexSet = new ArrayList<>(); for (ExternalTupleSet e : indexList) { if (isRelevant(e.getTupleExpr())) { relIndexSet.add(e); } } return relIndexSet; } }
VarConstantIndexListPruner implements IndexListPruner { @Override public List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList) { List<ExternalTupleSet> relIndexSet = new ArrayList<>(); for (ExternalTupleSet e : indexList) { if (isRelevant(e.getTupleExpr())) { relIndexSet.add(e); } } return relIndexSet; } VarConstantIndexListPruner(TupleExpr te); }
VarConstantIndexListPruner implements IndexListPruner { @Override public List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList) { List<ExternalTupleSet> relIndexSet = new ArrayList<>(); for (ExternalTupleSet e : indexList) { if (isRelevant(e.getTupleExpr())) { relIndexSet.add(e); } } return relIndexSet; } VarConstantIndexListPruner(TupleExpr te); @Override List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList); }
VarConstantIndexListPruner implements IndexListPruner { @Override public List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList) { List<ExternalTupleSet> relIndexSet = new ArrayList<>(); for (ExternalTupleSet e : indexList) { if (isRelevant(e.getTupleExpr())) { relIndexSet.add(e); } } return relIndexSet; } VarConstantIndexListPruner(TupleExpr te); @Override List<ExternalTupleSet> getRelevantIndices(List<ExternalTupleSet> indexList);  }