http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java 
b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
index bc11a79..caf4a59 100644
--- a/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
+++ b/extras/indexing/src/main/java/mvm/rya/sail/config/RyaSailFactory.java
@@ -1,5 +1,7 @@
 package mvm.rya.sail.config;
 
+import java.net.UnknownHostException;
+
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
@@ -14,9 +16,9 @@ import org.openrdf.sail.Sail;
  * 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
@@ -40,33 +42,33 @@ import 
mvm.rya.rdftriplestore.inference.InferenceEngineException;
 
 public class RyaSailFactory {
 
-    
-    
-    public static Sail getInstance(Configuration conf) throws 
AccumuloException, 
-    AccumuloSecurityException, RyaDAOException, InferenceEngineException {
-        
+
+
+    public static Sail getInstance(final Configuration conf) throws 
AccumuloException,
+    AccumuloSecurityException, RyaDAOException, InferenceEngineException, 
NumberFormatException, UnknownHostException {
+
         return getRyaSail(conf);
     }
-    
-   
-    
-    private static Sail getRyaSail(Configuration config) throws 
AccumuloException, AccumuloSecurityException, RyaDAOException, 
InferenceEngineException {
-        
-        RdfCloudTripleStore store = new RdfCloudTripleStore();
+
+
+
+    private static Sail getRyaSail(final Configuration config) throws 
AccumuloException, AccumuloSecurityException, RyaDAOException, 
InferenceEngineException, NumberFormatException, UnknownHostException {
+
+        final RdfCloudTripleStore store = new RdfCloudTripleStore();
         RyaDAO crdfdao = null;
         RdfCloudTripleStoreConfiguration conf;
         if (ConfigUtils.getUseMongo(config)) {
             conf = new MongoDBRdfConfiguration(config);
             
conf.setTablePrefix(config.get(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX));
             ConfigUtils.setIndexers(conf);
-            
+
             crdfdao = new MongoDBRyaDAO((MongoDBRdfConfiguration)conf);
             crdfdao.init();
-            
+
             conf.setDisplayQueryPlan(true);
             store.setRyaDAO(crdfdao);
         } else {
-            Connector connector = ConfigUtils.getConnector(config);
+            final Connector connector = ConfigUtils.getConnector(config);
             crdfdao = new AccumuloRyaDAO();
             ((AccumuloRyaDAO)crdfdao).setConnector(connector);
 
@@ -80,18 +82,18 @@ public class RyaSailFactory {
             crdfdao.init();
             store.setRyaDAO(crdfdao);
         }
-        
+
         if (conf.isInfer()){
-            InferenceEngine inferenceEngine = new InferenceEngine();
+            final InferenceEngine inferenceEngine = new InferenceEngine();
             inferenceEngine.setConf(conf);
             inferenceEngine.setRyaDAO(crdfdao);
             inferenceEngine.init();
-            store.setInferenceEngine(inferenceEngine);                 
+            store.setInferenceEngine(inferenceEngine);
         }
 
         return store;
     }
 
-    
-    
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/StatementSerializerTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/StatementSerializerTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/StatementSerializerTest.java
index 88e2841..951e900 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/StatementSerializerTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/StatementSerializerTest.java
@@ -22,7 +22,7 @@ package mvm.rya.indexing.accumulo;
 
 
 import junit.framework.Assert;
-import mvm.rya.indexing.accumulo.StatementSerializer;
+import mvm.rya.indexing.StatementSerializer;
 
 import org.junit.Test;
 import org.openrdf.model.Statement;

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
index c6bd9c2..8a19b3a 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
@@ -53,11 +53,11 @@ import mvm.rya.api.domain.RyaType;
 import mvm.rya.api.domain.RyaURI;
 import mvm.rya.api.resolver.RdfToRyaConversions;
 import mvm.rya.api.resolver.RyaToRdfConversions;
-import mvm.rya.indexing.StatementContraints;
+import mvm.rya.indexing.StatementConstraints;
 import mvm.rya.indexing.accumulo.ConfigUtils;
 
 public class AccumuloFreeTextIndexerTest {
-    private static final StatementContraints EMPTY_CONSTRAINTS = new 
StatementContraints();
+    private static final StatementConstraints EMPTY_CONSTRAINTS = new 
StatementConstraints();
 
     Configuration conf;
 
@@ -232,9 +232,9 @@ public class AccumuloFreeTextIndexerTest {
             f.flush();
 
             Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryText("hat", EMPTY_CONSTRAINTS)));
-            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryText("hat", new StatementContraints().setContext(context))));
+            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryText("hat", new StatementConstraints().setContext(context))));
             Assert.assertEquals(Sets.newHashSet(),
-                    getSet(f.queryText("hat", new 
StatementContraints().setContext(vf.createURI("foo:context2")))));
+                    getSet(f.queryText("hat", new 
StatementConstraints().setContext(vf.createURI("foo:context2")))));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerSfTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerSfTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerSfTest.java
index 4c22857..0f19a4c 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerSfTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerSfTest.java
@@ -33,7 +33,7 @@ import mvm.rya.api.domain.RyaStatement;
 import mvm.rya.api.resolver.RdfToRyaConversions;
 import mvm.rya.api.resolver.RyaToRdfConversions;
 import mvm.rya.indexing.GeoIndexer;
-import mvm.rya.indexing.StatementContraints;
+import mvm.rya.indexing.StatementConstraints;
 import mvm.rya.indexing.accumulo.ConfigUtils;
 import mvm.rya.indexing.accumulo.geo.GeoConstants;
 import mvm.rya.indexing.accumulo.geo.GeoMesaGeoIndexer;
