http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinStorageSupplierTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinStorageSupplierTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinStorageSupplierTest.java
new file mode 100644
index 0000000..99b0e89
--- /dev/null
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinStorageSupplierTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package mvm.rya.indexing.external;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage;
+import org.junit.Test;
+
+import com.google.common.base.Supplier;
+
+import 
mvm.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType;
+import mvm.rya.indexing.external.accumulo.AccumuloPcjStorage;
+import mvm.rya.indexing.external.accumulo.AccumuloPcjStorageSupplier;
+
+/**
+ * Tests the methods of {@link PrecomputedJoinStorageSupplier}.
+ */
+public class PrecomputedJoinStorageSupplierTest {
+
+    @Test(expected = NullPointerException.class)
+    public void notConfigured() {
+        // Create a supplier that does not return any configuration.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        final PrecomputedJoinStorageSupplier storageSupplier = new 
PrecomputedJoinStorageSupplier(configSupplier, 
mock(AccumuloPcjStorageSupplier.class));
+
+        // Try to get the storage.
+        storageSupplier.get();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void storageTypeNotSet() {
+        // Create a supplier that does not return any configuration.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        when(configSupplier.get()).thenReturn( new Configuration() );
+        final PrecomputedJoinStorageSupplier storageSupplier = new 
PrecomputedJoinStorageSupplier(configSupplier, 
mock(AccumuloPcjStorageSupplier.class));
+
+        // Try to get the storage.
+        storageSupplier.get();
+    }
+
+    @Test
+    public void configuredForAccumulo() {
+        // Create a supplier that does not return any configuration.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        final Configuration config = new Configuration();
+        config.set(PrecomputedJoinIndexerConfig.PCJ_STORAGE_TYPE, 
PrecomputedJoinStorageType.ACCUMULO.toString());
+        when(configSupplier.get()).thenReturn( config );
+
+        final AccumuloPcjStorageSupplier accumuloSupplier = 
mock(AccumuloPcjStorageSupplier.class);
+        final AccumuloPcjStorage mockAccumuloStorage = 
mock(AccumuloPcjStorage.class);
+        when(accumuloSupplier.get()).thenReturn(mockAccumuloStorage);
+
+        final PrecomputedJoinStorageSupplier storageSupplier = new 
PrecomputedJoinStorageSupplier(configSupplier, accumuloSupplier);
+
+        // Ensure the mock AccumuloPcjStorage is what was returned.
+        final PrecomputedJoinStorage storage = storageSupplier.get();
+        assertEquals(mockAccumuloStorage, storage);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinUpdaterSupplierTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinUpdaterSupplierTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinUpdaterSupplierTest.java
new file mode 100644
index 0000000..c2fedb7
--- /dev/null
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/PrecomputedJoinUpdaterSupplierTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package mvm.rya.indexing.external;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.rya.indexing.pcj.update.PrecomputedJoinUpdater;
+import org.junit.Test;
+
+import com.google.common.base.Supplier;
+
+import 
mvm.rya.indexing.external.PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType;
+import mvm.rya.indexing.external.fluo.FluoPcjUpdater;
+import mvm.rya.indexing.external.fluo.FluoPcjUpdaterSupplier;
+
+/**
+ * Tests the methods of {@link PrecomputedJoinUpdaterSupplier}.
+ */
+public class PrecomputedJoinUpdaterSupplierTest {
+
+    @Test(expected = NullPointerException.class)
+    public void notConfigured() {
+        // Create a supplier that does not return any configuration.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        final PrecomputedJoinUpdaterSupplier updaterSupplier = new 
PrecomputedJoinUpdaterSupplier(configSupplier, 
mock(FluoPcjUpdaterSupplier.class));
+
+        // Try to get the updater.
+        updaterSupplier.get();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void updaterTypeNotSet() {
+        // Create a supplier that is not configured to know which type of 
updater to use.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        when(configSupplier.get()).thenReturn( new Configuration() );
+        final PrecomputedJoinUpdaterSupplier updaterSupplier = new 
PrecomputedJoinUpdaterSupplier(configSupplier, 
mock(FluoPcjUpdaterSupplier.class));
+
+        // Try to get the updater.
+        updaterSupplier.get();
+    }
+
+    @Test
+    public void configuredForFluo() {
+        // Create a supplier that is configured to use a Fluo updater.
+        final Supplier<Configuration> configSupplier = mock(Supplier.class);
+        final Configuration config = new Configuration();
+        config.set(PrecomputedJoinIndexerConfig.PCJ_UPDATER_TYPE, 
PrecomputedJoinUpdaterType.FLUO.toString());
+        when(configSupplier.get()).thenReturn( config );
+
+        final FluoPcjUpdaterSupplier fluoSupplier = 
mock(FluoPcjUpdaterSupplier.class);
+        final FluoPcjUpdater mockFluoUpdater = mock(FluoPcjUpdater.class);
+        when(fluoSupplier.get()).thenReturn(mockFluoUpdater);
+
+        final PrecomputedJoinUpdaterSupplier updaterSupplier = new 
PrecomputedJoinUpdaterSupplier(configSupplier, fluoSupplier);
+
+        // Ensure the mock FluoPcjUpdater is what was returned.
+        final PrecomputedJoinUpdater updater = updaterSupplier.get();
+        assertEquals(mockFluoUpdater, updater);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetTest.java
index c400f03..ed5d37d 100644
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetTest.java
+++ 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetTest.java
@@ -1,5 +1,3 @@
-package mvm.rya.indexing.external.tupleSet;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -8,9 +6,9 @@ package mvm.rya.indexing.external.tupleSet;
  * 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
@@ -18,28 +16,13 @@ package mvm.rya.indexing.external.tupleSet;
  * specific language governing permissions and limitations
  * under the License.
  */
-
-import info.aduna.iteration.CloseableIteration;
+package mvm.rya.indexing.external.tupleSet;
 
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import mvm.rya.accumulo.AccumuloRdfConfiguration;
-import mvm.rya.api.RdfCloudTripleStoreConfiguration;
-import mvm.rya.api.persist.RyaDAOException;
-import mvm.rya.api.resolver.RyaTypeResolverException;
-import mvm.rya.sail.config.RyaSailFactory;
-import mvm.rya.indexing.accumulo.ConfigUtils;
-import mvm.rya.indexing.external.PcjIntegrationTestingUtil;
-import mvm.rya.indexing.external.QueryVariableNormalizer;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjTableNameFactory;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjVarOrderFactory;
-import mvm.rya.rdftriplestore.RyaSailRepository;
-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;
@@ -47,6 +30,9 @@ import 
org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.rya.indexing.pcj.storage.PcjException;
+import org.apache.rya.indexing.pcj.storage.accumulo.PcjTableNameFactory;
+import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -72,6 +58,18 @@ import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
+import info.aduna.iteration.CloseableIteration;
+import mvm.rya.accumulo.AccumuloRdfConfiguration;
+import mvm.rya.api.RdfCloudTripleStoreConfiguration;
+import mvm.rya.api.persist.RyaDAOException;
+import mvm.rya.api.resolver.RyaTypeResolverException;
+import mvm.rya.indexing.accumulo.ConfigUtils;
+import mvm.rya.indexing.external.PcjIntegrationTestingUtil;
+import mvm.rya.indexing.external.QueryVariableNormalizer;
+import mvm.rya.rdftriplestore.RyaSailRepository;
+import mvm.rya.rdftriplestore.inference.InferenceEngineException;
+import mvm.rya.sail.config.RyaSailFactory;
+
 public class AccumuloIndexSetTest {
 
         protected static Connector accumuloConn = null;
@@ -648,7 +646,7 @@ public class AccumuloIndexSetTest {
 
         // Create and populate the PCJ table.
         PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn, 
pcjTableName, sparql, new String[]{"name", "age"}, 
Optional.<PcjVarOrderFactory>absent());
-        AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,pcjTableName);
+        final AccumuloIndexSet ais = new 
AccumuloIndexSet(accumuloConn,pcjTableName);
 
         final QueryBindingSet bs1 = new QueryBindingSet();
         bs1.addBinding("age",new LiteralImpl("16"));

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloPcjSerialzerTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloPcjSerialzerTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloPcjSerialzerTest.java
deleted file mode 100644
index 4efbb30..0000000
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloPcjSerialzerTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package mvm.rya.indexing.external.tupleSet;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import mvm.rya.api.resolver.RyaTypeResolverException;
-import 
mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openrdf.model.impl.LiteralImpl;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.algebra.evaluation.QueryBindingSet;
-import org.openrdf.query.impl.MapBindingSet;
-
-/**
- * Tests the methods of {@link AccumuloPcjSerialzer}.
- */
-public class AccumuloPcjSerialzerTest {
-
-    /**
-     * The BindingSet has fewer Bindings than there are variables in the 
variable
-     * order, but they are all in the variable order. This is the case where
-     * the missing bindings were optional.
-     */
-    @Test
-    public void serialize_bindingsSubsetOfVarOrder() throws 
BindingSetConversionException {
-        // Setup the Binding Set.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        
-        // Setup the variable order.
-        final VariableOrder varOrder = new VariableOrder("x", "a", "y", "b");
-        
-        // Create the byte[] representation of the BindingSet.
-        BindingSetConverter<byte[]> converter = new AccumuloPcjSerializer();
-        byte[] serialized = converter.convert(originalBindingSet, varOrder);
-        
-        // Deserialize the byte[] back into the binding set.
-        BindingSet deserialized = converter.convert(serialized, varOrder);
-        
-        // Ensure the deserialized value matches the original.
-        assertEquals(originalBindingSet, deserialized);
-    }
-
-    /**
-     * The BindingSet has a Binding whose name is not in the variable order.
-     * This is illegal.
-     */
-    @Test(expected = IllegalArgumentException.class)
-    public void serialize_bindingNotInVariableOrder() throws 
RyaTypeResolverException, BindingSetConversionException {
-        // Setup the Binding Set.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        originalBindingSet.addBinding("z", new URIImpl("http://d";));
-
-        // Setup the variable order.
-        final VariableOrder varOrder = new VariableOrder("x", "y");
-        
-        // Create the byte[] representation of the BindingSet. This will throw 
an exception.
-        BindingSetConverter<byte[]> converter = new AccumuloPcjSerializer();
-        converter.convert(originalBindingSet, varOrder);
-    }
-    
-       @Test
-       public void basicShortUriBsTest() throws BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new URIImpl("http://uri1";));
-               bs.addBinding("Y",new URIImpl("http://uri2";));
-               final VariableOrder varOrder = new VariableOrder("X","Y");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-
-       @Test
-       public void basicLongUriBsTest() throws BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new URIImpl("http://uri1";));
-               bs.addBinding("Y",new URIImpl("http://uri2";));
-               bs.addBinding("Z",new URIImpl("http://uri3";));
-               bs.addBinding("A",new URIImpl("http://uri4";));
-               bs.addBinding("B",new URIImpl("http://uri5";));
-               final VariableOrder varOrder = new 
VariableOrder("X","Y","Z","A","B");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-
-       @Test
-       public void basicShortStringLiteralBsTest() throws 
BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new LiteralImpl("literal1"));
-               bs.addBinding("Y",new LiteralImpl("literal2"));
-               final VariableOrder varOrder = new VariableOrder("X","Y");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-
-       @Test
-       public void basicShortMixLiteralBsTest() throws 
BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new LiteralImpl("literal1"));
-               bs.addBinding("Y",new LiteralImpl("5", new 
URIImpl("http://www.w3.org/2001/XMLSchema#integer";)));
-               final VariableOrder varOrder = new VariableOrder("X","Y");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-
-       @Test
-       public void basicLongMixLiteralBsTest() throws 
BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new LiteralImpl("literal1"));
-               bs.addBinding("Y",new LiteralImpl("5", new 
URIImpl("http://www.w3.org/2001/XMLSchema#integer";)));
-               bs.addBinding("Z",new LiteralImpl("5.0", new 
URIImpl("http://www.w3.org/2001/XMLSchema#double";)));
-               bs.addBinding("W",new LiteralImpl("1000", new 
URIImpl("http://www.w3.org/2001/XMLSchema#long";)));
-               final VariableOrder varOrder = new 
VariableOrder("W","X","Y","Z");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-
-       @Test
-       public void basicMixUriLiteralBsTest() throws 
BindingSetConversionException {
-               final QueryBindingSet bs = new QueryBindingSet();
-               bs.addBinding("X",new LiteralImpl("literal1"));
-               bs.addBinding("Y",new LiteralImpl("5", new 
URIImpl("http://www.w3.org/2001/XMLSchema#integer";)));
-               bs.addBinding("Z",new LiteralImpl("5.0", new 
URIImpl("http://www.w3.org/2001/XMLSchema#double";)));
-               bs.addBinding("W",new LiteralImpl("1000", new 
URIImpl("http://www.w3.org/2001/XMLSchema#long";)));
-               bs.addBinding("A",new URIImpl("http://uri1";));
-               bs.addBinding("B",new URIImpl("http://uri2";));
-               bs.addBinding("C",new URIImpl("http://uri3";));
-               final VariableOrder varOrder = new 
VariableOrder("A","W","X","Y","Z","B","C");
-               
-               BindingSetConverter<byte[]> converter = new 
AccumuloPcjSerializer();
-               final byte[] byteVal = converter.convert(bs, varOrder);
-               final BindingSet newBs = converter.convert(byteVal, varOrder);
-               assertEquals(bs, newBs);
-       }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/BindingSetStringConverterTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/BindingSetStringConverterTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/BindingSetStringConverterTest.java
deleted file mode 100644
index dc24de0..0000000
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/BindingSetStringConverterTest.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package mvm.rya.indexing.external.tupleSet;
-
-import static org.junit.Assert.assertEquals;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.junit.Test;
-import org.openrdf.model.impl.BooleanLiteralImpl;
-import org.openrdf.model.impl.DecimalLiteralImpl;
-import org.openrdf.model.impl.IntegerLiteralImpl;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.impl.MapBindingSet;
-
-import 
mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
-
-/**
- * Tests the methods of {@link BindingSetStringConverter}.
- */
-public class BindingSetStringConverterTest {
-
-    @Test
-    public void toString_URIs() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        originalBindingSet.addBinding("z", new URIImpl("http://c";));
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure it converted to the expected result.l
-        final String expected =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        assertEquals(expected, bindingSetString);
-    }
-
-    @Test
-    public void toString_Decimal() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new DecimalLiteralImpl(new 
BigDecimal(2.5)));
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("x");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final String expected = 
"2.5<<~>>http://www.w3.org/2001/XMLSchema#decimal";;
-        assertEquals(expected, bindingSetString);
-    }
-
-    @Test
-    public void toString_Boolean() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new BooleanLiteralImpl(true));
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("x");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final String expected = 
"true<<~>>http://www.w3.org/2001/XMLSchema#boolean";;
-        assertEquals(expected, bindingSetString);
-    }
-
-    @Test
-    public void toString_Integer() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new 
IntegerLiteralImpl(BigInteger.valueOf(5)));
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("x");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final String expected = 
"5<<~>>http://www.w3.org/2001/XMLSchema#integer";;
-        assertEquals(expected, bindingSetString);
-    }
-
-    /**
-     * All of the Bindings in the BindingSet exactly match the variable order.
-     * This is the simplest case and is legal.
-     */
-    @Test
-    public void toString_bindingsMatchVarOrder() throws 
BindingSetConversionException {
-        // Setup the Binding Set.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-
-        // Setup the variable order.
-        final VariableOrder varOrder = new VariableOrder("x", "y");
-
-        // Create the String representation of the BindingSet.
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure the expected value was created.
-        final String expected =
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-        assertEquals(expected, bindingSetString);
-    }
-
-    /**
-     * The BindingSet has fewer Bindings than there are variables in the 
variable
-     * order, but they are all in the variable order. This is the case where
-     * the missing bindings were optional.
-     */
-    @Test
-    public void toString_bindingsSubsetOfVarOrder() throws 
BindingSetConversionException {
-        // Setup the Binding Set.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-
-        // Setup the variable order.
-        final VariableOrder varOrder = new VariableOrder("x", "a", "y", "b");
-
-        // Create the String representation of the BindingSet.
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final String bindingSetString = converter.convert(originalBindingSet, 
varOrder);
-
-        // Ensure the expected value was created.
-        final String expected =
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                BindingSetStringConverter.NULL_VALUE_STRING + ":::" +
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                BindingSetStringConverter.NULL_VALUE_STRING;
-        assertEquals(expected, bindingSetString);
-    }
-
-    /**
-     * The BindingSet has a Binding whose name is not in the variable order.
-     * This is illegal.
-     */
-    @Test(expected = IllegalArgumentException.class)
-    public void toString_bindingNotInVariableOrder() throws 
BindingSetConversionException {
-        // Setup the Binding Set.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        originalBindingSet.addBinding("z", new URIImpl("http://d";));
-
-        // Setup the variable order.
-        final VariableOrder varOrder = new VariableOrder("x", "y");
-
-        // Create the String representation of the BindingSet. This will throw 
an exception.
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        converter.convert(originalBindingSet, varOrder);
-    }
-
-    @Test
-    public void fromString() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        // Convert it to a BindingSet
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("x", new URIImpl("http://a";));
-        expected.addBinding("y", new URIImpl("http://b";));
-        expected.addBinding("z", new URIImpl("http://c";));
-
-        assertEquals(expected, bindingSet);
-    }
-
-    /**
-     * Ensures that when a binding set is converted from a String back to a
-     * BindingSet, null values do not get converted into Bindings.
-     */
-    @Test
-    public void fromString_nullValues() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://value 
1<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                BindingSetStringConverter.NULL_VALUE_STRING + ":::" +
-                "http://value 
2<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                BindingSetStringConverter.NULL_VALUE_STRING;
-
-        // Convert it to a BindingSet
-        final VariableOrder varOrder = new VariableOrder("x", "a", "y", "b");
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, 
varOrder);
-
-        // Ensure it converted to the expected reuslt.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("x", new URIImpl("http://value 1"));
-        expected.addBinding("y", new URIImpl("http://value 2"));
-
-        assertEquals(expected, bindingSet);
-    }
-
-    @Test
-    public void fromString_Decimal() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString = 
"2.5<<~>>http://www.w3.org/2001/XMLSchema#decimal";;
-
-        // Convert it to a BindingSet
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, new 
VariableOrder("x"));
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("x", new DecimalLiteralImpl(new BigDecimal(2.5)));
-
-        assertEquals(expected, bindingSet);
-    }
-
-    @Test
-    public void fromString_Boolean() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString = 
"true<<~>>http://www.w3.org/2001/XMLSchema#boolean";;
-
-        // Convert it to a BindingSet
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, new 
VariableOrder("x"));
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("x", new BooleanLiteralImpl(true));
-
-        assertEquals(expected, bindingSet);
-    }
-
-    @Test
-    public void fromString_Integer() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString = 
"5<<~>>http://www.w3.org/2001/XMLSchema#integer";;
-
-        // Convert it to a BindingSet
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, new 
VariableOrder("x"));
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("x", new 
IntegerLiteralImpl(BigInteger.valueOf(5)));
-
-        assertEquals(expected, bindingSet);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void fromString_varOrderTooShort() throws 
BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        // This variable order is too short.
-        final VariableOrder varOrder = new VariableOrder("x");
-
-        // The conversion should throw an exception.
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        converter.convert(bindingSetString, varOrder);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void fromString_varOrderTooLong() throws 
BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        // This variable order is too long.
-        final VariableOrder varOrder = new VariableOrder("x", "y", "z");
-
-        // The conversion should throw an exception.
-        final BindingSetConverter<String> converter = new 
BindingSetStringConverter();
-        converter.convert(bindingSetString, varOrder);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesIntegrationTests.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesIntegrationTests.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesIntegrationTests.java
deleted file mode 100644
index c452aad..0000000
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesIntegrationTests.java
+++ /dev/null
@@ -1,438 +0,0 @@
-package mvm.rya.indexing.external.tupleSet;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Map.Entry;
-import java.util.Set;
-
-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.Instance;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.hadoop.io.Text;
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.openrdf.model.Statement;
-import org.openrdf.model.impl.LiteralImpl;
-import org.openrdf.model.impl.NumericLiteralImpl;
-import org.openrdf.model.impl.StatementImpl;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.model.vocabulary.XMLSchema;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.impl.MapBindingSet;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-import com.google.common.io.Files;
-
-import mvm.rya.accumulo.AccumuloRdfConfiguration;
-import mvm.rya.accumulo.AccumuloRyaDAO;
-import mvm.rya.api.RdfCloudTripleStoreConfiguration;
-import mvm.rya.indexing.accumulo.ConfigUtils;
-import mvm.rya.indexing.accumulo.VisibilityBindingSet;
-import 
mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjMetadata;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjTableNameFactory;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjVarOrderFactory;
-import mvm.rya.indexing.external.tupleSet.PcjTables.ShiftVarOrderFactory;
-import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
-import mvm.rya.rdftriplestore.RdfCloudTripleStore;
-import mvm.rya.rdftriplestore.RyaSailRepository;
-
-/**
- * Performs integration test using {@link MiniAccumuloCluster} to ensure the
- * functions of {@link PcjTables} work within a cluster setting.
- */
-public class PcjTablesIntegrationTests {
-    private static final Logger log = 
Logger.getLogger(PcjTablesIntegrationTests.class);
-
-    private static final AccumuloPcjSerializer converter = new 
AccumuloPcjSerializer();
-
-    protected static final String RYA_TABLE_PREFIX = "demo_";
-
-    // Rya data store and connections.
-    protected MiniAccumuloCluster accumulo = null;
-    protected static Connector accumuloConn = null;
-    protected RyaSailRepository ryaRepo = null;
-    protected RepositoryConnection ryaConn = null;
-
-    @Before
-    public void setupMiniResources() throws IOException, InterruptedException, 
AccumuloException, AccumuloSecurityException, RepositoryException {
-        // Initialize the Mini Accumulo that will be used to store Triples and 
get a connection to it.
-        accumulo = startMiniAccumulo();
-
-        // Setup the Rya library to use the Mini Accumulo.
-        ryaRepo = setupRya(accumulo);
-        ryaConn = ryaRepo.getConnection();
-    }
-
-    /**
-     * Ensure that when a new PCJ table is created, it is initialized with the
-     * correct metadata values.
-     * <p>
-     * The method being tested is {@link PcjTables#createPcjTable(Connector, 
String, Set, String)}
-     */
-    @Test
-    public void createPcjTable() throws PcjException {
-        final String sparql =
-                "SELECT ?name ?age " +
-                "{" +
-                  "FILTER(?age < 30) ." +
-                  "?name <http://hasAge> ?age." +
-                  "?name <http://playsSport> \"Soccer\" " +
-                "}";
-
-        // Create a PCJ table in the Mini Accumulo.
-        final String pcjTableName = new 
PcjTableNameFactory().makeTableName(RYA_TABLE_PREFIX, "testPcj");
-        final Set<VariableOrder> varOrders = new 
ShiftVarOrderFactory().makeVarOrders(new VariableOrder("name;age"));
-        final PcjTables pcjs = new PcjTables();
-        pcjs.createPcjTable(accumuloConn, pcjTableName, varOrders, sparql);
-
-        // Fetch the PcjMetadata and ensure it has the correct values.
-        final PcjMetadata pcjMetadata = pcjs.getPcjMetadata(accumuloConn, 
pcjTableName);
-
-        // Ensure the metadata matches the expected value.
-        final PcjMetadata expected = new PcjMetadata(sparql, 0L, varOrders);
-        assertEquals(expected, pcjMetadata);
-    }
-
-    /**
-     * Ensure when results have been written to the PCJ table that they are in 
Accumulo.
-     * <p>
-     * The method being tested is {@link PcjTables#addResults(Connector, 
String, java.util.Collection)}
-     */
-    @Test
-    public void addResults() throws PcjException, TableNotFoundException, 
BindingSetConversionException {
-        final String sparql =
-                "SELECT ?name ?age " +
-                "{" +
-                  "FILTER(?age < 30) ." +
-                  "?name <http://hasAge> ?age." +
-                  "?name <http://playsSport> \"Soccer\" " +
-                "}";
-
-        // Create a PCJ table in the Mini Accumulo.
-        final String pcjTableName = new 
PcjTableNameFactory().makeTableName(RYA_TABLE_PREFIX, "testPcj");
-        final Set<VariableOrder> varOrders = new 
ShiftVarOrderFactory().makeVarOrders(new VariableOrder("name;age"));
-        final PcjTables pcjs = new PcjTables();
-        pcjs.createPcjTable(accumuloConn, pcjTableName, varOrders, sparql);
-
-        // Add a few results to the PCJ table.
-        final MapBindingSet alice = new MapBindingSet();
-        alice.addBinding("name", new URIImpl("http://Alice";));
-        alice.addBinding("age", new NumericLiteralImpl(14, XMLSchema.INTEGER));
-
-        final MapBindingSet bob = new MapBindingSet();
-        bob.addBinding("name", new URIImpl("http://Bob";));
-        bob.addBinding("age", new NumericLiteralImpl(16, XMLSchema.INTEGER));
-
-        final MapBindingSet charlie = new MapBindingSet();
-        charlie.addBinding("name", new URIImpl("http://Charlie";));
-        charlie.addBinding("age", new NumericLiteralImpl(12, 
XMLSchema.INTEGER));
-
-        final Set<BindingSet> results = Sets.<BindingSet>newHashSet(alice, 
bob, charlie);
-        pcjs.addResults(accumuloConn, pcjTableName, 
Sets.<VisibilityBindingSet>newHashSet(
-                new VisibilityBindingSet(alice),
-                new VisibilityBindingSet(bob),
-                new VisibilityBindingSet(charlie)));
-
-        // Make sure the cardinality was updated.
-        final PcjMetadata metadata = pcjs.getPcjMetadata(accumuloConn, 
pcjTableName);
-        assertEquals(3, metadata.getCardinality());
-
-        // Scan Accumulo for the stored results.
-        final Multimap<String, BindingSet> fetchedResults = 
loadPcjResults(accumuloConn, pcjTableName);
-
-        // Ensure the expected results match those that were stored.
-        final Multimap<String, BindingSet> expectedResults = 
HashMultimap.create();
-        expectedResults.putAll("name;age", results);
-        expectedResults.putAll("age;name", results);
-        assertEquals(expectedResults, fetchedResults);
-    }
-
-    /**
-     * Ensure when results are already stored in Rya, that we are able to 
populate
-     * the PCJ table for a new SPARQL query using those results.
-     * <p>
-     * The method being tested is: {@link PcjTables#populatePcj(Connector, 
String, RepositoryConnection, String)}
-     */
-    @Test
-    public void populatePcj() throws RepositoryException, PcjException, 
TableNotFoundException, BindingSetConversionException {
-        // Load some Triples into Rya.
-        final Set<Statement> triples = new HashSet<>();
-        triples.add( new StatementImpl(new URIImpl("http://Alice";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(14, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Alice";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Bob";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(16, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Bob";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Charlie";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(12, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Charlie";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Eve";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(43, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Eve";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-
-        for(final Statement triple : triples) {
-            ryaConn.add(triple);
-        }
-
-        // Create a PCJ table that will include those triples in its results.
-        final String sparql =
-                "SELECT ?name ?age " +
-                "{" +
-                  "FILTER(?age < 30) ." +
-                  "?name <http://hasAge> ?age." +
-                  "?name <http://playsSport> \"Soccer\" " +
-                "}";
-
-        final String pcjTableName = new 
PcjTableNameFactory().makeTableName(RYA_TABLE_PREFIX, "testPcj");
-        final Set<VariableOrder> varOrders = new 
ShiftVarOrderFactory().makeVarOrders(new VariableOrder("name;age"));
-        final PcjTables pcjs = new PcjTables();
-        pcjs.createPcjTable(accumuloConn, pcjTableName, varOrders, sparql);
-
-        // Populate the PCJ table using a Rya connection.
-        pcjs.populatePcj(accumuloConn, pcjTableName, ryaConn);
-
-        // Scan Accumulo for the stored results.
-        final Multimap<String, BindingSet> fetchedResults = 
loadPcjResults(accumuloConn, pcjTableName);
-
-        // Make sure the cardinality was updated.
-        final PcjMetadata metadata = pcjs.getPcjMetadata(accumuloConn, 
pcjTableName);
-        assertEquals(3, metadata.getCardinality());
-
-        // Ensure the expected results match those that were stored.
-        final MapBindingSet alice = new MapBindingSet();
-        alice.addBinding("name", new URIImpl("http://Alice";));
-        alice.addBinding("age", new NumericLiteralImpl(14, XMLSchema.INTEGER));
-
-        final MapBindingSet bob = new MapBindingSet();
-        bob.addBinding("name", new URIImpl("http://Bob";));
-        bob.addBinding("age", new NumericLiteralImpl(16, XMLSchema.INTEGER));
-
-        final MapBindingSet charlie = new MapBindingSet();
-        charlie.addBinding("name", new URIImpl("http://Charlie";));
-        charlie.addBinding("age", new NumericLiteralImpl(12, 
XMLSchema.INTEGER));
-
-        final Set<BindingSet> results = Sets.<BindingSet>newHashSet(alice, 
bob, charlie);
-
-        final Multimap<String, BindingSet> expectedResults = 
HashMultimap.create();
-        expectedResults.putAll("name;age", results);
-        expectedResults.putAll("age;name", results);
-        assertEquals(expectedResults, fetchedResults);
-    }
-
-    /**
-     * Ensure the method that creates a new PCJ table, scans Rya for matches, 
and
-     * stores them in the PCJ table works.
-     * <p>
-     * The method being tested is: {@link 
PcjTables#createAndPopulatePcj(RepositoryConnection, Connector, String, String, 
String[], Optional)}
-     */
-    @Test
-    public void createAndPopulatePcj() throws RepositoryException, 
PcjException, TableNotFoundException, BindingSetConversionException {
-        // Load some Triples into Rya.
-        final Set<Statement> triples = new HashSet<>();
-        triples.add( new StatementImpl(new URIImpl("http://Alice";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(14, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Alice";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Bob";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(16, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Bob";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Charlie";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(12, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Charlie";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-        triples.add( new StatementImpl(new URIImpl("http://Eve";), new 
URIImpl("http://hasAge";), new NumericLiteralImpl(43, XMLSchema.INTEGER)) );
-        triples.add( new StatementImpl(new URIImpl("http://Eve";), new 
URIImpl("http://playsSport";), new LiteralImpl("Soccer")) );
-
-        for(final Statement triple : triples) {
-            ryaConn.add(triple);
-        }
-
-        // Create a PCJ table that will include those triples in its results.
-        final String sparql =
-                "SELECT ?name ?age " +
-                "{" +
-                  "FILTER(?age < 30) ." +
-                  "?name <http://hasAge> ?age." +
-                  "?name <http://playsSport> \"Soccer\" " +
-                "}";
-
-        final String pcjTableName = new 
PcjTableNameFactory().makeTableName(RYA_TABLE_PREFIX, "testPcj");
-
-        // Create and populate the PCJ table.
-        final PcjTables pcjs = new PcjTables();
-        pcjs.createAndPopulatePcj(ryaConn, accumuloConn, pcjTableName, sparql, 
new String[]{"name", "age"}, Optional.<PcjVarOrderFactory>absent());
-
-        // Make sure the cardinality was updated.
-        final PcjMetadata metadata = pcjs.getPcjMetadata(accumuloConn, 
pcjTableName);
-        assertEquals(3, metadata.getCardinality());
-
-        // Scan Accumulo for the stored results.
-        final Multimap<String, BindingSet> fetchedResults = 
loadPcjResults(accumuloConn, pcjTableName);
-
-        // Ensure the expected results match those that were stored.
-        final MapBindingSet alice = new MapBindingSet();
-        alice.addBinding("name", new URIImpl("http://Alice";));
-        alice.addBinding("age", new NumericLiteralImpl(14, XMLSchema.INTEGER));
-
-        final MapBindingSet bob = new MapBindingSet();
-        bob.addBinding("name", new URIImpl("http://Bob";));
-        bob.addBinding("age", new NumericLiteralImpl(16, XMLSchema.INTEGER));
-
-        final MapBindingSet charlie = new MapBindingSet();
-        charlie.addBinding("name", new URIImpl("http://Charlie";));
-        charlie.addBinding("age", new NumericLiteralImpl(12, 
XMLSchema.INTEGER));
-
-        final Set<BindingSet> results = Sets.<BindingSet>newHashSet(alice, 
bob, charlie);
-
-        final Multimap<String, BindingSet> expectedResults = 
HashMultimap.create();
-        expectedResults.putAll("name;age", results);
-        expectedResults.putAll("age;name", results);
-
-        assertEquals(expectedResults, fetchedResults);
-    }
-
-    /**
-     * Scan accumulo for the results that are stored in a PCJ table. The
-     * multimap stores a set of deserialized binding sets that were in the PCJ
-     * table for every variable order that is found in the PCJ metadata.
-     */
-    private static Multimap<String, BindingSet> loadPcjResults(final Connector 
accumuloConn, final String pcjTableName) throws PcjException, 
TableNotFoundException, BindingSetConversionException {
-        final Multimap<String, BindingSet> fetchedResults = 
HashMultimap.create();
-
-        // Get the variable orders the data was written to.
-        final PcjTables pcjs = new PcjTables();
-        final PcjMetadata pcjMetadata = pcjs.getPcjMetadata(accumuloConn, 
pcjTableName);
-
-        // Scan Accumulo for the stored results.
-        for(final VariableOrder varOrder : pcjMetadata.getVarOrders()) {
-            final Scanner scanner = accumuloConn.createScanner(pcjTableName, 
new Authorizations());
-            scanner.fetchColumnFamily( new Text(varOrder.toString()) );
-
-            for(final Entry<Key, Value> entry : scanner) {
-                final byte[] serializedResult = 
entry.getKey().getRow().getBytes();
-                final BindingSet result = converter.convert(serializedResult, 
varOrder);
-                fetchedResults.put(varOrder.toString(), result);
-            }
-        }
-
-        return fetchedResults;
-    }
-
-    @After
-    public void shutdownMiniResources() {
-        if(ryaConn != null) {
-            try {
-                log.info("Shutting down Rya Connection.");
-                ryaConn.close();
-                log.info("Rya Connection shut down.");
-            } catch(final Exception e) {
-                log.error("Could not shut down the Rya Connection.", e);
-            }
-        }
-
-        if(ryaRepo != null) {
-            try {
-                log.info("Shutting down Rya Repo.");
-                ryaRepo.shutDown();
-                log.info("Rya Repo shut down.");
-            } catch(final Exception e) {
-                log.error("Could not shut down the Rya Repo.", e);
-            }
-        }
-
-        if(accumulo != null) {
-            try {
-                log.info("Shutting down the Mini Accumulo being used as a Rya 
store.");
-                accumulo.stop();
-                log.info("Mini Accumulo being used as a Rya store shut down.");
-            } catch(final Exception e) {
-                log.error("Could not shut down the Mini Accumulo.", e);
-            }
-        }
-    }
-
-    /**
-     * Setup a Mini Accumulo cluster that uses a temporary directory to store 
its data.
-     *
-     * @return A Mini Accumulo cluster.
-     */
-    private static MiniAccumuloCluster startMiniAccumulo() throws IOException, 
InterruptedException, AccumuloException, AccumuloSecurityException {
-        final File miniDataDir = Files.createTempDir();
-
-        // Setup and start the Mini Accumulo.
-        final MiniAccumuloCluster accumulo = new 
MiniAccumuloCluster(miniDataDir, "password");
-        accumulo.start();
-
-        // Store a connector to the Mini Accumulo.
-        final Instance instance = new 
ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
-        accumuloConn = instance.getConnector("root", new 
PasswordToken("password"));
-
-        return accumulo;
-    }
-
-    /**
-     * Format a Mini Accumulo to be a Rya repository.
-     *
-     * @param accumulo - The Mini Accumulo cluster Rya will sit on top of. 
(not null)
-     * @return The Rya repository sitting on top of the Mini Accumulo.
-     */
-    private static RyaSailRepository setupRya(final MiniAccumuloCluster 
accumulo) throws AccumuloException, AccumuloSecurityException, 
RepositoryException {
-        checkNotNull(accumulo);
-
-        // Setup the Rya Repository that will be used to create Repository 
Connections.
-        final RdfCloudTripleStore ryaStore = new RdfCloudTripleStore();
-        final AccumuloRyaDAO crdfdao = new AccumuloRyaDAO();
-        crdfdao.setConnector(accumuloConn);
-
-        // Setup Rya configuration values.
-        final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
-        conf.setTablePrefix("demo_");
-        conf.setDisplayQueryPlan(true);
-
-        conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, true);
-        conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, 
RYA_TABLE_PREFIX);
-        conf.set(ConfigUtils.CLOUDBASE_USER, "root");
-        conf.set(ConfigUtils.CLOUDBASE_PASSWORD, "password");
-        conf.set(ConfigUtils.CLOUDBASE_INSTANCE, accumulo.getInstanceName());
-
-        crdfdao.setConf(conf);
-        ryaStore.setRyaDAO(crdfdao);
-
-        final RyaSailRepository ryaRepo = new RyaSailRepository(ryaStore);
-        ryaRepo.initialize();
-
-        return ryaRepo;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesTests.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesTests.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesTests.java
deleted file mode 100644
index 6d5da92..0000000
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/PcjTablesTests.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package mvm.rya.indexing.external.tupleSet;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Set;
-
-import org.junit.Test;
-
-import com.google.common.collect.Sets;
-
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjMetadata;
-import mvm.rya.indexing.external.tupleSet.PcjTables.ShiftVarOrderFactory;
-import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
-
-/**
- * Tests the classes and methods of {@link PcjTables}.
- */
-public class PcjTablesTests {
-
-    @Test
-    public void variableOrder_hashCode() {
-        assertEquals(new VariableOrder("a", "b", "C").hashCode(), new 
VariableOrder("a", "b", "C").hashCode());
-    }
-
-    @Test
-    public void variableOrder_equals() {
-        assertEquals(new VariableOrder("a", "b", "C"), new VariableOrder("a", 
"b", "C"));
-    }
-
-    @Test
-    public void variableOrder_fromString() {
-        assertEquals(new VariableOrder("a", "b", "c"), new 
VariableOrder("a;b;c"));
-    }
-
-    @Test
-    public void variableORder_toString() {
-        assertEquals("a;b;c", new VariableOrder("a", "b", "c").toString());
-    }
-
-    @Test
-    public void pcjMetadata_hashCode() {
-        PcjMetadata meta1 = new PcjMetadata("A SPARQL string.", 5, 
Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", 
"f")));
-        PcjMetadata meta2 = new PcjMetadata("A SPARQL string.", 5, 
Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", 
"f")));
-        assertEquals(meta1.hashCode(), meta2.hashCode());
-    }
-
-    @Test
-    public void pcjMetadata_equals() {
-        PcjMetadata meta1 = new PcjMetadata("A SPARQL string.", 5, 
Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", 
"f")));
-        PcjMetadata meta2 = new PcjMetadata("A SPARQL string.", 5, 
Sets.newHashSet(new VariableOrder("a", "b", "c"), new VariableOrder("d", "e", 
"f")));
-        assertEquals(meta1, meta2);
-    }
-
-    @Test
-    public void shiftVarOrdersFactory() {
-        Set<VariableOrder> expected = Sets.newHashSet(
-                new VariableOrder("a;b;c"),
-                new VariableOrder("b;c;a"),
-                new VariableOrder("c;a;b"));
-
-        Set<VariableOrder> varOrders = new 
ShiftVarOrderFactory().makeVarOrders(new VariableOrder("a;b;c"));
-        assertEquals(expected, varOrders);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java
----------------------------------------------------------------------
diff --git 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java
 
b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java
deleted file mode 100644
index ccd27ac..0000000
--- 
a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/VisibilityBindingSetStringConverterTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package mvm.rya.indexing.external.tupleSet;
-
-import static 
mvm.rya.indexing.external.tupleSet.VisibilityBindingSetStringConverter.VISIBILITY_DELIM;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.impl.MapBindingSet;
-
-import mvm.rya.indexing.accumulo.VisibilityBindingSet;
-import 
mvm.rya.indexing.external.tupleSet.BindingSetConverter.BindingSetConversionException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.VariableOrder;
-
-/**
- * Tests the methods of {@link BindingSetStringConverter}.
- */
-public class VisibilityBindingSetStringConverterTest {
-    @Test
-    public void toString_URIs() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        originalBindingSet.addBinding("z", new URIImpl("http://c";));
-
-        final VisibilityBindingSet visiSet = new 
VisibilityBindingSet(originalBindingSet, "A&B&C");
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final VisibilityBindingSetStringConverter converter = new 
VisibilityBindingSetStringConverter();
-        final String bindingSetString = converter.convert(visiSet, varOrder);
-
-        // Ensure it converted to the expected result.l
-        final String expected =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI"; +
-                VISIBILITY_DELIM + "A&B&C";
-
-        assertEquals(expected, bindingSetString);
-    }
-
-    @Test
-    public void fromString() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI"; +
-                VISIBILITY_DELIM + "A&B";
-
-        // Convert it to a BindingSet
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final VisibilityBindingSetStringConverter converter = new 
VisibilityBindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("z", new URIImpl("http://c";));
-        expected.addBinding("y", new URIImpl("http://b";));
-        expected.addBinding("x", new URIImpl("http://a";));
-        final VisibilityBindingSet visiSet = new 
VisibilityBindingSet(expected, "A&B");
-
-        assertEquals(visiSet, bindingSet);
-    }
-
-    @Test
-    public void toString_URIs_noVisi() throws BindingSetConversionException {
-        // Setup the binding set that will be converted.
-        final MapBindingSet originalBindingSet = new MapBindingSet();
-        originalBindingSet.addBinding("x", new URIImpl("http://a";));
-        originalBindingSet.addBinding("y", new URIImpl("http://b";));
-        originalBindingSet.addBinding("z", new URIImpl("http://c";));
-
-        final VisibilityBindingSet visiSet = new 
VisibilityBindingSet(originalBindingSet);
-
-        // Convert it to a String.
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final VisibilityBindingSetStringConverter converter = new 
VisibilityBindingSetStringConverter();
-        final String bindingSetString = converter.convert(visiSet, varOrder);
-
-        // Ensure it converted to the expected result.l
-        final String expected =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        assertEquals(expected, bindingSetString);
-    }
-
-    @Test
-    public void fromString_noVisi() throws BindingSetConversionException {
-        // Setup the String that will be converted.
-        final String bindingSetString =
-                "http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::"; +
-                "http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI";;
-
-        // Convert it to a BindingSet
-        final VariableOrder varOrder = new VariableOrder("y", "z", "x");
-        final VisibilityBindingSetStringConverter converter = new 
VisibilityBindingSetStringConverter();
-        final BindingSet bindingSet = converter.convert(bindingSetString, 
varOrder);
-
-        // Ensure it converted to the expected result.
-        final MapBindingSet expected = new MapBindingSet();
-        expected.addBinding("z", new URIImpl("http://c";));
-        expected.addBinding("y", new URIImpl("http://b";));
-        expected.addBinding("x", new URIImpl("http://a";));
-        final VisibilityBindingSet visiSet = new 
VisibilityBindingSet(expected);
-
-        assertEquals(visiSet, bindingSet);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/indexingExample/src/main/java/RyaDirectExample.java
----------------------------------------------------------------------
diff --git a/extras/indexingExample/src/main/java/RyaDirectExample.java 
b/extras/indexingExample/src/main/java/RyaDirectExample.java
index eec98d6..c4faa69 100644
--- a/extras/indexingExample/src/main/java/RyaDirectExample.java
+++ b/extras/indexingExample/src/main/java/RyaDirectExample.java
@@ -29,6 +29,9 @@ import 
org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.commons.lang.Validate;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.log4j.Logger;
+import org.apache.rya.indexing.pcj.storage.PcjException;
+import org.apache.rya.indexing.pcj.storage.accumulo.PcjTables;
+import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory;
 import org.openrdf.model.URI;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.LiteralImpl;
@@ -57,9 +60,6 @@ import mvm.rya.api.RdfCloudTripleStoreConfiguration;
 import mvm.rya.api.persist.RyaDAOException;
 import mvm.rya.indexing.accumulo.ConfigUtils;
 import mvm.rya.indexing.accumulo.geo.GeoConstants;
-import mvm.rya.indexing.external.tupleSet.PcjTables;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjException;
-import mvm.rya.indexing.external.tupleSet.PcjTables.PcjVarOrderFactory;
 import mvm.rya.rdftriplestore.inference.InferenceEngineException;
 import mvm.rya.sail.config.RyaSailFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/pom.xml
----------------------------------------------------------------------
diff --git a/extras/pom.xml b/extras/pom.xml
index d3d51a1..57476a7 100644
--- a/extras/pom.xml
+++ b/extras/pom.xml
@@ -38,6 +38,7 @@ under the License.
         <module>tinkerpop.rya</module>
         <module>rya.console</module>
         <module>indexing</module>
+        <module>rya.indexing.pcj</module>
         <module>indexingExample</module>
         <module>vagrantExample</module>
         <module>rya.pcj.fluo</module>

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/rya.indexing.pcj/.gitignore
----------------------------------------------------------------------
diff --git a/extras/rya.indexing.pcj/.gitignore 
b/extras/rya.indexing.pcj/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/extras/rya.indexing.pcj/.gitignore
@@ -0,0 +1 @@
+/target/

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/rya.indexing.pcj/pom.xml
----------------------------------------------------------------------
diff --git a/extras/rya.indexing.pcj/pom.xml b/extras/rya.indexing.pcj/pom.xml
new file mode 100644
index 0000000..ee5ae07
--- /dev/null
+++ b/extras/rya.indexing.pcj/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project 
+    xmlns="http://maven.apache.org/POM/4.0.0"; 
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    
+    <parent>
+        <groupId>org.apache.rya</groupId>
+        <artifactId>rya.extras</artifactId>
+        <version>3.2.10-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>rya.indexing.pcj</artifactId>
+    
+    <name>Apache Rya PCJ Core</name>
+    <description>
+        A project that contains all of the interfaces and common models
+        that are used to implement the Precomputed Join Secondary Index.
+    </description>
+    
+    <dependencies>
+        <!-- Pull in all of the Rya models. -->
+        <dependency>
+            <groupId>org.apache.rya</groupId>
+            <artifactId>rya.api</artifactId>
+        </dependency>
+        
+        <!-- Accumulo support dependencies. -->
+        <dependency>
+            <groupId>org.apache.accumulo</groupId>
+            <artifactId>accumulo-core</artifactId>
+        </dependency>
+        
+        <!-- Fluo support dependencies. -->
+        <dependency>
+            <groupId>io.fluo</groupId>
+            <artifactId>fluo-api</artifactId>
+        </dependency>
+        
+        <!-- Misc dependencies -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.0</version>
+        </dependency>
+        
+        <!-- Testing dependencies. -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.accumulo</groupId>
+            <artifactId>accumulo-minicluster</artifactId>
+            <version>${accumulo.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.rya</groupId>
+            <artifactId>rya.sail</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjException.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjException.java
 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjException.java
new file mode 100644
index 0000000..c9ce72e
--- /dev/null
+++ 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjException.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rya.indexing.pcj.storage;
+
+import org.apache.rya.indexing.pcj.storage.accumulo.PcjTables;
+
+/**
+ * Indicates one of the {@link PcjTables} functions has failed to perform its 
task.
+ */
+public class PcjException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructs an instance of {@link PcjException}.
+     *
+     * @param message - Describes why the exception is being thrown.
+     */
+    public PcjException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs an instance of {@link PcjException}.
+     *
+     * @param message - Describes why the exception is being thrown.
+     * @param cause - The exception that caused this one to be thrown.
+     */
+    public PcjException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjMetadata.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjMetadata.java
 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjMetadata.java
new file mode 100644
index 0000000..90ca83c
--- /dev/null
+++ 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PcjMetadata.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rya.indexing.pcj.storage;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Objects;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Metadata that is stored in a PCJ table about the results that are stored 
within it.
+ */
+@Immutable
+@ParametersAreNonnullByDefault
+public final class PcjMetadata {
+    private final String sparql;
+    private final long cardinality;
+    private final ImmutableSet<VariableOrder> varOrders;
+
+    /**
+     * Constructs an instance of {@link PcjMetadata}.
+     *
+     * @param sparql - The SPARQL query this PCJ solves. (not null)
+     * @param cardinality  - The number of results the PCJ has. (>= 0)
+     * @param varOrders - Strings that describe each of the variable orders
+     *   the results are stored in. (not null)
+     */
+    public PcjMetadata(final String sparql, final long cardinality, final 
Collection<VariableOrder> varOrders) {
+        this.sparql = checkNotNull(sparql);
+        this.varOrders = ImmutableSet.copyOf( checkNotNull(varOrders) );
+
+        checkArgument(cardinality >= 0, "Cardinality of a PCJ must be >= 0. 
Was: " + cardinality);
+        this.cardinality = cardinality;
+    }
+
+    /**
+     * @return The SPARQL query this PCJ solves.
+     */
+    public String getSparql() {
+        return sparql;
+    }
+
+    /**
+     * @return The number of results the PCJ has.
+     */
+    public long getCardinality() {
+        return cardinality;
+    }
+
+    /**
+     * @return Strings that describe each of the variable orders the results 
are stored in.
+     */
+    public ImmutableSet<VariableOrder> getVarOrders() {
+        return varOrders;
+    }
+
+    /**
+     * Updates the cardinality of a {@link PcjMetadata} by a {@code delta}.
+     *
+     * @param metadata - The PCJ metadata to update. (not null)
+     * @param delta - How much the cardinality of the PCJ has changed.
+     * @return A new instance of {@link PcjMetadata} with the new cardinality.
+     */
+    public static PcjMetadata updateCardinality(final PcjMetadata metadata, 
final long delta) {
+        checkNotNull(metadata);
+        return new PcjMetadata(metadata.sparql, metadata.cardinality + delta, 
metadata.varOrders);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(sparql, cardinality, varOrders);
+    }
+
+    @Override
+    public boolean equals(final Object o) {
+        if(this == o) {
+            return true;
+        } else if(o instanceof PcjMetadata) {
+            final PcjMetadata metadata = (PcjMetadata) o;
+            return new EqualsBuilder()
+                    .append(sparql, metadata.sparql)
+                    .append(cardinality, metadata.cardinality)
+                    .append(varOrders, metadata.varOrders)
+                    .build();
+        }
+        return false;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/14073a23/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PrecomputedJoinStorage.java
----------------------------------------------------------------------
diff --git 
a/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PrecomputedJoinStorage.java
 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PrecomputedJoinStorage.java
new file mode 100644
index 0000000..fb49b30
--- /dev/null
+++ 
b/extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/PrecomputedJoinStorage.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.rya.indexing.pcj.storage;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+
+import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+import org.apache.rya.indexing.pcj.storage.accumulo.VisibilityBindingSet;
+
+/**
+ * Functions that create and maintain the PCJ tables that are used by Rya.
+ */
+@ParametersAreNonnullByDefault
+public interface PrecomputedJoinStorage {
+
+    /**
+     * Get a list of all Precomputed Join indices that are being maintained.
+     *
+     * @return The lkist of managed Precomputed Join indices.
+     */
+    public List<String> listPcjs() throws PCJStorageException;
+
+    /**
+     * Create a new Precomputed Join index.
+     *
+     * @param sparql - A SPAQL query that defines how the index will be 
updated. (not null)
+     * @param varOrders - The variable orders the results within the table 
will be written to. (not null)
+     * @return A unique identifier for the index.
+     */
+    public String createPcj(final String sparql, final Set<VariableOrder> 
varOrders) throws PCJStorageException;
+
+    /**
+     * Get metadata about the Precomputed Join index.
+     *
+     * @param pcjId - Identifies the index the metadata will be read from. 
(not null)
+     * @return The metadata stored within the index.
+     */
+    public PcjMetadata getPcjMetadata(final String pcjId) throws 
PCJStorageException;
+
+    /**
+     * Adds new join results to a Precomputed Join index.
+     *
+     * @param pcjId - Identifies the index the results will be added to. (not 
null)
+     * @param results - The results that will be added to the index. (not null)
+     * @throws PCJStorageException Indicates the results could not be added to 
the index.
+     */
+    public void addResults(final String pcjId, final 
Collection<VisibilityBindingSet> results) throws PCJStorageException;
+
+    /**
+     * Clears all values from a Precomputed Join index. The index will remain,
+     * but all of its values will be removed.
+     *
+     * @param pcjId - Identifies the index to purge. (not null)
+     * @throws PCJStorageException Indicates the values from the index could 
not be purged.
+     */
+    public void purge(final String pcjId) throws PCJStorageException;
+
+    /**
+     * Completely removes a Precomputed Join index from the system.
+     *
+     * @param pcjId - Identifies the index to drop. (not null)
+     * @throws PCJStorageException Indicates the index could not be dropped.
+     */
+    public void dropPcj(final String pcjId) throws PCJStorageException;
+
+
+    /**
+     * Releases and resources that are being used by the storage.
+     *
+     * @throws PCJStorageException Indicates the resources could not be 
released.
+     */
+    public void close() throws PCJStorageException;
+
+    /**
+     * An operation of {@link PrecomputedJoinStorage} failed.
+     */
+    public static class PCJStorageException extends PcjException {
+        private static final long serialVersionUID = 1L;
+
+        /**
+         * Constructs a new exception with the specified detail message. The 
cause
+         * is not initialized, and may subsequently be initialized by a call to
+         * {@link Throwable#initCause(java.lang.Throwable)}.
+         *
+         * @param message - The detail message. The detail message is saved for
+         *   later retrieval by the {@link Throwable#getMessage()} method.
+         */
+        public PCJStorageException(final String message) {
+            super(message);
+        }
+
+        /**
+         * Constructs a new exception with the specified detail message and 
cause.
+         * </p>
+         * Note that the detail message associated with cause is not 
automatically
+         * incorporated in this exception's detail message.
+         *
+         * @param message - The detail message (which is saved for later 
retrieval
+         *   by the {@link Throwable#getMessage()} method).
+         * @param cause - The cause (which is saved for later retrieval by the
+         *   {@link Throwable#getCause()} method). (A null value is permitted, 
and
+         *   indicates that the cause is nonexistent or unknown.)
+         */
+        public PCJStorageException(final String message, final Throwable 
cause) {
+            super(message, cause);
+        }
+    }
+}
\ No newline at end of file

Reply via email to