You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by mi...@apache.org on 2016/02/07 19:26:12 UTC

[09/16] incubator-rya git commit: RYA-32 Improve how metadata and values are written to Accumulo PCJ tables

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/c12f58f4/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/ValidIndexCombinationGeneratorTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/ValidIndexCombinationGeneratorTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/ValidIndexCombinationGeneratorTest.java
index 38f7813..3b74962 100644
--- a/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/ValidIndexCombinationGeneratorTest.java
+++ b/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/ValidIndexCombinationGeneratorTest.java
@@ -8,9 +8,9 @@ package mvm.rya.indexing.IndexPlanValidator;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,602 +19,515 @@ package mvm.rya.indexing.IndexPlanValidator;
  * under the License.
  */
 
-
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-import junit.framework.Assert;
+
 import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
 import mvm.rya.indexing.external.tupleSet.SimpleExternalTupleSet;
+
+import org.junit.Assert;
 import org.junit.Test;
 import org.openrdf.query.MalformedQueryException;
 import org.openrdf.query.algebra.Projection;
 import org.openrdf.query.parser.ParsedQuery;
 import org.openrdf.query.parser.sparql.SPARQLParser;
-import com.google.common.collect.Lists;
 
+import com.google.common.collect.Lists;
 
 public class ValidIndexCombinationGeneratorTest {
 
-    
-    
-    
-    
-
-    @Test
-    public void singleIndex() {
-        String q1 = ""//
-                + "SELECT ?f ?m ?d " //
-                + "{" //
-                + "  ?f a ?m ."//
-                + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-                + "  ?d <uri:talksTo> ?f . "//
-                + "  ?f <uri:hangOutWith> ?m ." //
-                + "  ?m <uri:hangOutWith> ?d ." //
-                + "  ?f <uri:associatesWith> ?m ." //
-                + "  ?m <uri:associatesWith> ?d ." //
-                + "}";//
-        
-        
-       
-        
-        
-
-        SPARQLParser parser = new SPARQLParser();
-        ParsedQuery pq1 = null;
-       
-        
-        SimpleExternalTupleSet extTup1 = null;
-        
-        
-        
-        
-        
-        
-        try {
-            pq1 = parser.parseQuery(q1, null);
-            
-           
-
-            extTup1 = new SimpleExternalTupleSet((Projection) pq1.getTupleExpr());
-            
-          
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        
-        List<ExternalTupleSet> indexList = Lists.newArrayList();
-        indexList.add(extTup1);
-        
-        
-        ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(pq1.getTupleExpr());
-        Iterator<List<ExternalTupleSet>> combos = vic.getValidIndexCombos(indexList);
-        int size = 0;
-        while(combos.hasNext()) {
-            combos.hasNext();
-            size++;
-            combos.next();
-            combos.hasNext();
-        }
-        
-       Assert.assertTrue(!combos.hasNext());
-       Assert.assertEquals(1,size);
-        
-        
-    }
-    
-    
-    
-    
-    
-    
-    @Test
-    public void medQueryEightOverlapIndex() {
-        String q1 = ""//
-                + "SELECT ?f ?m ?d " //
-                + "{" //
-                + "  ?f a ?m ."//
-                + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-                + "  ?d <uri:talksTo> ?f . "//
-                + "  ?f <uri:hangOutWith> ?m ." //
-                + "  ?m <uri:hangOutWith> ?d ." //
-                + "  ?f <uri:associatesWith> ?m ." //
-                + "  ?m <uri:associatesWith> ?d ." //
-                + "}";//
-        
-        
-        String q2 = ""//
-                + "SELECT ?t ?s ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "}";//
-        
-        
-        String q3 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s <uri:hangOutWith> ?t ." //
-                + "  ?t <uri:hangOutWith> ?u ." //
-                + "}";//
-        
-        String q4 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s <uri:associatesWith> ?t ." //
-                + "  ?t <uri:associatesWith> ?u ." //
-                + "}";//
-        
-        
-        String q5 = ""//
-                + "SELECT ?t ?s ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "  ?s <uri:hangOutWith> ?t ." //
-                + "  ?t <uri:hangOutWith> ?u ." //
-                + "}";//
-        
-        String q6 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s <uri:associatesWith> ?t ." //
-                + "  ?t <uri:associatesWith> ?u ." //
-                + "  ?s <uri:hangOutWith> ?t ." //
-                + "  ?t <uri:hangOutWith> ?u ." //
-                + "}";//
-        
-        
-        String q7 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s <uri:associatesWith> ?t ." //
-                + "  ?t <uri:associatesWith> ?u ." //
-                + "  ?t <uri:hangOutWith> ?u ." //
-                + "}";//
-        
-        
-        
-        String q8 = ""//
-                + "SELECT ?t ?s ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "  ?s <uri:associatesWith> ?t ." //
-                + "}";//
-        
-        
-        String q9 = ""//
-                + "SELECT ?t ?s ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "}";//
-        
-        
-        
-        
-        
-        
-        
-        
-
-        SPARQLParser parser = new SPARQLParser();
-        ParsedQuery pq1 = null;
-        ParsedQuery pq2 = null;
-        ParsedQuery pq3 = null;
-        ParsedQuery pq4 = null;
-        ParsedQuery pq5 = null;
-        ParsedQuery pq6 = null;
-        ParsedQuery pq7 = null;
-        ParsedQuery pq8 = null;
-        ParsedQuery pq9 = null;
-        
-        SimpleExternalTupleSet extTup1 = null;
-        SimpleExternalTupleSet extTup2 = null;
-        SimpleExternalTupleSet extTup3 = null;
-        SimpleExternalTupleSet extTup4 = null;
-        SimpleExternalTupleSet extTup5 = null;
-        SimpleExternalTupleSet extTup6 = null;
-        SimpleExternalTupleSet extTup7 = null;
-        SimpleExternalTupleSet extTup8 = null;
-        
-        
-        
-        
-        
-        try {
-            pq1 = parser.parseQuery(q1, null);
-            pq2 = parser.parseQuery(q2, null);
-            pq3 = parser.parseQuery(q3, null);
-            pq4 = parser.parseQuery(q4, null);
-            pq5 = parser.parseQuery(q5, null);
-            pq6 = parser.parseQuery(q6, null);
-            pq7 = parser.parseQuery(q7, null);
-            pq8 = parser.parseQuery(q8, null);
-            pq9 = parser.parseQuery(q9, null);
-           
-
-            extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
-            extTup2 = new SimpleExternalTupleSet((Projection) pq3.getTupleExpr());
-            extTup3 = new SimpleExternalTupleSet((Projection) pq4.getTupleExpr());
-            extTup4 = new SimpleExternalTupleSet((Projection) pq5.getTupleExpr());
-            extTup5 = new SimpleExternalTupleSet((Projection) pq6.getTupleExpr());
-            extTup6 = new SimpleExternalTupleSet((Projection) pq7.getTupleExpr());
-            extTup7 = new SimpleExternalTupleSet((Projection) pq8.getTupleExpr());
-            extTup8 = new SimpleExternalTupleSet((Projection) pq9.getTupleExpr());
-            
-          
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        
-        List<ExternalTupleSet> indexList = Lists.newArrayList();
-        indexList.add(extTup1);
-        indexList.add(extTup2);
-        indexList.add(extTup3);
-        indexList.add(extTup4);
-        indexList.add(extTup5);
-        indexList.add(extTup6);
-        indexList.add(extTup7);
-        indexList.add(extTup8);
-        
-        
-        ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(pq1.getTupleExpr());
-        Iterator<List<ExternalTupleSet>> combos = vic.getValidIndexCombos(indexList);
-        int size = 0;
-        while(combos.hasNext()) {
-            combos.hasNext();
-            size++;
-            combos.next();
-            combos.hasNext();
-        }
-        
-       Assert.assertTrue(!combos.hasNext());
-       Assert.assertEquals(21,size);
-        
-        
-    }
-    
-    
-    
-    
-    
-    @Test
-    public void largeQuerySixteenIndexTest() {
-        
-        
-        String q1 = ""//
-                + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
-                + "{" //
-                + "  ?f a ?m ."//
-                + "  ?e a ?l ."//
-                + "  ?n a ?o ."//
-                + "  ?a a ?h ."//
-                + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-                + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-                + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-                + "  ?d <uri:talksTo> ?f . "//
-                + "  ?c <uri:talksTo> ?e . "//
-                + "  ?p <uri:talksTo> ?n . "//
-                + "  ?r <uri:talksTo> ?a . "//
-                + "}";//
-        
-        
-        String q2 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "}";//
-        
-        
-        
-        String q3 = ""//
-                + "SELECT  ?s ?t ?u ?d ?f ?g " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "  ?d a ?f ."//
-                + "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
-                + "  ?g <uri:talksTo> ?d . "//
-                + "}";//
-        
-     
-        
-        
-        SPARQLParser parser = new SPARQLParser();
-
-        ParsedQuery pq1 = null;
-        ParsedQuery pq2 = null;
-        ParsedQuery pq3 = null;
-       
-
-        try {
-            pq1 = parser.parseQuery(q1, null);
-            pq2 = parser.parseQuery(q2, null);
-            pq3 = parser.parseQuery(q3, null);
-          
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
-        SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet((Projection) pq3.getTupleExpr());
-       
-     
-        List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
-
-        list.add(extTup2);
-        list.add(extTup1);
-      
-
-        IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(pq1.getTupleExpr(), list);
-        List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
-        
-        
-        Assert.assertEquals(16, indexSet.size());
-        
-        ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(pq1.getTupleExpr());
-        Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists.newArrayList(indexSet));
-        
-        int size = 0;
-        while(eSet.hasNext()) {
-            size++;
-            Assert.assertTrue(eSet.hasNext());
-            eSet.next();
-        }
-        
-        
-        Assert.assertTrue(!eSet.hasNext());
-        Assert.assertEquals(75, size);
-        
-    }
-    
-    
-    
-    
-    
-    
-    @Test
-    public void largeQueryFourtyIndexTest() {
-        
-        
-        String q1 = ""//
-                + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
-                + "{" //
-                + "  ?f a ?m ."//
-                + "  ?e a ?l ."//
-                + "  ?n a ?o ."//
-                + "  ?a a ?h ."//
-                + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-                + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-                + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-                + "  ?d <uri:talksTo> ?f . "//
-                + "  ?c <uri:talksTo> ?e . "//
-                + "  ?p <uri:talksTo> ?n . "//
-                + "  ?r <uri:talksTo> ?a . "//
-                + "}";//
-        
-        
-        String q2 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "}";//
-        
-        
-        
-        String q3 = ""//
-                + "SELECT  ?s ?t ?u ?d ?f ?g " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "  ?d a ?f ."//
-                + "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
-                + "  ?g <uri:talksTo> ?d . "//
-                + "}";//
-        
-        
-        
-        String q4 = ""//
-                + "SELECT  ?s ?t ?u ?d ?f ?g ?a ?b ?c" //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "  ?d a ?f ."//
-                + "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
-                + "  ?g <uri:talksTo> ?d . "//
-                + "  ?a a ?b ."//
-                + "  ?b <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-                + "  ?c <uri:talksTo> ?a . "//
-                + "}";//
-        
-        
-        SPARQLParser parser = new SPARQLParser();
-
-        ParsedQuery pq1 = null;
-        ParsedQuery pq2 = null;
-        ParsedQuery pq3 = null;
-        ParsedQuery pq4 = null;
-       
-
-        try {
-            pq1 = parser.parseQuery(q1, null);
-            pq2 = parser.parseQuery(q2, null);
-            pq3 = parser.parseQuery(q3, null);
-            pq4 = parser.parseQuery(q4, null);
-           
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
-        SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet((Projection) pq3.getTupleExpr());
-        SimpleExternalTupleSet extTup3 = new SimpleExternalTupleSet((Projection) pq4.getTupleExpr());
-     
-        List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
-
-        list.add(extTup2);
-        list.add(extTup1);
-        list.add(extTup3);
-
-        IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(pq1.getTupleExpr(), list);
-        List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
-        Assert.assertEquals(40, indexSet.size());
-        
-        ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(pq1.getTupleExpr());
-        Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists.newArrayList(indexSet));
-        
-        int size = 0;
-        while(eSet.hasNext()) {
-            size++;
-            Assert.assertTrue(eSet.hasNext());
-            eSet.next();
-        }
-        
-        Assert.assertTrue(!eSet.hasNext());
-        Assert.assertEquals(123, size);
-    }
-    
-    
-    
-    
-    
-    @Test
-    public void overlappingFilterIndex() {
-        
-      
-        String q5 = ""//
-                + "SELECT ?s ?t " //
-                + "{" //
-                + "  ?s a \"Person\" ." //
-                + "  ?t a \"Student\" ."//
-                + "}";//
-        
-        
-        String q4 = ""//
-                + "SELECT ?s ?t " //
-                + "{" //
-                + "  ?s a ?t ."//
-                + "  ?s <uri:talksTo> ?t . "//
-                + "}";//
-        
-        
-        String q3 = ""//
-                + "SELECT ?s ?t  " //
-                + "{" //
-                + "  Filter(?s > 5). "//
-                + "  ?s a ?t ."//
-                + "  ?s <uri:talksTo> ?t . "//
-                + "}";//
-        
-        
-        String q2 = ""//
-                + "SELECT ?s ?t  " //
-                + "{" //
-                + "  Filter(?s > 5). "//
-                + "  ?s a \"Person\" ." //
-                + "  ?t a \"Student\" ."//
-                + "}";//
-        
-        
-        
-        String q1 = ""//
-                + "SELECT  ?s ?t  " //
-                + "{" //
-                + "  Filter(?s > 5). "//
-                + "  ?s a ?t ."//
-                + "  ?s <uri:talksTo> ?t . "//
-                + "  ?s a \"Person\" ." //
-                + "  ?t a \"Student\" ."//
-                + "}";//
-        
-     
-        
-        
-        SPARQLParser parser = new SPARQLParser();
-
-        ParsedQuery pq1 = null;
-        ParsedQuery pq2 = null;
-        ParsedQuery pq3 = null;
-        ParsedQuery pq4 = null;
-        ParsedQuery pq5 = null;
-       
-
-        try {
-            pq1 = parser.parseQuery(q1, null);
-            pq2 = parser.parseQuery(q2, null);
-            pq3 = parser.parseQuery(q3, null);
-            pq4 = parser.parseQuery(q4, null);
-            pq5 = parser.parseQuery(q5, null);
-          
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        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());
-       
-     
-        List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
-
-        list.add(extTup2);
-        list.add(extTup1);
-        list.add(extTup3);
-        list.add(extTup4);
-      
-
-        IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(pq1.getTupleExpr(), list);
-        List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
-        
-
-        
-        Assert.assertEquals(4, indexSet.size());
-        
-        ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(pq1.getTupleExpr());
-        Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists.newArrayList(indexSet));
-        
-        int size = 0;
-        while(eSet.hasNext()) {
-            size++;
-            Assert.assertTrue(eSet.hasNext());
-            List<ExternalTupleSet> eList = eSet.next();
-
-        }
-        
-        
-        Assert.assertTrue(!eSet.hasNext());
-        Assert.assertEquals(7, size);
-        
-    }
-    
-
-    
-    
-    
-    
-    
-    
-    
-    
-    
+	@Test
+	public void singleIndex() {
+		String q1 = ""//
+				+ "SELECT ?f ?m ?d " //
+				+ "{" //
+				+ "  ?f a ?m ."//
+				+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+				+ "  ?d <uri:talksTo> ?f . "//
+				+ "  ?f <uri:hangOutWith> ?m ." //
+				+ "  ?m <uri:hangOutWith> ?d ." //
+				+ "  ?f <uri:associatesWith> ?m ." //
+				+ "  ?m <uri:associatesWith> ?d ." //
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+		ParsedQuery pq1 = null;
+		SimpleExternalTupleSet extTup1 = null;
+
+		try {
+			pq1 = parser.parseQuery(q1, null);
+			extTup1 = new SimpleExternalTupleSet(
+					(Projection) pq1.getTupleExpr());
+
+		} catch (MalformedQueryException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		List<ExternalTupleSet> indexList = Lists.newArrayList();
+		indexList.add(extTup1);
+		ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(
+				pq1.getTupleExpr());
+		Iterator<List<ExternalTupleSet>> combos = vic
+				.getValidIndexCombos(indexList);
+		int size = 0;
+		while (combos.hasNext()) {
+			combos.hasNext();
+			size++;
+			combos.next();
+			combos.hasNext();
+		}
+		Assert.assertTrue(!combos.hasNext());
+		Assert.assertEquals(1, size);
+	}
+
+	@Test
+	public void medQueryEightOverlapIndex() {
+		String q1 = ""//
+				+ "SELECT ?f ?m ?d " //
+				+ "{" //
+				+ "  ?f a ?m ."//
+				+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+				+ "  ?d <uri:talksTo> ?f . "//
+				+ "  ?f <uri:hangOutWith> ?m ." //
+				+ "  ?m <uri:hangOutWith> ?d ." //
+				+ "  ?f <uri:associatesWith> ?m ." //
+				+ "  ?m <uri:associatesWith> ?d ." //
+				+ "}";//
+
+		String q2 = ""//
+				+ "SELECT ?t ?s ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "}";//
+
+		String q3 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s <uri:hangOutWith> ?t ." //
+				+ "  ?t <uri:hangOutWith> ?u ." //
+				+ "}";//
+
+		String q4 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s <uri:associatesWith> ?t ." //
+				+ "  ?t <uri:associatesWith> ?u ." //
+				+ "}";//
+
+		String q5 = ""//
+				+ "SELECT ?t ?s ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "  ?s <uri:hangOutWith> ?t ." //
+				+ "  ?t <uri:hangOutWith> ?u ." //
+				+ "}";//
+
+		String q6 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s <uri:associatesWith> ?t ." //
+				+ "  ?t <uri:associatesWith> ?u ." //
+				+ "  ?s <uri:hangOutWith> ?t ." //
+				+ "  ?t <uri:hangOutWith> ?u ." //
+				+ "}";//
+
+		String q7 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s <uri:associatesWith> ?t ." //
+				+ "  ?t <uri:associatesWith> ?u ." //
+				+ "  ?t <uri:hangOutWith> ?u ." //
+				+ "}";//
+
+		String q8 = ""//
+				+ "SELECT ?t ?s ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "  ?s <uri:associatesWith> ?t ." //
+				+ "}";//
+
+		String q9 = ""//
+				+ "SELECT ?t ?s ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+		ParsedQuery pq1 = null;
+		ParsedQuery pq2 = null;
+		ParsedQuery pq3 = null;
+		ParsedQuery pq4 = null;
+		ParsedQuery pq5 = null;
+		ParsedQuery pq6 = null;
+		ParsedQuery pq7 = null;
+		ParsedQuery pq8 = null;
+		ParsedQuery pq9 = null;
+
+		SimpleExternalTupleSet extTup1 = null;
+		SimpleExternalTupleSet extTup2 = null;
+		SimpleExternalTupleSet extTup3 = null;
+		SimpleExternalTupleSet extTup4 = null;
+		SimpleExternalTupleSet extTup5 = null;
+		SimpleExternalTupleSet extTup6 = null;
+		SimpleExternalTupleSet extTup7 = null;
+		SimpleExternalTupleSet extTup8 = null;
+
+		try {
+			pq1 = parser.parseQuery(q1, null);
+			pq2 = parser.parseQuery(q2, null);
+			pq3 = parser.parseQuery(q3, null);
+			pq4 = parser.parseQuery(q4, null);
+			pq5 = parser.parseQuery(q5, null);
+			pq6 = parser.parseQuery(q6, null);
+			pq7 = parser.parseQuery(q7, null);
+			pq8 = parser.parseQuery(q8, null);
+			pq9 = parser.parseQuery(q9, null);
+
+			extTup1 = new SimpleExternalTupleSet(
+					(Projection) pq2.getTupleExpr());
+			extTup2 = new SimpleExternalTupleSet(
+					(Projection) pq3.getTupleExpr());
+			extTup3 = new SimpleExternalTupleSet(
+					(Projection) pq4.getTupleExpr());
+			extTup4 = new SimpleExternalTupleSet(
+					(Projection) pq5.getTupleExpr());
+			extTup5 = new SimpleExternalTupleSet(
+					(Projection) pq6.getTupleExpr());
+			extTup6 = new SimpleExternalTupleSet(
+					(Projection) pq7.getTupleExpr());
+			extTup7 = new SimpleExternalTupleSet(
+					(Projection) pq8.getTupleExpr());
+			extTup8 = new SimpleExternalTupleSet(
+					(Projection) pq9.getTupleExpr());
+
+		} catch (MalformedQueryException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		List<ExternalTupleSet> indexList = Lists.newArrayList();
+		indexList.add(extTup1);
+		indexList.add(extTup2);
+		indexList.add(extTup3);
+		indexList.add(extTup4);
+		indexList.add(extTup5);
+		indexList.add(extTup6);
+		indexList.add(extTup7);
+		indexList.add(extTup8);
+
+		ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(
+				pq1.getTupleExpr());
+		Iterator<List<ExternalTupleSet>> combos = vic
+				.getValidIndexCombos(indexList);
+		int size = 0;
+		while (combos.hasNext()) {
+			combos.hasNext();
+			size++;
+			combos.next();
+			combos.hasNext();
+		}
+
+		Assert.assertTrue(!combos.hasNext());
+		Assert.assertEquals(21, size);
+
+	}
+
+	@Test
+	public void largeQuerySixteenIndexTest() {
+
+		String q1 = ""//
+				+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
+				+ "{" //
+				+ "  ?f a ?m ."//
+				+ "  ?e a ?l ."//
+				+ "  ?n a ?o ."//
+				+ "  ?a a ?h ."//
+				+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+				+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+				+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+				+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+				+ "  ?d <uri:talksTo> ?f . "//
+				+ "  ?c <uri:talksTo> ?e . "//
+				+ "  ?p <uri:talksTo> ?n . "//
+				+ "  ?r <uri:talksTo> ?a . "//
+				+ "}";//
+
+		String q2 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "}";//
+
+		String q3 = ""//
+				+ "SELECT  ?s ?t ?u ?d ?f ?g " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "  ?d a ?f ."//
+				+ "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
+				+ "  ?g <uri:talksTo> ?d . "//
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+		ParsedQuery pq1 = null;
+		ParsedQuery pq2 = null;
+		ParsedQuery pq3 = null;
+		try {
+			pq1 = parser.parseQuery(q1, null);
+			pq2 = parser.parseQuery(q2, null);
+			pq3 = parser.parseQuery(q3, null);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+				(Projection) pq2.getTupleExpr());
+		SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(
+				(Projection) pq3.getTupleExpr());
+
+		List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
+
+		list.add(extTup2);
+		list.add(extTup1);
+
+		IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(
+				pq1.getTupleExpr(), list);
+		List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
+
+		Assert.assertEquals(16, indexSet.size());
+
+		ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(
+				pq1.getTupleExpr());
+		Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists
+				.newArrayList(indexSet));
+
+		int size = 0;
+		while (eSet.hasNext()) {
+			size++;
+			Assert.assertTrue(eSet.hasNext());
+			eSet.next();
+		}
+
+		Assert.assertTrue(!eSet.hasNext());
+		Assert.assertEquals(75, size);
+
+	}
+
+	@Test
+	public void largeQueryFourtyIndexTest() {
+
+		String q1 = ""//
+				+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
+				+ "{" //
+				+ "  ?f a ?m ."//
+				+ "  ?e a ?l ."//
+				+ "  ?n a ?o ."//
+				+ "  ?a a ?h ."//
+				+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+				+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+				+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+				+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+				+ "  ?d <uri:talksTo> ?f . "//
+				+ "  ?c <uri:talksTo> ?e . "//
+				+ "  ?p <uri:talksTo> ?n . "//
+				+ "  ?r <uri:talksTo> ?a . "//
+				+ "}";//
+
+		String q2 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "}";//
+
+		String q3 = ""//
+				+ "SELECT  ?s ?t ?u ?d ?f ?g " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "  ?d a ?f ."//
+				+ "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
+				+ "  ?g <uri:talksTo> ?d . "//
+				+ "}";//
+
+		String q4 = ""//
+				+ "SELECT  ?s ?t ?u ?d ?f ?g ?a ?b ?c" //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "  ?d a ?f ."//
+				+ "  ?f <http://www.w3.org/2000/01/rdf-schema#label> ?g ."//
+				+ "  ?g <uri:talksTo> ?d . "//
+				+ "  ?a a ?b ."//
+				+ "  ?b <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+				+ "  ?c <uri:talksTo> ?a . "//
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+
+		ParsedQuery pq1 = null;
+		ParsedQuery pq2 = null;
+		ParsedQuery pq3 = null;
+		ParsedQuery pq4 = null;
+
+		try {
+			pq1 = parser.parseQuery(q1, null);
+			pq2 = parser.parseQuery(q2, null);
+			pq3 = parser.parseQuery(q3, null);
+			pq4 = parser.parseQuery(q4, null);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+				(Projection) pq2.getTupleExpr());
+		SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(
+				(Projection) pq3.getTupleExpr());
+		SimpleExternalTupleSet extTup3 = new SimpleExternalTupleSet(
+				(Projection) pq4.getTupleExpr());
+
+		List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
+
+		list.add(extTup2);
+		list.add(extTup1);
+		list.add(extTup3);
+
+		IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(
+				pq1.getTupleExpr(), list);
+		List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
+		Assert.assertEquals(40, indexSet.size());
+
+		ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(
+				pq1.getTupleExpr());
+		Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists
+				.newArrayList(indexSet));
+
+		int size = 0;
+		while (eSet.hasNext()) {
+			size++;
+			Assert.assertTrue(eSet.hasNext());
+			eSet.next();
+		}
+
+		Assert.assertTrue(!eSet.hasNext());
+		Assert.assertEquals(123, size);
+	}
+
+	@Test
+	public void overlappingFilterIndex() {
+
+		String q5 = ""//
+				+ "SELECT ?s ?t " //
+				+ "{" //
+				+ "  ?s a \"Person\" ." //
+				+ "  ?t a \"Student\" ."//
+				+ "}";//
+
+		String q4 = ""//
+				+ "SELECT ?s ?t " //
+				+ "{" //
+				+ "  ?s a ?t ."//
+				+ "  ?s <uri:talksTo> ?t . "//
+				+ "}";//
+
+		String q3 = ""//
+				+ "SELECT ?s ?t  " //
+				+ "{" //
+				+ "  Filter(?s > 5). "//
+				+ "  ?s a ?t ."//
+				+ "  ?s <uri:talksTo> ?t . "//
+				+ "}";//
+
+		String q2 = ""//
+				+ "SELECT ?s ?t  " //
+				+ "{" //
+				+ "  Filter(?s > 5). "//
+				+ "  ?s a \"Person\" ." //
+				+ "  ?t a \"Student\" ."//
+				+ "}";//
+
+		String q1 = ""//
+				+ "SELECT  ?s ?t  " //
+				+ "{" //
+				+ "  Filter(?s > 5). "//
+				+ "  ?s a ?t ."//
+				+ "  ?s <uri:talksTo> ?t . "//
+				+ "  ?s a \"Person\" ." //
+				+ "  ?t a \"Student\" ."//
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+
+		ParsedQuery pq1 = null;
+		ParsedQuery pq2 = null;
+		ParsedQuery pq3 = null;
+		ParsedQuery pq4 = null;
+		ParsedQuery pq5 = null;
+
+		try {
+			pq1 = parser.parseQuery(q1, null);
+			pq2 = parser.parseQuery(q2, null);
+			pq3 = parser.parseQuery(q3, null);
+			pq4 = parser.parseQuery(q4, null);
+			pq5 = parser.parseQuery(q5, null);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		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());
+
+		List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
+
+		list.add(extTup2);
+		list.add(extTup1);
+		list.add(extTup3);
+		list.add(extTup4);
+
+		IndexedExecutionPlanGenerator iep = new IndexedExecutionPlanGenerator(
+				pq1.getTupleExpr(), list);
+		List<ExternalTupleSet> indexSet = iep.getNormalizedIndices();
+
+		Assert.assertEquals(4, indexSet.size());
+
+		ValidIndexCombinationGenerator vic = new ValidIndexCombinationGenerator(
+				pq1.getTupleExpr());
+		Iterator<List<ExternalTupleSet>> eSet = vic.getValidIndexCombos(Lists
+				.newArrayList(indexSet));
+
+		int size = 0;
+		while (eSet.hasNext()) {
+			size++;
+			Assert.assertTrue(eSet.hasNext());
+			List<ExternalTupleSet> eList = eSet.next();
+
+		}
+
+		Assert.assertTrue(!eSet.hasNext());
+		Assert.assertEquals(7, size);
+
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/c12f58f4/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/VarConstantIndexListPrunerTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/VarConstantIndexListPrunerTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/VarConstantIndexListPrunerTest.java
index 181d4fb..f867052 100644
--- a/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/VarConstantIndexListPrunerTest.java
+++ b/extras/indexing/src/test/java/mvm/rya/indexing/IndexPlanValidator/VarConstantIndexListPrunerTest.java
@@ -8,9 +8,9 @@ package mvm.rya.indexing.IndexPlanValidator;
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,25 +19,16 @@ package mvm.rya.indexing.IndexPlanValidator;
  * under the License.
  */
 
-
-import static org.junit.Assert.*;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
-import mvm.rya.indexing.external.ExternalProcessor;
 import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
 import mvm.rya.indexing.external.tupleSet.SimpleExternalTupleSet;
-import mvm.rya.indexing.external.tupleSet.ExternalProcessorTest.ExternalTupleVstor;
 
 import org.junit.Assert;
 import org.junit.Test;
 import org.openrdf.query.algebra.Projection;
-import org.openrdf.query.algebra.QueryModelNode;
-import org.openrdf.query.algebra.StatementPattern;
-import org.openrdf.query.algebra.TupleExpr;
-import org.openrdf.query.algebra.helpers.StatementPatternCollector;
 import org.openrdf.query.parser.ParsedQuery;
 import org.openrdf.query.parser.sparql.SPARQLParser;
 
@@ -45,285 +36,261 @@ import com.google.common.collect.Sets;
 
 public class VarConstantIndexListPrunerTest {
 
-    
-    
-    private String q7 = ""//
-            + "SELECT ?s ?t ?u " //
-            + "{" //
-            + "  ?s a ?t ."//
-            + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-            + "  ?u <uri:talksTo> ?s . "//
-            + "}";//
-    
-    
-    private String q8 = ""//
-            + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
-            + "{" //
-            + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-            + "  ?f a ?m ."//
-            + "  ?p <uri:talksTo> ?n . "//
-            + "  ?e a ?l ."//
-            + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-            + "  ?d <uri:talksTo> ?f . "//
-            + "  ?c <uri:talksTo> ?e . "//
-            + "  ?n a ?o ."//
-            + "  ?a a ?h ."//
-            + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-            + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-            + "  ?r <uri:talksTo> ?a . "//
-            + "}";//
-    
-    
-    
-    
-    private String q11 = ""//
-            + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit " //
-            + "{" //
-            + "  ?w a ?t ."//
-            + "  ?x a ?y ."//
-            + "  ?duck a ?chicken ."//
-            + "  ?pig a ?rabbit ."//
-            + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-            + "  ?f a ?m ."//
-            + "  ?p <uri:talksTo> ?n . "//
-            + "  ?e a ?l ."//
-            + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-            + "  ?d <uri:talksTo> ?f . "//
-            + "  ?c <uri:talksTo> ?e . "//
-            + "  ?n a ?o ."//
-            + "  ?a a ?h ."//
-            + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-            + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-            + "  ?r <uri:talksTo> ?a . "//
-            + "}";//
-    
-    
-    private String q12 = ""//
-            + "SELECT ?b ?p ?dog ?cat " //
-            + "{" //
-            + "  ?b a ?p ."//
-            + "  ?dog a ?cat. "//
-            + "}";//
-    
-    
-    
-    private String q13 = ""//
-            + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit ?dick ?jane ?betty " //
-            + "{" //
-            + "  ?w a ?t ."//
-            + "  ?x a ?y ."//
-            + "  ?duck a ?chicken ."//
-            + "  ?pig a ?rabbit ."//
-            + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-            + "  ?f a ?m ."//
-            + "  ?p <uri:talksTo> ?n . "//
-            + "  ?e a ?l ."//
-            + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-            + "  ?d <uri:talksTo> ?f . "//
-            + "  ?c <uri:talksTo> ?e . "//
-            + "  ?n a ?o ."//
-            + "  ?a a ?h ."//
-            + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-            + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-            + "  ?r <uri:talksTo> ?a . "//
-            + "  ?dick <uri:talksTo> ?jane . "//
-            + "  ?jane <uri:talksTo> ?betty . "//
-            + "}";//
-    
-    private String q14 = ""//
-            + "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit " //
-            + "{" //
-            + "  ?w a ?t ."//
-            + "  ?x a ?y ."//
-            + "  ?duck a ?chicken ."//
-            + "  ?pig a ?rabbit ."//
-            + "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
-            + "  ?f a ?m ."//
-            + "  ?p <uri:talksTo> ?n . "//
-            + "  ?e a ?l ."//
-            + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
-            + "  ?d <uri:talksTo> ?f . "//
-            + "  ?c <uri:talksTo> ?e . "//
-            + "  ?n a ?o ."//
-            + "  ?a a ?h ."//
-            + "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
-            + "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
-            + "  ?r <uri:talksTo> ?a . "//
-            + "  ?d <uri:talksTo> ?a . "//
-            + "}";//
-    
-    
-
-    private String q15 = ""//
-            + "SELECT ?s ?t ?u " //
-            + "{" //
-            + "  Filter(?s > 1)."//
-            + "  ?s a ?t ."//
-            + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-            + "  ?u <uri:talksTo> ?s . "//
-            + "}";//
-    
-    private String q16 = ""//
-            + "SELECT ?s ?t ?u " //
-            + "{" //
-            + "  Filter(?s > 2)."//
-            + "  ?s a ?t ."//
-            + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-            + "  ?u <uri:talksTo> ?s . "//
-            + "}";//
-    
-    private String q17 = ""//
-            + "SELECT ?s ?t ?u " //
-            + "{" //
-            + "  Filter(?t > 1)."//
-            + "  ?s a ?t ."//
-            + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-            + "  ?u <uri:talksTo> ?s . "//
-            + "}";//
-
-    
-    
-    @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());
-        Set<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, processedIndexSet).equals(processedIndexSet));
-        
-
-
-    }
-
-    
-    
-    
-    
-    @Test
-    public void testTwoIndexFilter1() throws Exception {
-
-        SPARQLParser parser = new SPARQLParser();
-        
-
-        ParsedQuery pq1 = parser.parseQuery(q15, null);
-        ParsedQuery pq2 = parser.parseQuery(q16, null);
-        ParsedQuery pq3 = parser.parseQuery(q17, null);
-       
-        System.out.println("Query is " + pq1.getTupleExpr());
-        
-        SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
-        SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet((Projection)pq3.getTupleExpr());
-       
-        List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
-        list.add(extTup1);
-        list.add(extTup2);
-        
-        VarConstantIndexListPruner vci = new VarConstantIndexListPruner(pq1.getTupleExpr());
-        Set<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(extTup2);
-       
-        
-        Assert.assertTrue(Sets.intersection(indexSet, processedIndexSet).equals(processedIndexSet));
-        
-
-
-    }
-    
-    
-    
-    @Test
-    public void testTwoIndexFilter2() throws Exception {
-
-        
-        String q18 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  Filter(?s > 1 && ?t > 8)." //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "}";//
-        
-        
-        String q19 = ""//
-                + "SELECT ?s ?t ?u " //
-                + "{" //
-                + "  Filter(?s > 1)." //
-                + "  Filter(?t > 8)." //
-                + "  ?s a ?t ."//
-                + "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
-                + "  ?u <uri:talksTo> ?s . "//
-                + "}";//
-        
-        
-        
-        SPARQLParser parser = new SPARQLParser();
-        
-
-        ParsedQuery pq1 = parser.parseQuery(q18, null);
-        ParsedQuery pq2 = parser.parseQuery(q19, null);
-       
-        System.out.println("Query is " + pq1.getTupleExpr());
-        
-        SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet((Projection) pq2.getTupleExpr());
-        
-        List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
-        list.add(extTup1);
-        
-        VarConstantIndexListPruner vci = new VarConstantIndexListPruner(pq1.getTupleExpr());
-        Set<ExternalTupleSet> processedIndexSet = vci.getRelevantIndices(list);
-        
-        Assert.assertTrue(processedIndexSet.isEmpty());
-        
-
-
-    }
-    
-    
-    
-    
+	private String q7 = ""//
+			+ "SELECT ?s ?t ?u " //
+			+ "{" //
+			+ "  ?s a ?t ."//
+			+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+			+ "  ?u <uri:talksTo> ?s . "//
+			+ "}";//
+
+	private String q8 = ""//
+			+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r " //
+			+ "{" //
+			+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+			+ "  ?f a ?m ."//
+			+ "  ?p <uri:talksTo> ?n . "//
+			+ "  ?e a ?l ."//
+			+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+			+ "  ?d <uri:talksTo> ?f . "//
+			+ "  ?c <uri:talksTo> ?e . "//
+			+ "  ?n a ?o ."//
+			+ "  ?a a ?h ."//
+			+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+			+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+			+ "  ?r <uri:talksTo> ?a . "//
+			+ "}";//
+
+	private String q11 = ""//
+			+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit " //
+			+ "{" //
+			+ "  ?w a ?t ."//
+			+ "  ?x a ?y ."//
+			+ "  ?duck a ?chicken ."//
+			+ "  ?pig a ?rabbit ."//
+			+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+			+ "  ?f a ?m ."//
+			+ "  ?p <uri:talksTo> ?n . "//
+			+ "  ?e a ?l ."//
+			+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+			+ "  ?d <uri:talksTo> ?f . "//
+			+ "  ?c <uri:talksTo> ?e . "//
+			+ "  ?n a ?o ."//
+			+ "  ?a a ?h ."//
+			+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+			+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+			+ "  ?r <uri:talksTo> ?a . "//
+			+ "}";//
+
+	private String q12 = ""//
+			+ "SELECT ?b ?p ?dog ?cat " //
+			+ "{" //
+			+ "  ?b a ?p ."//
+			+ "  ?dog a ?cat. "//
+			+ "}";//
+
+	private String q13 = ""//
+			+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit ?dick ?jane ?betty " //
+			+ "{" //
+			+ "  ?w a ?t ."//
+			+ "  ?x a ?y ."//
+			+ "  ?duck a ?chicken ."//
+			+ "  ?pig a ?rabbit ."//
+			+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+			+ "  ?f a ?m ."//
+			+ "  ?p <uri:talksTo> ?n . "//
+			+ "  ?e a ?l ."//
+			+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+			+ "  ?d <uri:talksTo> ?f . "//
+			+ "  ?c <uri:talksTo> ?e . "//
+			+ "  ?n a ?o ."//
+			+ "  ?a a ?h ."//
+			+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+			+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+			+ "  ?r <uri:talksTo> ?a . "//
+			+ "  ?dick <uri:talksTo> ?jane . "//
+			+ "  ?jane <uri:talksTo> ?betty . "//
+			+ "}";//
+
+	private String q14 = ""//
+			+ "SELECT ?f ?m ?d ?e ?l ?c ?n ?o ?p ?a ?h ?r ?x ?y ?w ?t ?duck ?chicken ?pig ?rabbit " //
+			+ "{" //
+			+ "  ?w a ?t ."//
+			+ "  ?x a ?y ."//
+			+ "  ?duck a ?chicken ."//
+			+ "  ?pig a ?rabbit ."//
+			+ "  ?h <http://www.w3.org/2000/01/rdf-schema#label> ?r ."//
+			+ "  ?f a ?m ."//
+			+ "  ?p <uri:talksTo> ?n . "//
+			+ "  ?e a ?l ."//
+			+ "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?p ."//
+			+ "  ?d <uri:talksTo> ?f . "//
+			+ "  ?c <uri:talksTo> ?e . "//
+			+ "  ?n a ?o ."//
+			+ "  ?a a ?h ."//
+			+ "  ?m <http://www.w3.org/2000/01/rdf-schema#label> ?d ."//
+			+ "  ?l <http://www.w3.org/2000/01/rdf-schema#label> ?c ."//
+			+ "  ?r <uri:talksTo> ?a . "//
+			+ "  ?d <uri:talksTo> ?a . "//
+			+ "}";//
+
+	private String q15 = ""//
+			+ "SELECT ?s ?t ?u " //
+			+ "{" //
+			+ "  Filter(?s > 1)."//
+			+ "  ?s a ?t ."//
+			+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+			+ "  ?u <uri:talksTo> ?s . "//
+			+ "}";//
+
+	private String q16 = ""//
+			+ "SELECT ?s ?t ?u " //
+			+ "{" //
+			+ "  Filter(?s > 2)."//
+			+ "  ?s a ?t ."//
+			+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+			+ "  ?u <uri:talksTo> ?s . "//
+			+ "}";//
+
+	private String q17 = ""//
+			+ "SELECT ?s ?t ?u " //
+			+ "{" //
+			+ "  Filter(?t > 1)."//
+			+ "  ?s a ?t ."//
+			+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+			+ "  ?u <uri:talksTo> ?s . "//
+			+ "}";//
+
+	@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.<ExternalTupleSet> newHashSet(processedIndexSet))
+				.equals(Sets.<ExternalTupleSet> newHashSet(processedIndexSet)));
+
+	}
+
+	@Test
+	public void testTwoIndexFilter1() throws Exception {
+
+		SPARQLParser parser = new SPARQLParser();
+
+		ParsedQuery pq1 = parser.parseQuery(q15, null);
+		ParsedQuery pq2 = parser.parseQuery(q16, null);
+		ParsedQuery pq3 = parser.parseQuery(q17, null);
+
+		System.out.println("Query is " + pq1.getTupleExpr());
+
+		SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+				(Projection) pq2.getTupleExpr());
+		SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(
+				(Projection) pq3.getTupleExpr());
+
+		List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
+		list.add(extTup1);
+		list.add(extTup2);
+
+		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(extTup2);
+
+		Assert.assertTrue(Sets.intersection(indexSet,
+				Sets.<ExternalTupleSet> newHashSet(processedIndexSet)).equals(
+						Sets.<ExternalTupleSet> newHashSet(processedIndexSet)));
+
+	}
+
+	@Test
+	public void testTwoIndexFilter2() throws Exception {
+
+		String q18 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  Filter(?s > 1 && ?t > 8)." //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "}";//
+
+		String q19 = ""//
+				+ "SELECT ?s ?t ?u " //
+				+ "{" //
+				+ "  Filter(?s > 1)." //
+				+ "  Filter(?t > 8)." //
+				+ "  ?s a ?t ."//
+				+ "  ?t <http://www.w3.org/2000/01/rdf-schema#label> ?u ."//
+				+ "  ?u <uri:talksTo> ?s . "//
+				+ "}";//
+
+		SPARQLParser parser = new SPARQLParser();
+
+		ParsedQuery pq1 = parser.parseQuery(q18, null);
+		ParsedQuery pq2 = parser.parseQuery(q19, null);
+
+		System.out.println("Query is " + pq1.getTupleExpr());
+
+		SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+				(Projection) pq2.getTupleExpr());
+
+		List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
+		list.add(extTup1);
+
+		VarConstantIndexListPruner vci = new VarConstantIndexListPruner(
+				pq1.getTupleExpr());
+		List<ExternalTupleSet> processedIndexSet = vci.getRelevantIndices(list);
+
+		Assert.assertTrue(processedIndexSet.isEmpty());
 
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/c12f58f4/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantIndexSetTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantIndexSetTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantIndexSetTest.java
deleted file mode 100644
index 98acf39..0000000
--- a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantIndexSetTest.java
+++ /dev/null
@@ -1,831 +0,0 @@
-package mvm.rya.indexing.external;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import junit.framework.Assert;
-import mvm.rya.indexing.IndexPlanValidator.IndexPlanValidator;
-import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet;
-import mvm.rya.indexing.external.tupleSet.ExternalProcessorTest.ExternalTupleVstor;
-import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
-
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableExistsException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.junit.Test;
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.LiteralImpl;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.model.vocabulary.RDF;
-import org.openrdf.model.vocabulary.RDFS;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.MalformedQueryException;
-import org.openrdf.query.QueryEvaluationException;
-import org.openrdf.query.QueryLanguage;
-import org.openrdf.query.QueryResultHandlerException;
-import org.openrdf.query.TupleQueryResultHandler;
-import org.openrdf.query.TupleQueryResultHandlerException;
-import org.openrdf.query.algebra.TupleExpr;
-import org.openrdf.query.parser.ParsedQuery;
-import org.openrdf.query.parser.sparql.SPARQLParser;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.repository.sail.SailRepositoryConnection;
-import org.openrdf.sail.Sail;
-import org.openrdf.sail.SailException;
-import org.openrdf.sail.memory.MemoryStore;
-
-import com.beust.jcommander.internal.Sets;
-import com.google.common.collect.Lists;
-
-public class AccumuloConstantIndexSetTest {
-
-    
-    private SailRepositoryConnection conn;
-    private Connector accCon;
-    String tablename = "table";
-    Sail s;
-    URI obj, obj2, subclass, subclass2, talksTo;
-
-    @Before
-    public void init() throws RepositoryException, TupleQueryResultHandlerException, QueryEvaluationException,
-            MalformedQueryException, AccumuloException, AccumuloSecurityException, TableExistsException {
-
-        s = new MemoryStore();
-        SailRepository repo = new SailRepository(s);
-        repo.initialize();
-        conn = repo.getConnection();
-
-        URI sub = new URIImpl("uri:entity");
-        subclass = new URIImpl("uri:class");
-        obj = new URIImpl("uri:obj");
-        talksTo = new URIImpl("uri:talksTo");
-
-        conn.add(sub, RDF.TYPE, subclass);
-        conn.add(sub, RDFS.LABEL, new LiteralImpl("label"));
-        conn.add(sub, talksTo, obj);
-
-        URI sub2 = new URIImpl("uri:entity2");
-        subclass2 = new URIImpl("uri:class2");
-        obj2 = new URIImpl("uri:obj2");
-
-        conn.add(sub2, RDF.TYPE, subclass2);
-        conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2"));
-        conn.add(sub2, talksTo, obj2);
-
-        accCon = new MockInstance().getConnector("root", "".getBytes());
-        accCon.tableOperations().create(tablename);
-
-    }
-    
-    
-    
-    
-    @Test
-    public void testEvaluateTwoIndexVarInstantiate1() {
-
-        URI superclass = new URIImpl("uri:superclass");
-        URI superclass2 = new URIImpl("uri:superclass2");
-
-        try {
-            conn.add(subclass, RDF.TYPE, superclass);
-            conn.add(subclass2, RDF.TYPE, superclass2);
-            conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
-            conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
-        } catch (RepositoryException e5) {
-            // TODO Auto-generated catch block
-            e5.printStackTrace();
-        }
-
-        try {
-            if (accCon.tableOperations().exists("table2")) {
-                accCon.tableOperations().delete("table2");
-            }
-            accCon.tableOperations().create("table2");
-        } catch (AccumuloException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (AccumuloSecurityException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (TableExistsException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (TableNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        try {
-            conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
-            conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
-        } catch (RepositoryException e3) {
-            // TODO Auto-generated catch block
-            e3.printStackTrace();
-        }
-
-        // TODO Auto-generated method stub
-        String indexSparqlString = ""//
-                + "SELECT ?dog ?pig ?duck  " //
-                + "{" //
-                + "  ?pig a ?dog . "//
-                + "  ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "//
-                + "}";//
-
-        String indexSparqlString2 = ""//
-                + "SELECT ?o ?f ?e ?c ?l  " //
-                + "{" //
-                + "  ?e <uri:talksTo> ?o . "//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  ?c a ?f . " //
-                + "}";//
-
-        String queryString = ""//
-                + "SELECT ?c ?l ?f ?o " //
-                + "{" //
-                + "  <uri:entity> a ?c . "//
-                + "  <uri:entity> <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  <uri:entity> <uri:talksTo> ?o . "//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  ?c a ?f . " //
-                + "}";//
-
-     
-
-        List<ExternalTupleSet> index = Lists.newArrayList();
-        AccumuloIndexSet ais1 = null;
-        AccumuloIndexSet ais2 = null;
-
-        try {
-            ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename);
-            ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2");
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (SailException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (QueryEvaluationException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (MutationsRejectedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (TableNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-      
-       
-        CountingResultHandler crh1 = new CountingResultHandler();
-        CountingResultHandler crh2 = new CountingResultHandler();
-
-        try {
-            conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1);
-        } catch (TupleQueryResultHandlerException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (QueryEvaluationException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (MalformedQueryException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (RepositoryException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
-
-        ParsedQuery pq = null;
-        SPARQLParser sp = new SPARQLParser();
-        try {
-            pq = sp.parseQuery(queryString, null);
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        index.add(ais1);
-        index.add(ais2);
-        
-        ExternalProcessor processor = new ExternalProcessor(index);
-
-        Sail processingSail = new ExternalSail(s, processor);
-        SailRepository smartSailRepo = new SailRepository(processingSail);
-        try {
-            smartSailRepo.initialize();
-        } catch (RepositoryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        
-        try {
-            smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2);
-        } catch (TupleQueryResultHandlerException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (QueryEvaluationException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (RepositoryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        
-       
-        Assert.assertEquals(crh1.getCount(), crh2.getCount());
-
-    }
-    
-    
-    
-    
-    
-  @Test
-    public void testEvaluateThreeIndexVarInstantiate() {
-
-        URI superclass = new URIImpl("uri:superclass");
-        URI superclass2 = new URIImpl("uri:superclass2");
-
-        URI sub = new URIImpl("uri:entity");
-        subclass = new URIImpl("uri:class");
-        obj = new URIImpl("uri:obj");
-        talksTo = new URIImpl("uri:talksTo");
-
-        URI howlsAt = new URIImpl("uri:howlsAt");
-        URI subType = new URIImpl("uri:subType");
-        
-
-        try {
-            conn.add(subclass, RDF.TYPE, superclass);
-            conn.add(subclass2, RDF.TYPE, superclass2);
-            conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
-            conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
-            conn.add(sub, howlsAt, superclass);
-            conn.add(superclass, subType, obj);
-        } catch (RepositoryException e5) {
-            // TODO Auto-generated catch block
-            e5.printStackTrace();
-        }
-
-        try {
-            if (accCon.tableOperations().exists("table2")) {
-                accCon.tableOperations().delete("table2");
-            }
-            accCon.tableOperations().create("table2");
-
-            if (accCon.tableOperations().exists("table3")) {
-                accCon.tableOperations().delete("table3");
-            }
-            accCon.tableOperations().create("table3");
-        } catch (AccumuloException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (AccumuloSecurityException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (TableExistsException e4) {
-            // TODO Auto-generated catch block
-            e4.printStackTrace();
-        } catch (TableNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        try {
-            conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
-            conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
-        } catch (RepositoryException e3) {
-            // TODO Auto-generated catch block
-            e3.printStackTrace();
-        }
-
-        // TODO Auto-generated method stub
-        String indexSparqlString = ""//
-                + "SELECT ?dog ?pig ?duck  " //
-                + "{" //
-                + "  ?pig a ?dog . "//
-                + "  ?pig <http://www.w3.org/2000/01/rdf-schema#label> ?duck "//
-                + "}";//
-
-        String indexSparqlString2 = ""//
-                + "SELECT ?o ?f ?e ?c ?l  " //
-                + "{" //
-                + "  ?e <uri:talksTo> ?o . "//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  ?c a ?f . " //
-                + "}";//
-
-        String indexSparqlString3 = ""//
-                + "SELECT ?wolf ?sheep ?chicken  " //
-                + "{" //
-                + "  ?wolf <uri:howlsAt> ?sheep . "// 
-                + "  ?sheep <uri:subType> ?chicken. "//
-                + "}";//
-
-        String queryString = ""//
-                + "SELECT ?c ?l ?f ?o " //
-                + "{" //
-                + "  <uri:entity> a ?c . "//
-                + "  <uri:entity> <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  <uri:entity> <uri:talksTo> ?o . "//
-                + "  ?o <http://www.w3.org/2000/01/rdf-schema#label> ?l. "//
-                + "  ?c a ?f . " //
-                + "  <uri:entity> <uri:howlsAt> ?f. "//
-                + "  ?f <uri:subType> <uri:obj>. "//
-                + "}";//
-
-
-        List<ExternalTupleSet> index = Lists.newArrayList();
-        AccumuloIndexSet ais1 = null;
-        AccumuloIndexSet ais2 = null;
-        AccumuloIndexSet ais3 = null;
-
-        try {
-            ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename);
-            ais2 = new AccumuloIndexSet(indexSparqlString2, conn, accCon, "table2");
-            ais3 = new AccumuloIndexSet(indexSparqlString3, conn, accCon, "table3");
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (SailException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (QueryEvaluationException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (MutationsRejectedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (TableNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        index.add(ais1);
-        index.add(ais3);
-        index.add(ais2);
-
-        CountingResultHandler crh1 = new CountingResultHandler();
-        CountingResultHandler crh2 = new CountingResultHandler();
-
-        try {
-            conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1);
-        } catch (TupleQueryResultHandlerException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (QueryEvaluationException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (MalformedQueryException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        } catch (RepositoryException e1) {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
-
-        ExternalProcessor processor = new ExternalProcessor(index);
-
-        Sail processingSail = new ExternalSail(s, processor);
-        SailRepository smartSailRepo = new SailRepository(processingSail);
-        try {
-            smartSailRepo.initialize();
-        } catch (RepositoryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        
-        try {
-            smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2);
-        } catch (TupleQueryResultHandlerException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (QueryEvaluationException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (MalformedQueryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (RepositoryException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        
-       
-        
-        
-        
-       
-//         Scanner s = null;
-//        try {
-//            s = accCon.createScanner("table3", new Authorizations());
-//        } catch (TableNotFoundException e) {
-//            // TODO Auto-generated catch block
-//            e.printStackTrace();
-//        } 
-//         s.setRange(new Range());       
-//         Iterator<Entry<Key,Value>> i = s.iterator();
-//         
-//         while (i.hasNext()) {
-//             Entry<Key, Value> entry = i.next();
-//             Key k = entry.getKey();
-//             System.out.println(k);
-//
-//         } 
-        
-        
-        
-        
-        
-        
-        Assert.assertEquals(crh1.getCount(), crh2.getCount());
-
-        
-        
-        
-        
-
-    }
-    
-    
-    
-    
-    
-    
-  @Test
-  public void testEvaluateFilterInstantiate() {
-
-      URI e1 = new URIImpl("uri:e1");
-      URI e2 = new URIImpl("uri:e2");
-      URI e3 = new URIImpl("uri:e3");
-      URI f1 = new URIImpl("uri:f1");
-      URI f2 = new URIImpl("uri:f2");
-      URI f3 = new URIImpl("uri:f3");
-      URI g1 = new URIImpl("uri:g1");
-      URI g2 = new URIImpl("uri:g2");
-      URI g3 = new URIImpl("uri:g3");
-      
-
-      
-      try {
-          conn.add(e1, talksTo, f1);
-          conn.add(f1, talksTo, g1);
-          conn.add(g1, talksTo, e1);
-          conn.add(e2, talksTo, f2);
-          conn.add(f2, talksTo, g2);
-          conn.add(g2, talksTo, e2);
-          conn.add(e3, talksTo, f3);
-          conn.add(f3, talksTo, g3);
-          conn.add(g3, talksTo, e3);
-      } catch (RepositoryException e5) {
-          // TODO Auto-generated catch block
-          e5.printStackTrace();
-      }
-
-
-      String queryString = ""//
-              + "SELECT ?x ?y ?z " //
-              + "{" //
-              + "Filter(?x = <uri:e1>) . " //
-              + " ?x <uri:talksTo> ?y. " //
-              + " ?y <uri:talksTo> ?z. " //
-              + " ?z <uri:talksTo> <uri:e1>. " //
-              + "}";//
-      
-      
-      
-      String indexSparqlString = ""//
-              + "SELECT ?a ?b ?c ?d " //
-              + "{" //
-              + "Filter(?a = ?d) . " //
-              + " ?a <uri:talksTo> ?b. " //
-              + " ?b <uri:talksTo> ?c. " //
-              + " ?c <uri:talksTo> ?d. " //
-              + "}";//
-      
-
-
-      List<ExternalTupleSet> index = Lists.newArrayList();
-      AccumuloIndexSet ais1 = null;
-
-      try {
-          ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename);
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (SailException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MutationsRejectedException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (TableNotFoundException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      index.add(ais1);
-   
-      CountingResultHandler crh1 = new CountingResultHandler();
-      CountingResultHandler crh2 = new CountingResultHandler();
-
-      try {
-          conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1);
-      } catch (TupleQueryResultHandlerException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      ExternalProcessor processor = new ExternalProcessor(index);
-
-      Sail processingSail = new ExternalSail(s, processor);
-      SailRepository smartSailRepo = new SailRepository(processingSail);
-      try {
-          smartSailRepo.initialize();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      
-      try {
-          smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2);
-      } catch (TupleQueryResultHandlerException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-      
-    
-      
-       
-      
-      
-      
-      
-      Assert.assertEquals(crh1.getCount(), crh2.getCount());
-
-      
-      
-      
-      
-
-  }
-  
-  
-  
-  
-  @Test
-  public void testEvaluateCompoundFilterInstantiate() {
-
-      URI e1 = new URIImpl("uri:e1");
-      URI f1 = new URIImpl("uri:f1");
-      
-      
-      try {
-          conn.add(e1, talksTo, e1);
-          conn.add(e1, talksTo, f1);
-          conn.add(f1, talksTo, e1);
-
-      } catch (RepositoryException e5) {
-          // TODO Auto-generated catch block
-          e5.printStackTrace();
-      }
-
-
-      String queryString = ""//
-              + "SELECT ?x ?y ?z " //
-              + "{" //
-              + "Filter(?x = <uri:e1> && ?y = <uri:e1>) . " //
-              + " ?x <uri:talksTo> ?y. " //
-              + " ?y <uri:talksTo> ?z. " //
-              + " ?z <uri:talksTo> <uri:e1>. " //
-              + "}";//
-      
-      
-      
-      String indexSparqlString = ""//
-              + "SELECT ?a ?b ?c ?d " //
-              + "{" //
-              + "Filter(?a = ?d && ?b = ?d) . " //
-              + " ?a <uri:talksTo> ?b. " //
-              + " ?b <uri:talksTo> ?c. " //
-              + " ?c <uri:talksTo> ?d. " //
-              + "}";//
-      
-
-
-      List<ExternalTupleSet> index = Lists.newArrayList();
-      AccumuloIndexSet ais1 = null;
-
-      try {
-          ais1 = new AccumuloIndexSet(indexSparqlString, conn, accCon, tablename);
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (SailException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MutationsRejectedException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (TableNotFoundException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      index.add(ais1);
-   
-      CountingResultHandler crh1 = new CountingResultHandler();
-      CountingResultHandler crh2 = new CountingResultHandler();
-
-      try {
-          conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh1);
-      } catch (TupleQueryResultHandlerException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      ExternalProcessor processor = new ExternalProcessor(index);
-
-      Sail processingSail = new ExternalSail(s, processor);
-      SailRepository smartSailRepo = new SailRepository(processingSail);
-      try {
-          smartSailRepo.initialize();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-
-      
-      try {
-          smartSailRepo.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString).evaluate(crh2);
-      } catch (TupleQueryResultHandlerException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (QueryEvaluationException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (MalformedQueryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      } catch (RepositoryException e) {
-          // TODO Auto-generated catch block
-          e.printStackTrace();
-      }
-      
-//      System.out.println("Counts are " + crh1.getCount() + " and " + crh2.getCount());
-//      
-//      
-//    Scanner s = null;
-//   try {
-//       s = accCon.createScanner(tablename, new Authorizations());
-//   } catch (TableNotFoundException e) {
-//       // TODO Auto-generated catch block
-//       e.printStackTrace();
-//   } 
-//    s.setRange(new Range());       
-//    Iterator<Entry<Key,Value>> i = s.iterator();
-//    
-//    while (i.hasNext()) {
-//        Entry<Key, Value> entry = i.next();
-//        Key k = entry.getKey();
-//        System.out.println(k);
-//
-//    } 
-      
-      
-    Assert.assertEquals(2, crh1.getCount());
-    
-    Assert.assertEquals(crh1.getCount(), crh2.getCount());
-
-     
-      
-      
-
-  }
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-    
-    
-    
-    
-
-    public static class CountingResultHandler implements TupleQueryResultHandler {
-        private int count = 0;
-
-        public int getCount() {
-            return count;
-        }
-
-        public void resetCount() {
-            this.count = 0;
-        }
-
-        @Override
-        public void startQueryResult(List<String> arg0) throws TupleQueryResultHandlerException {
-        }
-
-        @Override
-        public void handleSolution(BindingSet arg0) throws TupleQueryResultHandlerException {
-            count++;
-        }
-
-        @Override
-        public void endQueryResult() throws TupleQueryResultHandlerException {
-        }
-
-        @Override
-        public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
-            // TODO Auto-generated method stub
-
-        }
-
-        @Override
-        public void handleLinks(List<String> arg0) throws QueryResultHandlerException {
-            // TODO Auto-generated method stub
-
-        }
-    }
-
-}