@@ -71,7 +71,7 @@ public class GeoIndexerSfTest {
     private static GeometryFactory gf = new GeometryFactory(new 
PrecisionModel(), 4326);
     private static GeoMesaGeoIndexer g;
 
-    private static final StatementContraints EMPTY_CONSTRAINTS = new 
StatementContraints();
+    private static final StatementConstraints EMPTY_CONSTRAINTS = new 
StatementConstraints();
 
     // Here is the landscape:
     /**

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerTest.java
index 25db123..14cd267 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/geo/GeoIndexerTest.java
@@ -52,12 +52,12 @@ import com.vividsolutions.jts.geom.PrecisionModel;
 import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence;
 
 import info.aduna.iteration.CloseableIteration;
-import mvm.rya.indexing.StatementContraints;
+import mvm.rya.indexing.StatementConstraints;
 import mvm.rya.indexing.accumulo.ConfigUtils;
 
 public class GeoIndexerTest {
 
-    private static final StatementContraints EMPTY_CONSTRAINTS = new 
StatementContraints();
+    private static final StatementConstraints EMPTY_CONSTRAINTS = new 
StatementConstraints();
 
     Configuration conf;
     GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 4326);
@@ -266,11 +266,11 @@ public class GeoIndexerTest {
             Polygon p1 = gf.createPolygon(r1, new LinearRing[] {});
 
             // query with correct context
-            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryWithin(p1, new StatementContraints().setContext(context))));
+            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryWithin(p1, new StatementConstraints().setContext(context))));
 
             // query with wrong context
             Assert.assertEquals(Sets.newHashSet(),
-                    getSet(f.queryWithin(p1, new 
StatementContraints().setContext(vf.createURI("foo:context2")))));
+                    getSet(f.queryWithin(p1, new 
StatementConstraints().setContext(vf.createURI("foo:context2")))));
         }
     }
 
@@ -295,10 +295,10 @@ public class GeoIndexerTest {
             Polygon p1 = gf.createPolygon(r1, new LinearRing[] {});
 
             // query with correct subject
-            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryWithin(p1, new StatementContraints().setSubject(subject))));
+            Assert.assertEquals(Sets.newHashSet(statement), 
getSet(f.queryWithin(p1, new StatementConstraints().setSubject(subject))));
 
             // query with wrong subject
-            Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, 
new StatementContraints().setSubject(vf.createURI("foo:subj2")))));
+            Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, 
new StatementConstraints().setSubject(vf.createURI("foo:subj2")))));
         }
     }
 
@@ -324,14 +324,14 @@ public class GeoIndexerTest {
 
             // query with correct context subject
             Assert.assertEquals(Sets.newHashSet(statement),
-                    getSet(f.queryWithin(p1, new 
StatementContraints().setContext(context).setSubject(subject))));
+                    getSet(f.queryWithin(p1, new 
StatementConstraints().setContext(context).setSubject(subject))));
 
             // query with wrong context
             Assert.assertEquals(Sets.newHashSet(),
-                    getSet(f.queryWithin(p1, new 
StatementContraints().setContext(vf.createURI("foo:context2")))));
+                    getSet(f.queryWithin(p1, new 
StatementConstraints().setContext(vf.createURI("foo:context2")))));
 
             // query with wrong subject
-            Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, 
new StatementContraints().setSubject(vf.createURI("foo:subj2")))));
+            Assert.assertEquals(Sets.newHashSet(), getSet(f.queryWithin(p1, 
new StatementConstraints().setSubject(vf.createURI("foo:subj2")))));
         }
     }
 
@@ -357,11 +357,11 @@ public class GeoIndexerTest {
 
             // query with correct Predicate
             Assert.assertEquals(Sets.newHashSet(statement),
-                    getSet(f.queryWithin(p1, new 
StatementContraints().setPredicates(Collections.singleton(predicate)))));
+                    getSet(f.queryWithin(p1, new 
StatementConstraints().setPredicates(Collections.singleton(predicate)))));
 
             // query with wrong predicate
             Assert.assertEquals(Sets.newHashSet(),
-                    getSet(f.queryWithin(p1, new 
StatementContraints().setPredicates(Collections.singleton(vf.createURI("other:pred"))))));
+                    getSet(f.queryWithin(p1, new 
StatementConstraints().setPredicates(Collections.singleton(vf.createURI("other:pred"))))));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
index 1c6628f..d2dfc44 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
@@ -69,11 +69,12 @@ import com.beust.jcommander.internal.Lists;
 import info.aduna.iteration.CloseableIteration;
 import junit.framework.Assert;
 import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.indexing.StatementContraints;
+import mvm.rya.indexing.StatementConstraints;
+import mvm.rya.indexing.StatementSerializer;
 import mvm.rya.indexing.TemporalInstant;
+import mvm.rya.indexing.TemporalInstantRfc3339;
 import mvm.rya.indexing.TemporalInterval;
 import mvm.rya.indexing.accumulo.ConfigUtils;
-import mvm.rya.indexing.accumulo.StatementSerializer;
 
 /**
  * JUnit tests for TemporalIndexer and it's implementation 
AccumuloTemporalIndexer
@@ -108,7 +109,7 @@ public final class AccumuloTemporalIndexerTest {
     private static final String STAT_KEYHASH = "keyhash";
     private static final String STAT_VALUEHASH = "valuehash";
     private static final String TEST_TEMPORAL_INDEX_TABLE_NAME = 
"testTemporalIndex";
-    private static final StatementContraints EMPTY_CONSTRAINTS = new 
StatementContraints();
+    private static final StatementConstraints EMPTY_CONSTRAINTS = new 
StatementConstraints();
 
     // Recreate table name for each test instance in this JVM.
     String uniquePerTestTemporalIndexTableName = 
TEST_TEMPORAL_INDEX_TABLE_NAME + String.format("%05d", 
nextTableSuffixAtomic.getAndIncrement());
@@ -791,7 +792,7 @@ public final class AccumuloTemporalIndexerTest {
 
     /**
      * Test method for
-     * {@link 
mvm.rya.indexing.accumulo.temporal.AccumuloTemporalIndexer#queryIntervalEquals(TemporalInterval,
 StatementContraints)}
+     * {@link 
mvm.rya.indexing.accumulo.temporal.AccumuloTemporalIndexer#queryIntervalEquals(TemporalInterval,
 StatementConstraints)}
      * .
      * @throws IOException
      * @throws QueryEvaluationException
@@ -818,7 +819,7 @@ public final class AccumuloTemporalIndexerTest {
 
     /**
      * Test interval before a given interval, for method:
-     * {@link AccumuloTemporalIndexer#queryIntervalBefore(TemporalInterval, 
StatementContraints)}.
+     * {@link AccumuloTemporalIndexer#queryIntervalBefore(TemporalInterval, 
StatementConstraints)}.
      *
      * @throws IOException
      * @throws QueryEvaluationException
@@ -920,7 +921,7 @@ public final class AccumuloTemporalIndexerTest {
         }
         tIndexer.flush();
         CloseableIteration<Statement, QueryEvaluationException> iter;
-        StatementContraints constraints = new StatementContraints();
+        StatementConstraints constraints = new StatementConstraints();
         constraints.setPredicates(new HashSet<URI>(Arrays.asList( 
pred2_eventTime,  pred1_atTime )));
 
         iter = tIndexer.queryInstantAfterInstant(seriesTs[searchForSeconds], 
constraints); // EMPTY_CONSTRAINTS);//

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalInstantTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalInstantTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalInstantTest.java
index 6363372..53dc6d2 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalInstantTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalInstantTest.java
@@ -25,6 +25,7 @@ import java.util.Date;
 import java.util.TimeZone;
 
 import mvm.rya.indexing.TemporalInstant;
+import mvm.rya.indexing.TemporalInstantRfc3339;
 
 import org.apache.commons.codec.binary.StringUtils;
 import org.joda.time.DateTime;

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalIntervalTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalIntervalTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalIntervalTest.java
index 6213826..9450fc2 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalIntervalTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/accumulo/temporal/TemporalIntervalTest.java
@@ -23,6 +23,7 @@ package mvm.rya.indexing.accumulo.temporal;
 import java.util.Arrays;
 
 import mvm.rya.indexing.TemporalInstant;
+import mvm.rya.indexing.TemporalInstantRfc3339;
 import mvm.rya.indexing.TemporalInterval;
 
 import org.joda.time.DateTime;

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantPcjIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantPcjIntegrationTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantPcjIntegrationTest.java
index 8041f16..70ac0d1 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantPcjIntegrationTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloConstantPcjIntegrationTest.java
@@ -1,5 +1,7 @@
 package mvm.rya.indexing.external;
 
+import java.net.UnknownHostException;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -70,7 +72,8 @@ public class AccumuloConstantPcjIntegrationTest {
                        TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, AccumuloException,
                        AccumuloSecurityException, TableExistsException,
-                       TableNotFoundException, RyaDAOException, 
InferenceEngineException {
+                       TableNotFoundException, RyaDAOException, 
InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                repo = PcjIntegrationTestingUtil.getNonPcjRepo(prefix, 
"instance");
                conn = repo.getConnection();
@@ -379,16 +382,16 @@ public class AccumuloConstantPcjIntegrationTest {
                }
 
                public void resetCount() {
-                       this.count = 0;
+                       count = 0;
                }
 
                @Override
-               public void startQueryResult(List<String> arg0)
+               public void startQueryResult(final List<String> arg0)
                                throws TupleQueryResultHandlerException {
                }
 
                @Override
-               public void handleSolution(BindingSet arg0)
+               public void handleSolution(final BindingSet arg0)
                                throws TupleQueryResultHandlerException {
                        count++;
                }
@@ -398,12 +401,12 @@ public class AccumuloConstantPcjIntegrationTest {
                }
 
                @Override
-               public void handleBoolean(boolean arg0)
+               public void handleBoolean(final boolean arg0)
                                throws QueryResultHandlerException {
                }
 
                @Override
-               public void handleLinks(List<String> arg0)
+               public void handleLinks(final List<String> arg0)
                                throws QueryResultHandlerException {
                }
        }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloPcjIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloPcjIntegrationTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloPcjIntegrationTest.java
index 393ae74..917bfa0 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloPcjIntegrationTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/AccumuloPcjIntegrationTest.java
@@ -1,5 +1,7 @@
 package mvm.rya.indexing.external;
 
+import java.net.UnknownHostException;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -87,7 +89,8 @@ public class AccumuloPcjIntegrationTest {
                        TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       TableNotFoundException, InferenceEngineException {
+                       TableNotFoundException, InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                repo = PcjIntegrationTestingUtil.getNonPcjRepo(prefix, 
"instance");
                conn = repo.getConnection();
@@ -1396,16 +1399,16 @@ public class AccumuloPcjIntegrationTest {
                }
 
                public void resetCount() {
-                       this.count = 0;
+                       count = 0;
                }
 
                @Override
-               public void startQueryResult(List<String> arg0)
+               public void startQueryResult(final List<String> arg0)
                                throws TupleQueryResultHandlerException {
                }
 
                @Override
-               public void handleSolution(BindingSet arg0)
+               public void handleSolution(final BindingSet arg0)
                                throws TupleQueryResultHandlerException {
                        count++;
                        System.out.println(arg0);
@@ -1416,13 +1419,13 @@ public class AccumuloPcjIntegrationTest {
                }
 
                @Override
-               public void handleBoolean(boolean arg0)
+               public void handleBoolean(final boolean arg0)
                                throws QueryResultHandlerException {
 
                }
 
                @Override
-               public void handleLinks(List<String> arg0)
+               public void handleLinks(final List<String> arg0)
                                throws QueryResultHandlerException {
 
                }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/external/PCJOptionalTestIT.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PCJOptionalTestIT.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PCJOptionalTestIT.java
index c7b277b..38861b0 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PCJOptionalTestIT.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PCJOptionalTestIT.java
@@ -18,17 +18,10 @@
  */
 package mvm.rya.indexing.external;
 
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 
-import mvm.rya.api.persist.RyaDAOException;
-import 
mvm.rya.indexing.external.PrecompJoinOptimizerIntegrationTest.CountingResultHandler;
-import mvm.rya.indexing.external.PrecompJoinOptimizerTest.NodeCollector;
-import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
-import mvm.rya.indexing.external.tupleSet.SimpleExternalTupleSet;
-import mvm.rya.indexing.pcj.matching.PCJOptimizer;
-import mvm.rya.rdftriplestore.inference.InferenceEngineException;
-
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
@@ -65,257 +58,267 @@ import org.openrdf.sail.SailException;
 import com.beust.jcommander.internal.Lists;
 import com.google.common.base.Optional;
 
-public class PCJOptionalTestIT {
-
-
-       private SailRepositoryConnection conn, pcjConn;
-       private SailRepository repo, pcjRepo;
-       private Connector accCon;
-       String tablePrefix = "table_";
-       URI sub, sub2, obj, obj2, subclass, subclass2, talksTo, sub3, subclass3;
+import mvm.rya.api.persist.RyaDAOException;
+import 
mvm.rya.indexing.external.PrecompJoinOptimizerIntegrationTest.CountingResultHandler;
+import mvm.rya.indexing.external.PrecompJoinOptimizerTest.NodeCollector;
+import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
+import mvm.rya.indexing.external.tupleSet.SimpleExternalTupleSet;
+import mvm.rya.rdftriplestore.inference.InferenceEngineException;
 
-       @Before
-       public void init() throws RepositoryException,
-                       TupleQueryResultHandlerException, 
QueryEvaluationException,
-                       MalformedQueryException, AccumuloException,
-                       AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       TableNotFoundException, InferenceEngineException {
+public class PCJOptionalTestIT {
 
-               repo = PcjIntegrationTestingUtil.getNonPcjRepo(tablePrefix, 
"instance");
-               conn = repo.getConnection();
-
-               pcjRepo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, 
"instance");
-               pcjConn = pcjRepo.getConnection();
-
-               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);
-
-               sub2 = new URIImpl("uri:entity2");
-               subclass2 = new URIImpl("uri:class2");
-               obj2 = new URIImpl("uri:obj2");
-               sub3 = new URIImpl("uri:entity3");
-               subclass3 = new URIImpl("uri:class3");
-
-
-               conn.add(sub2, RDF.TYPE, subclass2);
-               conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2"));
-               conn.add(sub2, talksTo, obj2);
-               conn.add(sub3, RDF.TYPE, subclass3);
-               conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3"));
 
+    private SailRepositoryConnection conn, pcjConn;
+    private SailRepository repo, pcjRepo;
+    private Connector accCon;
+    String tablePrefix = "table_";
+    URI sub, sub2, obj, obj2, subclass, subclass2, talksTo, sub3, subclass3;
+
+    @Before
+    public void init() throws RepositoryException,
+            TupleQueryResultHandlerException, QueryEvaluationException,
+            MalformedQueryException, AccumuloException,
+            AccumuloSecurityException, TableExistsException, RyaDAOException,
+            TableNotFoundException, InferenceEngineException, 
NumberFormatException,
+            UnknownHostException {
+
+        repo = PcjIntegrationTestingUtil.getNonPcjRepo(tablePrefix, 
"instance");
+        conn = repo.getConnection();
+
+        pcjRepo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, 
"instance");
+        pcjConn = pcjRepo.getConnection();
+
+        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);
+
+        sub2 = new URIImpl("uri:entity2");
+        subclass2 = new URIImpl("uri:class2");
+        obj2 = new URIImpl("uri:obj2");
+        sub3 = new URIImpl("uri:entity3");
+        subclass3 = new URIImpl("uri:class3");
+
+
+        conn.add(sub2, RDF.TYPE, subclass2);
+        conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2"));
+        conn.add(sub2, talksTo, obj2);
+        conn.add(sub3, RDF.TYPE, subclass3);
+        conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3"));
 
-               accCon = new MockInstance("instance").getConnector("root",
-                               new PasswordToken(""));
 
-       }
+        accCon = new MockInstance("instance").getConnector("root",
+                new PasswordToken(""));
 
-       @After
-       public void close() throws RepositoryException, AccumuloException,
-                       AccumuloSecurityException, TableNotFoundException {
+    }
 
-               PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
-               PcjIntegrationTestingUtil.closeAndShutdown(pcjConn, pcjRepo);
-               PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
-               PcjIntegrationTestingUtil.deleteIndexTables(accCon, 2, 
tablePrefix);
+    @After
+    public void close() throws RepositoryException, AccumuloException,
+            AccumuloSecurityException, TableNotFoundException {
 
-       }
+        PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
+        PcjIntegrationTestingUtil.closeAndShutdown(pcjConn, pcjRepo);
+        PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, tablePrefix);
+        PcjIntegrationTestingUtil.deleteIndexTables(accCon, 2, tablePrefix);
 
+    }
 
-       @Test
-       public void testEvaluateSingeIndexExactMatch()
-                       throws TupleQueryResultHandlerException, 
QueryEvaluationException,
-                       MalformedQueryException, RepositoryException, 
AccumuloException,
-                       AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException {
 
-               String indexSparqlString = ""//
-                               + "SELECT ?e ?c ?l ?o" //
-                               + "{" //
-                               + "  ?e a ?c . "//
-                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
-                               + "  OPTIONAL{?e <uri:talksTo> ?o } . "//
-                               + "}";//
+    @Test
+    public void testEvaluateSingeIndexExactMatch()
+            throws TupleQueryResultHandlerException, QueryEvaluationException,
+            MalformedQueryException, RepositoryException, AccumuloException,
+            AccumuloSecurityException, TableExistsException, RyaDAOException,
+            SailException, TableNotFoundException, PcjException, 
InferenceEngineException {
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
-                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "c", "l", "o" },
-                               Optional.<PcjVarOrderFactory> absent());
-               String queryString = ""//
-                               + "SELECT ?e ?c ?l ?o " //
-                               + "{" //
-                               + "  ?e a ?c . "//
-                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l . "//
-                               + "  OPTIONAL {?e <uri:talksTo> ?o } . "//
-                               + "}";//
+        final String indexSparqlString = ""//
+                + "SELECT ?e ?c ?l ?o" //
+                + "{" //
+                + "  ?e a ?c . "//
+                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l "//
+                + "  OPTIONAL{?e <uri:talksTo> ?o } . "//
+                + "}";//
 
-               CountingResultHandler crh = new CountingResultHandler();
-               PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
-               PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
-               TupleQuery tupQuery = 
pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-               tupQuery.evaluate(crh);
+        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                + "INDEX_1", indexSparqlString, new String[] { "e", "c", "l", 
"o" },
+                Optional.<PcjVarOrderFactory> absent());
+        final String queryString = ""//
+                + "SELECT ?e ?c ?l ?o " //
+                + "{" //
+                + "  ?e a ?c . "//
+                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l . "//
+                + "  OPTIONAL {?e <uri:talksTo> ?o } . "//
+                + "}";//
 
-               Assert.assertEquals(3, crh.getCount());
+        final CountingResultHandler crh = new CountingResultHandler();
+        PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, tablePrefix);
+        PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
+        final TupleQuery tupQuery = 
pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+        tupQuery.evaluate(crh);
 
-       }
+        Assert.assertEquals(3, crh.getCount());
 
+    }
 
 
-       @Test
-       public void testEvaluateSingeIndex()
-                       throws TupleQueryResultHandlerException, 
QueryEvaluationException,
-                       MalformedQueryException, RepositoryException, 
AccumuloException,
-                       AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException {
 
-               String indexSparqlString = ""//
-                               + "SELECT ?e ?l ?o" //
-                               + "{" //
-                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
-                               + "  OPTIONAL{?e <uri:talksTo> ?o } . "//
-                               + "}";//
+    @Test
+    public void testEvaluateSingeIndex()
+            throws TupleQueryResultHandlerException, QueryEvaluationException,
+            MalformedQueryException, RepositoryException, AccumuloException,
+            AccumuloSecurityException, TableExistsException, RyaDAOException,
+            SailException, TableNotFoundException, PcjException, 
InferenceEngineException,
+            NumberFormatException, UnknownHostException {
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
-                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "o" },
-                               Optional.<PcjVarOrderFactory> absent());
-               String queryString = ""//
-                               + "SELECT ?e ?c ?l ?o " //
-                               + "{" //
-                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l . "//
-                               + "  OPTIONAL {?e <uri:talksTo> ?o } . "//
-                               + "  ?e a ?c . "//
-                               + "}";//
+        final String indexSparqlString = ""//
+                + "SELECT ?e ?l ?o" //
+                + "{" //
+                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l "//
+                + "  OPTIONAL{?e <uri:talksTo> ?o } . "//
+                + "}";//
 
-               CountingResultHandler crh = new CountingResultHandler();
-               PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
-               PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
+        PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                + "INDEX_1", indexSparqlString, new String[] { "e", "l", "o" },
+                Optional.<PcjVarOrderFactory> absent());
+        final String queryString = ""//
+                + "SELECT ?e ?c ?l ?o " //
+                + "{" //
+                + "  ?e <http://www.w3.org/2000/01/rdf-schema#label> ?l . "//
+                + "  OPTIONAL {?e <uri:talksTo> ?o } . "//
+                + "  ?e a ?c . "//
+                + "}";//
 
-               repo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, 
"instance");
-               conn = repo.getConnection();
-               conn.add(sub, RDF.TYPE, subclass);
-               conn.add(sub2, RDF.TYPE, subclass2);
-               conn.add(sub3, RDF.TYPE, subclass3);
+        final CountingResultHandler crh = new CountingResultHandler();
+        PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, tablePrefix);
+        PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
 
+        repo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, "instance");
+        conn = repo.getConnection();
+        conn.add(sub, RDF.TYPE, subclass);
+        conn.add(sub2, RDF.TYPE, subclass2);
+        conn.add(sub3, RDF.TYPE, subclass3);
 
-               TupleQuery tupQuery = 
pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-               tupQuery.evaluate(crh);
 
-               Assert.assertEquals(3, crh.getCount());
+        final TupleQuery tupQuery = 
pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+        tupQuery.evaluate(crh);
 
-       }
+        Assert.assertEquals(3, crh.getCount());
 
+    }
 
 
 
 
 
-       @Test
-       public void testSimpleOptionalTest1() throws Exception {
 
-               String query = ""//
-                               + "SELECT ?u ?s ?t " //
-                               + "{" //
-                               + "  ?s a ?t ."//
-                               + "  OPTIONAL{?t 
<http://www.w3.org/2000/01/rdf-schema#label> ?u } ."//
-                               + "  ?u <uri:talksTo> ?s . "//
-                               + "}";//
+    @Test
+    public void testSimpleOptionalTest1() throws Exception {
 
-               final SPARQLParser parser = new SPARQLParser();
+        final String query = ""//
+                + "SELECT ?u ?s ?t " //
+                + "{" //
+                + "  ?s a ?t ."//
+                + "  OPTIONAL{?t <http://www.w3.org/2000/01/rdf-schema#label> 
?u } ."//
+                + "  ?u <uri:talksTo> ?s . "//
+                + "}";//
 
-               final ParsedQuery pq1 = parser.parseQuery(query, null);
+        final SPARQLParser parser = new SPARQLParser();
 
-               final SimpleExternalTupleSet extTup1 = new 
SimpleExternalTupleSet(
-                               (Projection) pq1.getTupleExpr().clone());
+        final ParsedQuery pq1 = parser.parseQuery(query, null);
 
-               final List<ExternalTupleSet> list = new 
ArrayList<ExternalTupleSet>();
+        final SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+                (Projection) pq1.getTupleExpr().clone());
 
-               list.add(extTup1);
+        final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
 
-               final List<QueryModelNode> optTupNodes = Lists.newArrayList();
-               optTupNodes.add(extTup1);
+        list.add(extTup1);
 
-               final PCJOptimizer pcj = new PCJOptimizer(list, true);
-               final TupleExpr te = pq1.getTupleExpr();
-               pcj.optimize(te, null, null);
+        final List<QueryModelNode> optTupNodes = Lists.newArrayList();
+        optTupNodes.add(extTup1);
 
-               final NodeCollector nc = new NodeCollector();
-               te.visit(nc);
+        final PrecompJoinOptimizer pcj = new PrecompJoinOptimizer(list, true);
+        final TupleExpr te = pq1.getTupleExpr();
+        pcj.optimize(te, null, null);
 
-               Assert.assertEquals(nc.qNodes.size(), optTupNodes.size());
-               for (final QueryModelNode node : nc.qNodes) {
-                       Assert.assertTrue(optTupNodes.contains(node));
-               }
+        final NodeCollector nc = new NodeCollector();
+        te.visit(nc);
 
-       }
+        final List<QueryModelNode> qNodes = nc.getNodes();
 
+        Assert.assertEquals(qNodes.size(), optTupNodes.size());
+        for (final QueryModelNode node : qNodes) {
+            Assert.assertTrue(optTupNodes.contains(node));
+        }
 
-       @Test
-       public void testSimpleOptionalTest2() throws Exception {
+    }
 
-               String query = ""//
-                               + "SELECT ?u ?s ?t " //
-                               + "{" //
-                               + "  ?s a ?t ."//
-                               + "  OPTIONAL{?t 
<http://www.w3.org/2000/01/rdf-schema#label> ?u } ."//
-                               + "  ?u <uri:talksTo> ?s . "//
-                               + "  ?s a ?u ."//
-                               + "}";//
 
+    @Test
+    public void testSimpleOptionalTest2() throws Exception {
 
-               String pcj = ""//
-                               + "SELECT ?d ?b ?c " //
-                               + "{" //
-                               + "  ?b a ?c ."//
-                               + "  OPTIONAL{?c 
<http://www.w3.org/2000/01/rdf-schema#label> ?d } ."//
-                               + "  ?d <uri:talksTo> ?b . "//
-                               + "}";//
+        final String query = ""//
+                + "SELECT ?u ?s ?t " //
+                + "{" //
+                + "  ?s a ?t ."//
+                + "  OPTIONAL{?t <http://www.w3.org/2000/01/rdf-schema#label> 
?u } ."//
+                + "  ?u <uri:talksTo> ?s . "//
+                + "  ?s a ?u ."//
+                + "}";//
 
 
-               String relabel_pcj = ""//
-                               + "SELECT ?u ?s ?t " //
-                               + "{" //
-                               + "  ?s a ?t ."//
-                               + "  OPTIONAL{?t 
<http://www.w3.org/2000/01/rdf-schema#label> ?u } ."//
-                               + "  ?u <uri:talksTo> ?s . "//
-                               + "}";//
+        final String pcj = ""//
+                + "SELECT ?d ?b ?c " //
+                + "{" //
+                + "  ?b a ?c ."//
+                + "  OPTIONAL{?c <http://www.w3.org/2000/01/rdf-schema#label> 
?d } ."//
+                + "  ?d <uri:talksTo> ?b . "//
+                + "}";//
 
 
-               final SPARQLParser parser = new SPARQLParser();
+        final String relabel_pcj = ""//
+                + "SELECT ?u ?s ?t " //
+                + "{" //
+                + "  ?s a ?t ."//
+                + "  OPTIONAL{?t <http://www.w3.org/2000/01/rdf-schema#label> 
?u } ."//
+                + "  ?u <uri:talksTo> ?s . "//
+                + "}";//
 
-               final ParsedQuery pq1 = parser.parseQuery(query, null);
-               final ParsedQuery pq2 = parser.parseQuery(pcj, null);
-               final ParsedQuery pq3 = parser.parseQuery(relabel_pcj, null);
 
-               final SimpleExternalTupleSet extTup1 = new 
SimpleExternalTupleSet(
-                               (Projection) pq2.getTupleExpr());
-               final SimpleExternalTupleSet extTup2 = new 
SimpleExternalTupleSet(
-                               (Projection) pq3.getTupleExpr());
+        final SPARQLParser parser = new SPARQLParser();
 
-               final List<ExternalTupleSet> list = new 
ArrayList<ExternalTupleSet>();
+        final ParsedQuery pq1 = parser.parseQuery(query, null);
+        final ParsedQuery pq2 = parser.parseQuery(pcj, null);
+        final ParsedQuery pq3 = parser.parseQuery(relabel_pcj, null);
 
-               list.add(extTup1);
+        final SimpleExternalTupleSet extTup1 = new SimpleExternalTupleSet(
+                (Projection) pq2.getTupleExpr());
+        final SimpleExternalTupleSet extTup2 = new SimpleExternalTupleSet(
+                (Projection) pq3.getTupleExpr());
 
-               final List<QueryModelNode> optTupNodes = Lists.newArrayList();
-               optTupNodes.add(extTup2);
+        final List<ExternalTupleSet> list = new ArrayList<ExternalTupleSet>();
 
-               final PCJOptimizer opt = new PCJOptimizer(list, true);
-               final TupleExpr te = pq1.getTupleExpr();
-               opt.optimize(te, null, null);
+        list.add(extTup1);
 
-               final NodeCollector nc = new NodeCollector();
-               te.visit(nc);
+        final List<QueryModelNode> optTupNodes = Lists.newArrayList();
+        optTupNodes.add(extTup2);
 
-               Assert.assertEquals(nc.qNodes.size(), optTupNodes.size() + 1);
-               for (QueryModelNode node : optTupNodes) {
-                       Assert.assertTrue(nc.qNodes.contains(node));
-               }
+        final PrecompJoinOptimizer opt = new PrecompJoinOptimizer(list, true);
+        final TupleExpr te = pq1.getTupleExpr();
+        opt.optimize(te, null, null);
 
-       }
+        final NodeCollector nc = new NodeCollector();
+        te.visit(nc);
 
+        final List<QueryModelNode> qNodes = nc.getNodes();
 
+        Assert.assertEquals(qNodes.size(), optTupNodes.size() + 1);
+        for (final QueryModelNode node : optTupNodes) {
+            Assert.assertTrue(qNodes.contains(node));
+        }
 
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/external/PcjIntegrationTestingUtil.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PcjIntegrationTestingUtil.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PcjIntegrationTestingUtil.java
index 3b87179..7646084 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PcjIntegrationTestingUtil.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PcjIntegrationTestingUtil.java
@@ -21,6 +21,7 @@ package mvm.rya.indexing.external;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -70,117 +71,119 @@ import mvm.rya.sail.config.RyaSailFactory;
 
 public class PcjIntegrationTestingUtil {
 
-       private static final AccumuloPcjSerializer converter = new 
AccumuloPcjSerializer();
-
-       public static Set<QueryModelNode> getTupleSets(TupleExpr te) {
-               final ExternalTupleVisitor etv = new ExternalTupleVisitor();
-               te.visit(etv);
-               return etv.getExtTup();
-       }
-
-       public static void deleteCoreRyaTables(Connector accCon, String prefix)
-                       throws AccumuloException, AccumuloSecurityException,
-                       TableNotFoundException {
-               final TableOperations ops = accCon.tableOperations();
-               if (ops.exists(prefix + "spo")) {
-                       ops.delete(prefix + "spo");
-               }
-               if (ops.exists(prefix + "po")) {
-                       ops.delete(prefix + "po");
-               }
-               if (ops.exists(prefix + "osp")) {
-                       ops.delete(prefix + "osp");
-               }
-       }
-
-       public static SailRepository getPcjRepo(String tablePrefix, String 
instance)
-                       throws AccumuloException, AccumuloSecurityException,
-                       RyaDAOException, RepositoryException, 
InferenceEngineException {
-
-               final AccumuloRdfConfiguration pcjConf = new 
AccumuloRdfConfiguration();
-               pcjConf.set(ConfigUtils.USE_PCJ, "true");
-               pcjConf.set(ConfigUtils.USE_MOCK_INSTANCE, "true");
-               pcjConf.set(ConfigUtils.CLOUDBASE_INSTANCE, instance);
-               pcjConf.setTablePrefix(tablePrefix);
-
-               final Sail pcjSail = RyaSailFactory.getInstance(pcjConf);
-               final SailRepository pcjRepo = new SailRepository(pcjSail);
-               pcjRepo.initialize();
-               return pcjRepo;
-       }
-
-       public static SailRepository getNonPcjRepo(String tablePrefix,
-                       String instance) throws AccumuloException,
-                       AccumuloSecurityException, RyaDAOException, 
RepositoryException, InferenceEngineException {
-
-               final AccumuloRdfConfiguration nonPcjConf = new 
AccumuloRdfConfiguration();
-               nonPcjConf.set(ConfigUtils.USE_MOCK_INSTANCE, "true");
-               nonPcjConf.set(ConfigUtils.CLOUDBASE_INSTANCE, instance);
-               nonPcjConf.setTablePrefix(tablePrefix);
-
-               final Sail nonPcjSail = RyaSailFactory.getInstance(nonPcjConf);
-               final SailRepository nonPcjRepo = new 
SailRepository(nonPcjSail);
-               nonPcjRepo.initialize();
-               return nonPcjRepo;
-       }
-
-       public static void closeAndShutdown(SailRepositoryConnection connection,
-                       SailRepository repo) throws RepositoryException {
-               connection.close();
-               repo.shutDown();
-       }
-
-       public static void deleteIndexTables(Connector accCon, int tableNum,
-                       String prefix) throws AccumuloException, 
AccumuloSecurityException,
-                       TableNotFoundException {
-               final TableOperations ops = accCon.tableOperations();
-               final String tablename = prefix + "INDEX_";
-               for (int i = 1; i < tableNum + 1; i++) {
-                       if (ops.exists(tablename + i)) {
-                               ops.delete(tablename + i);
-                       }
-               }
-       }
-
-       public static class BindingSetAssignmentCollector extends
-                       QueryModelVisitorBase<RuntimeException> {
-
-               private final Set<QueryModelNode> bindingSetList = 
Sets.newHashSet();
-
-               public Set<QueryModelNode> getBindingSetAssignments() {
-                       return bindingSetList;
-               }
-
-               public boolean containsBSAs() {
-                       return bindingSetList.size() > 0;
-               }
-
-               @Override
-               public void meet(BindingSetAssignment node) {
-                       bindingSetList.add(node);
-                       super.meet(node);
-               }
-
-       }
-
-       public static class ExternalTupleVisitor extends
-                       QueryModelVisitorBase<RuntimeException> {
-
-               private final Set<QueryModelNode> eSet = new HashSet<>();
-
-               @Override
-               public void meetNode(QueryModelNode node) throws 
RuntimeException {
-                       if (node instanceof ExternalTupleSet) {
-                               eSet.add(node);
-                       }
-                       super.meetNode(node);
-               }
-
-               public Set<QueryModelNode> getExtTup() {
-                       return eSet;
-               }
-
-       }
+    private static final AccumuloPcjSerializer converter = new 
AccumuloPcjSerializer();
+
+    public static Set<QueryModelNode> getTupleSets(final TupleExpr te) {
+        final ExternalTupleVisitor etv = new ExternalTupleVisitor();
+        te.visit(etv);
+        return etv.getExtTup();
+    }
+
+    public static void deleteCoreRyaTables(final Connector accCon, final 
String prefix)
+            throws AccumuloException, AccumuloSecurityException,
+            TableNotFoundException {
+        final TableOperations ops = accCon.tableOperations();
+        if (ops.exists(prefix + "spo")) {
+            ops.delete(prefix + "spo");
+        }
+        if (ops.exists(prefix + "po")) {
+            ops.delete(prefix + "po");
+        }
+        if (ops.exists(prefix + "osp")) {
+            ops.delete(prefix + "osp");
+        }
+    }
+
+    public static SailRepository getPcjRepo(final String tablePrefix, final 
String instance)
+            throws AccumuloException, AccumuloSecurityException,
+            RyaDAOException, RepositoryException, InferenceEngineException,
+            NumberFormatException, UnknownHostException {
+
+        final AccumuloRdfConfiguration pcjConf = new 
AccumuloRdfConfiguration();
+        pcjConf.set(ConfigUtils.USE_PCJ, "true");
+        pcjConf.set(ConfigUtils.USE_MOCK_INSTANCE, "true");
+        pcjConf.set(ConfigUtils.CLOUDBASE_INSTANCE, instance);
+        pcjConf.setTablePrefix(tablePrefix);
+
+        final Sail pcjSail = RyaSailFactory.getInstance(pcjConf);
+        final SailRepository pcjRepo = new SailRepository(pcjSail);
+        pcjRepo.initialize();
+        return pcjRepo;
+    }
+
+    public static SailRepository getNonPcjRepo(final String tablePrefix,
+            final String instance) throws AccumuloException,
+            AccumuloSecurityException, RyaDAOException, RepositoryException, 
InferenceEngineException,
+            NumberFormatException, UnknownHostException {
+
+        final AccumuloRdfConfiguration nonPcjConf = new 
AccumuloRdfConfiguration();
+        nonPcjConf.set(ConfigUtils.USE_MOCK_INSTANCE, "true");
+        nonPcjConf.set(ConfigUtils.CLOUDBASE_INSTANCE, instance);
+        nonPcjConf.setTablePrefix(tablePrefix);
+
+        final Sail nonPcjSail = RyaSailFactory.getInstance(nonPcjConf);
+        final SailRepository nonPcjRepo = new SailRepository(nonPcjSail);
+        nonPcjRepo.initialize();
+        return nonPcjRepo;
+    }
+
+    public static void closeAndShutdown(final SailRepositoryConnection 
connection,
+            final SailRepository repo) throws RepositoryException {
+        connection.close();
+        repo.shutDown();
+    }
+
+    public static void deleteIndexTables(final Connector accCon, final int 
tableNum,
+            final String prefix) throws AccumuloException, 
AccumuloSecurityException,
+            TableNotFoundException {
+        final TableOperations ops = accCon.tableOperations();
+        final String tablename = prefix + "INDEX_";
+        for (int i = 1; i < tableNum + 1; i++) {
+            if (ops.exists(tablename + i)) {
+                ops.delete(tablename + i);
+            }
+        }
+    }
+
+    public static class BindingSetAssignmentCollector extends
+            QueryModelVisitorBase<RuntimeException> {
+
+        private final Set<QueryModelNode> bindingSetList = Sets.newHashSet();
+
+        public Set<QueryModelNode> getBindingSetAssignments() {
+            return bindingSetList;
+        }
+
+        public boolean containsBSAs() {
+            return bindingSetList.size() > 0;
+        }
+
+        @Override
+        public void meet(final BindingSetAssignment node) {
+            bindingSetList.add(node);
+            super.meet(node);
+        }
+
+    }
+
+    public static class ExternalTupleVisitor extends
+            QueryModelVisitorBase<RuntimeException> {
+
+        private final Set<QueryModelNode> eSet = new HashSet<>();
+
+        @Override
+        public void meetNode(final QueryModelNode node) throws 
RuntimeException {
+            if (node instanceof ExternalTupleSet) {
+                eSet.add(node);
+            }
+            super.meetNode(node);
+        }
+
+        public Set<QueryModelNode> getExtTup() {
+            return eSet;
+        }
+
+    }
 
 
 
@@ -193,7 +196,7 @@ public class PcjIntegrationTestingUtil {
 
 
 
-         /**
+      /**
      * Creates a new PCJ Table in Accumulo and populates it by scanning an
      * instance of Rya for historic matches.
      * <p>
@@ -225,10 +228,10 @@ public class PcjIntegrationTestingUtil {
         checkNotNull(resultVariables);
         checkNotNull(pcjVarOrderFactory);
 
-        PcjTables pcj = new PcjTables();
+        final PcjTables pcj = new PcjTables();
         // Create the PCJ's variable orders.
-        PcjVarOrderFactory varOrderFactory = pcjVarOrderFactory.or(new 
ShiftVarOrderFactory());
-        Set<VariableOrder> varOrders = varOrderFactory.makeVarOrders( new 
VariableOrder(resultVariables) );
+        final PcjVarOrderFactory varOrderFactory = pcjVarOrderFactory.or(new 
ShiftVarOrderFactory());
+        final Set<VariableOrder> varOrders = varOrderFactory.makeVarOrders( 
new VariableOrder(resultVariables) );
 
         // Create the PCJ table in Accumulo.
         pcj.createPcjTable(accumuloConn, pcjTableName, varOrders, sparql);
@@ -238,168 +241,168 @@ public class PcjIntegrationTestingUtil {
     }
 
 
-       /**
-        * Scan Rya for results that solve the PCJ's query and store them in 
the PCJ
-        * table.
-        * <p>
-        * This method assumes the PCJ table has already been created.
-        *
-        * @param accumuloConn
-        *            - A connection to the Accumulo that hosts the PCJ table. 
(not
-        *            null)
-        * @param pcjTableName
-        *            - The name of the PCJ table that will receive the results.
-        *            (not null)
-        * @param ryaConn
-        *            - A connection to the Rya store that will be queried to 
find
-        *            results. (not null)
-        * @throws PcjException
-        *             If results could not be written to the PCJ table, the PCJ
-        *             table does not exist, or the query that is being execute 
was
-        *             malformed.
-        */
-       public static void populatePcj(final Connector accumuloConn,
-                       final String pcjTableName, final RepositoryConnection 
ryaConn)
-                       throws PcjException {
-               checkNotNull(accumuloConn);
-               checkNotNull(pcjTableName);
-               checkNotNull(ryaConn);
-
-               try {
-                       // Fetch the query that needs to be executed from the 
PCJ table.
-                       PcjMetadata pcjMetadata = new 
PcjTables().getPcjMetadata(
-                                       accumuloConn, pcjTableName);
-                       String sparql = pcjMetadata.getSparql();
-
-                       // Query Rya for results to the SPARQL query.
-                       TupleQuery query = 
ryaConn.prepareTupleQuery(QueryLanguage.SPARQL,
-                                       sparql);
-                       TupleQueryResult results = query.evaluate();
-
-                       // Load batches of 1000 of them at a time into the PCJ 
table
-                       Set<BindingSet> batch = new HashSet<>(1000);
-                       while (results.hasNext()) {
-                               batch.add(results.next());
-
-                               if (batch.size() == 1000) {
-                                       addResults(accumuloConn, pcjTableName, 
batch);
-                                       batch.clear();
-                               }
-                       }
-
-                       if (!batch.isEmpty()) {
-                               addResults(accumuloConn, pcjTableName, batch);
-                       }
-
-               } catch (RepositoryException | MalformedQueryException
-                               | QueryEvaluationException e) {
-                       throw new PcjException(
-                                       "Could not populate a PCJ table with 
Rya results for the table named: "
-                                                       + pcjTableName, e);
-               }
-       }
-
-       public static void addResults(final Connector accumuloConn,
-                       final String pcjTableName, final Collection<BindingSet> 
results)
-                       throws PcjException {
-               checkNotNull(accumuloConn);
-               checkNotNull(pcjTableName);
-               checkNotNull(results);
-
-               // Write a result to each of the variable orders that are in 
the table.
-               writeResults(accumuloConn, pcjTableName, results);
-       }
-
-       /**
-        * Add a collection of results to a specific PCJ table.
-        *
-        * @param accumuloConn
-        *            - A connection to the Accumulo that hosts the PCJ table. 
(not
-        *            null)
-        * @param pcjTableName
-        *            - The name of the PCJ table that will receive the results.
-        *            (not null)
-        * @param results
-        *            - Binding sets that will be written to the PCJ table. (not
-        *            null)
-        * @throws PcjException
-        *             The provided PCJ table doesn't exist, is missing the PCJ
-        *             metadata, or the result could not be written to it.
-        */
-       private static void writeResults(final Connector accumuloConn,
-                       final String pcjTableName, final Collection<BindingSet> 
results)
-                       throws PcjException {
-               checkNotNull(accumuloConn);
-               checkNotNull(pcjTableName);
-               checkNotNull(results);
-
-               // Fetch the variable orders from the PCJ table.
-               PcjMetadata metadata = new 
PcjTables().getPcjMetadata(accumuloConn,
-                               pcjTableName);
-
-               // Write each result formatted using each of the variable 
orders.
-               BatchWriter writer = null;
-               try {
-                       writer = accumuloConn.createBatchWriter(pcjTableName,
-                                       new BatchWriterConfig());
-                       for (BindingSet result : results) {
-                               Set<Mutation> addResultMutations = 
makeWriteResultMutations(
-                                               metadata.getVarOrders(), 
result);
-                               writer.addMutations(addResultMutations);
-                       }
-               } catch (TableNotFoundException | MutationsRejectedException e) 
{
-                       throw new PcjException(
-                                       "Could not add results to the PCJ table 
named: "
-                                                       + pcjTableName, e);
-               } finally {
-                       if (writer != null) {
-                               try {
-                                       writer.close();
-                               } catch (MutationsRejectedException e) {
-                                       throw new PcjException(
-                                                       "Could not add results 
to a PCJ table because some of the mutations were rejected.",
-                                                       e);
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Create the {@link Mutations} required to write a new {@link 
BindingSet}
-        * to a PCJ table for each {@link VariableOrder} that is provided.
-        *
-        * @param varOrders
-        *            - The variables orders the result will be written to. (not
-        *            null)
-        * @param result
-        *            - A new PCJ result. (not null)
-        * @return Mutation that will write the result to a PCJ table.
-        * @throws PcjException
-        *             The binding set could not be encoded.
-        */
-       private static Set<Mutation> makeWriteResultMutations(
-                       final Set<VariableOrder> varOrders, final BindingSet 
result)
-                       throws PcjException {
-               checkNotNull(varOrders);
-               checkNotNull(result);
-
-               Set<Mutation> mutations = new HashSet<>();
-
-               for (final VariableOrder varOrder : varOrders) {
-                       try {
-                               // Serialize the result to the variable order.
-                               byte[] serializedResult = 
converter.convert(result, varOrder);
-
-                               // Row ID = binding set values, Column Family = 
variable order
-                               // of the binding set.
-                               Mutation addResult = new 
Mutation(serializedResult);
-                               addResult.put(varOrder.toString(), "", "");
-                               mutations.add(addResult);
-                       } catch (BindingSetConversionException e) {
-                               throw new PcjException("Could not serialize a 
result.", e);
-                       }
-               }
-
-               return mutations;
-       }
+    /**
+     * Scan Rya for results that solve the PCJ's query and store them in the 
PCJ
+     * table.
+     * <p>
+     * This method assumes the PCJ table has already been created.
+     *
+     * @param accumuloConn
+     *            - A connection to the Accumulo that hosts the PCJ table. (not
+     *            null)
+     * @param pcjTableName
+     *            - The name of the PCJ table that will receive the results.
+     *            (not null)
+     * @param ryaConn
+     *            - A connection to the Rya store that will be queried to find
+     *            results. (not null)
+     * @throws PcjException
+     *             If results could not be written to the PCJ table, the PCJ
+     *             table does not exist, or the query that is being execute was
+     *             malformed.
+     */
+    public static void populatePcj(final Connector accumuloConn,
+            final String pcjTableName, final RepositoryConnection ryaConn)
+            throws PcjException {
+        checkNotNull(accumuloConn);
+        checkNotNull(pcjTableName);
+        checkNotNull(ryaConn);
+
+        try {
+            // Fetch the query that needs to be executed from the PCJ table.
+            final PcjMetadata pcjMetadata = new PcjTables().getPcjMetadata(
+                    accumuloConn, pcjTableName);
+            final String sparql = pcjMetadata.getSparql();
+
+            // Query Rya for results to the SPARQL query.
+            final TupleQuery query = 
ryaConn.prepareTupleQuery(QueryLanguage.SPARQL,
+                    sparql);
+            final TupleQueryResult results = query.evaluate();
+
+            // Load batches of 1000 of them at a time into the PCJ table
+            final Set<BindingSet> batch = new HashSet<>(1000);
+            while (results.hasNext()) {
+                batch.add(results.next());
+
+                if (batch.size() == 1000) {
+                    addResults(accumuloConn, pcjTableName, batch);
+                    batch.clear();
+                }
+            }
+
+            if (!batch.isEmpty()) {
+                addResults(accumuloConn, pcjTableName, batch);
+            }
+
+        } catch (RepositoryException | MalformedQueryException
+                | QueryEvaluationException e) {
+            throw new PcjException(
+                    "Could not populate a PCJ table with Rya results for the 
table named: "
+                            + pcjTableName, e);
+        }
+    }
+
+    public static void addResults(final Connector accumuloConn,
+            final String pcjTableName, final Collection<BindingSet> results)
+            throws PcjException {
+        checkNotNull(accumuloConn);
+        checkNotNull(pcjTableName);
+        checkNotNull(results);
+
+        // Write a result to each of the variable orders that are in the table.
+        writeResults(accumuloConn, pcjTableName, results);
+    }
+
+    /**
+     * Add a collection of results to a specific PCJ table.
+     *
+     * @param accumuloConn
+     *            - A connection to the Accumulo that hosts the PCJ table. (not
+     *            null)
+     * @param pcjTableName
+     *            - The name of the PCJ table that will receive the results.
+     *            (not null)
+     * @param results
+     *            - Binding sets that will be written to the PCJ table. (not
+     *            null)
+     * @throws PcjException
+     *             The provided PCJ table doesn't exist, is missing the PCJ
+     *             metadata, or the result could not be written to it.
+     */
+    private static void writeResults(final Connector accumuloConn,
+            final String pcjTableName, final Collection<BindingSet> results)
+            throws PcjException {
+        checkNotNull(accumuloConn);
+        checkNotNull(pcjTableName);
+        checkNotNull(results);
+
+        // Fetch the variable orders from the PCJ table.
+        final PcjMetadata metadata = new 
PcjTables().getPcjMetadata(accumuloConn,
+                pcjTableName);
+
+        // Write each result formatted using each of the variable orders.
+        BatchWriter writer = null;
+        try {
+            writer = accumuloConn.createBatchWriter(pcjTableName,
+                    new BatchWriterConfig());
+            for (final BindingSet result : results) {
+                final Set<Mutation> addResultMutations = 
makeWriteResultMutations(
+                        metadata.getVarOrders(), result);
+                writer.addMutations(addResultMutations);
+            }
+        } catch (TableNotFoundException | MutationsRejectedException e) {
+            throw new PcjException(
+                    "Could not add results to the PCJ table named: "
+                            + pcjTableName, e);
+        } finally {
+            if (writer != null) {
+                try {
+                    writer.close();
+                } catch (final MutationsRejectedException e) {
+                    throw new PcjException(
+                            "Could not add results to a PCJ table because some 
of the mutations were rejected.",
+                            e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Create the {@link Mutations} required to write a new {@link BindingSet}
+     * to a PCJ table for each {@link VariableOrder} that is provided.
+     *
+     * @param varOrders
+     *            - The variables orders the result will be written to. (not
+     *            null)
+     * @param result
+     *            - A new PCJ result. (not null)
+     * @return Mutation that will write the result to a PCJ table.
+     * @throws PcjException
+     *             The binding set could not be encoded.
+     */
+    private static Set<Mutation> makeWriteResultMutations(
+            final Set<VariableOrder> varOrders, final BindingSet result)
+            throws PcjException {
+        checkNotNull(varOrders);
+        checkNotNull(result);
+
+        final Set<Mutation> mutations = new HashSet<>();
+
+        for (final VariableOrder varOrder : varOrders) {
+            try {
+                // Serialize the result to the variable order.
+                final byte[] serializedResult = converter.convert(result, 
varOrder);
+
+                // Row ID = binding set values, Column Family = variable order
+                // of the binding set.
+                final Mutation addResult = new Mutation(serializedResult);
+                addResult.put(varOrder.toString(), "", "");
+                mutations.add(addResult);
+            } catch (final BindingSetConversionException e) {
+                throw new PcjException("Could not serialize a result.", e);
+            }
+        }
+
+        return mutations;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/917e7a57/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java
index 3195d24..6fea2ba 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecompJoinOptimizerIntegrationTest.java
@@ -1,5 +1,7 @@
 package mvm.rya.indexing.external;
 
+import java.net.UnknownHostException;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,21 +22,14 @@ package mvm.rya.indexing.external;
  */
 
 import java.util.List;
-import java.util.Map;
-
-import mvm.rya.api.persist.RyaDAOException;
-import mvm.rya.rdftriplestore.inference.InferenceEngineException;
 
 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.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.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.security.Authorizations;
 import org.apache.rya.indexing.pcj.storage.PcjException;
 import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory;
 import org.junit.After;
@@ -60,6 +55,9 @@ import org.openrdf.sail.SailException;
 
 import com.google.common.base.Optional;
 
+import mvm.rya.api.persist.RyaDAOException;
+import mvm.rya.rdftriplestore.inference.InferenceEngineException;
+
 public class PrecompJoinOptimizerIntegrationTest {
 
        private SailRepositoryConnection conn, pcjConn;
@@ -73,7 +71,8 @@ public class PrecompJoinOptimizerIntegrationTest {
                        TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       TableNotFoundException, InferenceEngineException {
+                       TableNotFoundException, InferenceEngineException, 
NumberFormatException,
+                       UnknownHostException {
 
                repo = PcjIntegrationTestingUtil.getNonPcjRepo(tablePrefix, 
"instance");
                conn = repo.getConnection();
@@ -119,8 +118,8 @@ public class PrecompJoinOptimizerIntegrationTest {
                        throws TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, RepositoryException, 
AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException,
-                       InferenceEngineException {
+                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                final String indexSparqlString = ""//
                                + "SELECT ?e ?l ?c " //
@@ -129,9 +128,9 @@ public class PrecompJoinOptimizerIntegrationTest {
                                + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon,
-                               tablePrefix + "INDEX_1", indexSparqlString, new 
String[] { "e",
-                                               "l", "c" }, 
Optional.<PcjVarOrderFactory> absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "c" },
+                               Optional.<PcjVarOrderFactory> absent());
                final String queryString = ""//
                                + "SELECT ?e ?c ?l ?o " //
                                + "{" //
@@ -147,8 +146,7 @@ public class PrecompJoinOptimizerIntegrationTest {
                conn = repo.getConnection();
                conn.add(sub, talksTo, obj);
                conn.add(sub2, talksTo, obj2);
-               pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, 
queryString).evaluate(
-                               crh);
+               pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, 
queryString).evaluate(crh);
 
                Assert.assertEquals(2, crh.getCount());
 
@@ -187,13 +185,12 @@ public class PrecompJoinOptimizerIntegrationTest {
                                + "  ?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon,
-                               tablePrefix + "INDEX_1", indexSparqlString, new 
String[] { "e",
-                                               "l", "c" }, 
Optional.<PcjVarOrderFactory> absent());
-               PcjIntegrationTestingUtil
-                               .createAndPopulatePcj(conn, accCon, tablePrefix 
+ "INDEX_2",
-                                               indexSparqlString2, new 
String[] { "e", "l", "o" },
-                                               Optional.<PcjVarOrderFactory> 
absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "c" },
+                               Optional.<PcjVarOrderFactory> absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_2", indexSparqlString2, new String[] { 
"e", "l", "o" },
+                               Optional.<PcjVarOrderFactory> absent());
                final CountingResultHandler crh = new CountingResultHandler();
                PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
                pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, 
queryString).evaluate(
@@ -208,8 +205,8 @@ public class PrecompJoinOptimizerIntegrationTest {
                        throws TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, RepositoryException, 
AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException,
-                       InferenceEngineException {
+                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                final String indexSparqlString = ""//
                                + "SELECT ?e ?l ?c " //
@@ -219,9 +216,9 @@ public class PrecompJoinOptimizerIntegrationTest {
                                + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon,
-                               tablePrefix + "INDEX_1", indexSparqlString, new 
String[] { "e",
-                                               "l", "c" }, 
Optional.<PcjVarOrderFactory> absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "c" },
+                               Optional.<PcjVarOrderFactory> absent());
                final String queryString = ""//
                                + "SELECT ?e ?c ?l ?o " //
                                + "{" //
@@ -250,8 +247,8 @@ public class PrecompJoinOptimizerIntegrationTest {
                        throws TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, RepositoryException, 
AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException,
-                       InferenceEngineException {
+                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                final String indexSparqlString2 = ""//
                                + "SELECT ?e ?l ?c " //
@@ -261,10 +258,9 @@ public class PrecompJoinOptimizerIntegrationTest {
                                + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
-               PcjIntegrationTestingUtil
-                               .createAndPopulatePcj(conn, accCon, tablePrefix 
+ "INDEX_2",
-                                               indexSparqlString2, new 
String[] { "e", "l", "c" },
-                                               Optional.<PcjVarOrderFactory> 
absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_2", indexSparqlString2, new String[] { 
"e", "l", "c" },
+                               Optional.<PcjVarOrderFactory> absent());
 
                final String queryString = ""//
                                + "SELECT ?e ?c ?o ?m ?l" //
@@ -294,8 +290,8 @@ public class PrecompJoinOptimizerIntegrationTest {
                        throws TupleQueryResultHandlerException, 
QueryEvaluationException,
                        MalformedQueryException, RepositoryException, 
AccumuloException,
                        AccumuloSecurityException, TableExistsException, 
RyaDAOException,
-                       SailException, TableNotFoundException, PcjException,
-                       InferenceEngineException {
+                       SailException, TableNotFoundException, PcjException, 
InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
                final String indexSparqlString1 = ""//
                                + "SELECT ?e ?l ?c " //
@@ -310,10 +306,9 @@ public class PrecompJoinOptimizerIntegrationTest {
                conn.add(sub3, RDF.TYPE, subclass3);
                conn.add(sub3, RDFS.LABEL, new LiteralImpl("label3"));
 
-               PcjIntegrationTestingUtil
-                               .createAndPopulatePcj(conn, accCon, tablePrefix 
+ "INDEX_1",
-                                               indexSparqlString1, new 
String[] { "e", "l", "c" },
-                                               Optional.<PcjVarOrderFactory> 
absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString1, new String[] { 
"e", "l", "c" },
+                               Optional.<PcjVarOrderFactory> absent());
                final String queryString = ""//
                                + "SELECT ?e ?c ?o ?m ?l" //
                                + "{" //
@@ -337,101 +332,132 @@ public class PrecompJoinOptimizerIntegrationTest {
 
        }
 
-
        @Test
-       public void testMultipleLeftJoin() throws AccumuloException,
+       public void testEvaluateTwoIndexUnionFilter() throws AccumuloException,
                        AccumuloSecurityException, TableExistsException,
                        RepositoryException, MalformedQueryException, 
SailException,
                        QueryEvaluationException, TableNotFoundException,
-                       TupleQueryResultHandlerException, RyaDAOException, 
PcjException,
-                       InferenceEngineException {
+                       TupleQueryResultHandlerException, RyaDAOException, 
PcjException, InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
 
-               final URI sub3 = new URIImpl("uri:entity3");
-               final URI obj3 = new URIImpl("uri:obj3");
-               final URI subclass3 = new URIImpl("uri:class3");
-               conn.add(sub3, RDF.TYPE, subclass3);
-               conn.add(sub3, talksTo, obj3);
                conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
+               conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+               conn.add(sub, RDF.TYPE, obj);
+               conn.add(sub2, RDF.TYPE, obj2);
 
                final String indexSparqlString = ""//
-                               + "SELECT ?e ?l ?c " //
+                               + "SELECT ?e ?l ?o " //
                                + "{" //
-                               + "  ?e a ?c . "//
-                               + "  OPTIONAL {?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l} "//
+                               + "   Filter(?l = \"label2\") " //
+                               + "  ?e a ?o . "//
+                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
                final String indexSparqlString2 = ""//
                                + "SELECT ?e ?l ?o " //
                                + "{" //
+                               + "   Filter(?l = \"label2\") " //
                                + "  ?e <uri:talksTo> ?o . "//
-                               + "  OPTIONAL {?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l} "//
+                               + "  ?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
                                + "}";//
 
                final String queryString = ""//
-                               + "SELECT ?e ?l ?c ?o " //
+                               + "SELECT ?c ?e ?l ?o " //
                                + "{" //
+                               + "   Filter(?l = \"label2\") " //
                                + "  ?e a ?c . "//
-                               + "  OPTIONAL {?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l} "//
-                               + "  ?e <uri:talksTo> ?o . "//
-                               + "  OPTIONAL {?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l} "//
+                               + " { ?e a ?o .  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l  }"//
+                               + " UNION { ?e <uri:talksTo> ?o .  ?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l  }"//
                                + "}";//
 
-               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon,
-                               tablePrefix + "INDEX_1", indexSparqlString, new 
String[] { "e",
-                                               "l", "c" }, 
Optional.<PcjVarOrderFactory> absent());
-               PcjIntegrationTestingUtil
-                               .createAndPopulatePcj(conn, accCon, tablePrefix 
+ "INDEX_2",
-                                               indexSparqlString2, new 
String[] { "e", "l", "o" },
-                                               Optional.<PcjVarOrderFactory> 
absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "o" },
+                               Optional.<PcjVarOrderFactory> absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_2", indexSparqlString2, new String[] { 
"e", "l", "o" },
+                               Optional.<PcjVarOrderFactory> absent());
 
                PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
                PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
                repo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, 
"instance");
                conn = repo.getConnection();
+               conn.add(sub2, RDF.TYPE, subclass2);
+               conn.add(sub2, RDF.TYPE, obj2);
+               final CountingResultHandler crh = new CountingResultHandler();
+               pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, 
queryString).evaluate(
+                               crh);
 
-               Scanner scanner = accCon.createScanner(tablePrefix + "INDEX_2",
-                               new Authorizations());
-               for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : 
scanner) {
-                       System.out.println(e.getKey().getRow());
-               }
+               Assert.assertEquals(6, crh.getCount());
+
+       }
+
+       @Test
+       public void testEvaluateTwoIndexLeftJoinUnionFilter()
+                       throws AccumuloException, AccumuloSecurityException,
+                       TableExistsException, RepositoryException, 
MalformedQueryException,
+                       SailException, QueryEvaluationException, 
TableNotFoundException,
+                       TupleQueryResultHandlerException, RyaDAOException, 
PcjException, InferenceEngineException,
+                       NumberFormatException, UnknownHostException {
+
+               conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
+               conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+               conn.add(sub, RDF.TYPE, obj);
+               conn.add(sub2, RDF.TYPE, obj2);
+
+               final URI livesIn = new URIImpl("uri:livesIn");
+               final URI city = new URIImpl("uri:city");
+               final URI city2 = new URIImpl("uri:city2");
+               final URI city3 = new URIImpl("uri:city3");
+               conn.add(sub, livesIn, city);
+               conn.add(sub2, livesIn, city2);
+               conn.add(sub2, livesIn, city3);
+               conn.add(sub, livesIn, city3);
+
+               final String indexSparqlString = ""//
+                               + "SELECT ?e ?l ?o " //
+                               + "{" //
+                               + "  ?e a ?o . "//
+                               + "  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
+                               + "}";//
+
+               final String indexSparqlString2 = ""//
+                               + "SELECT ?e ?l ?o " //
+                               + "{" //
+                               + "  ?e <uri:talksTo> ?o . "//
+                               + "  ?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l "//
+                               + "}";//
+
+               final String queryString = ""//
+                               + "SELECT ?c ?e ?l ?o " //
+                               + "{" //
+                               + " Filter(?c = <uri:city3>) " //
+                               + " ?e <uri:livesIn> ?c . "//
+                               + " OPTIONAL{{ ?e a ?o .  ?e 
<http://www.w3.org/2000/01/rdf-schema#label> ?l  }"//
+                               + " UNION { ?e <uri:talksTo> ?o .  ?o 
<http://www.w3.org/2000/01/rdf-schema#label> ?l  }}"//
+                               + "}";//
+
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_1", indexSparqlString, new String[] { 
"e", "l", "o" },
+                               Optional.<PcjVarOrderFactory> absent());
+               PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, 
tablePrefix
+                               + "INDEX_2", indexSparqlString2, new String[] { 
"e", "l", "o" },
+                               Optional.<PcjVarOrderFactory> absent());
+
+               PcjIntegrationTestingUtil.deleteCoreRyaTables(accCon, 
tablePrefix);
+               PcjIntegrationTestingUtil.closeAndShutdown(conn, repo);
+               repo = PcjIntegrationTestingUtil.getPcjRepo(tablePrefix, 
"instance");
+               conn = repo.getConnection();
+               conn.add(sub2, livesIn, city3);
+               conn.add(sub, livesIn, city3);
 
                final CountingResultHandler crh = new CountingResultHandler();
                pcjConn.prepareTupleQuery(QueryLanguage.SPARQL, 
queryString).evaluate(
                                crh);
 
-               Assert.assertEquals(3, crh.getCount());
+               Assert.assertEquals(6, crh.getCount());
 
        }
 
-       // @Test
-       // public void leftJoinExperiment() throws AccumuloException,
-       // AccumuloSecurityException, TableExistsException,
-       // RepositoryException, MalformedQueryException, SailException,
-       // QueryEvaluationException, TableNotFoundException,
-       // TupleQueryResultHandlerException, RyaDAOException, PcjException,
-       // InferenceEngineException {
-       //
-       // final String indexSparqlString = ""//
-       // + "SELECT ?e " //
-       // + "{" //
-       // + "  ?e a <uri:class> . "//
-       // +
-       // "  OPTIONAL {?e <http://www.w3.org/2000/01/rdf-schema#label> 
\"label2\"} "//
-       // + "}";//
-       //
-       //
-       // PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon,
-       // tablePrefix + "INDEX_1", indexSparqlString, new String[] {"e"},
-       // Optional.<PcjVarOrderFactory> absent());
-       //
-       // Scanner scanner = accCon.createScanner(tablePrefix + "INDEX_1",
-       // new Authorizations());
-       // for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : 
scanner) {
-       // System.out.println(e.getKey().getRow());
-       // }
-       //
-       // }
-
        public static class CountingResultHandler implements
                        TupleQueryResultHandler {
                private int count = 0;
@@ -441,16 +467,16 @@ public class PrecompJoinOptimizerIntegrationTest {
                }
 
                public void resetCount() {
-                       this.count = 0;
+                       count = 0;
                }
 
                @Override
-               public void startQueryResult(List<String> arg0)
+               public void startQueryResult(final List<String> arg0)
                                throws TupleQueryResultHandlerException {
                }
 
                @Override
-               public void handleSolution(BindingSet arg0)
+               public void handleSolution(final BindingSet arg0)
                                throws TupleQueryResultHandlerException {
                        System.out.println(arg0);
                        count++;
@@ -462,14 +488,14 @@ public class PrecompJoinOptimizerIntegrationTest {
                }
 
                @Override
-               public void handleBoolean(boolean arg0)
+               public void handleBoolean(final boolean arg0)
                                throws QueryResultHandlerException {
                        // TODO Auto-generated method stub
 
                }
 
                @Override
-               public void handleLinks(List<String> arg0)
+               public void handleLinks(final List<String> arg0)
                                throws QueryResultHandlerException {
                        // TODO Auto-generated method stub
 

Reply via email to