You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by pu...@apache.org on 2016/06/16 14:04:20 UTC
[09/10] incubator-rya git commit: Fixed AccumuloIndex Security Bug
Fixed AccumuloIndex Security Bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/a28472b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/a28472b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/a28472b3
Branch: refs/heads/develop
Commit: a28472b3a5db7f3943cc1b56b70d7a670a0f9cbb
Parents: 96dd55e
Author: Caleb Meier <me...@gmail.com>
Authored: Thu Jun 2 13:42:27 2016 -0400
Committer: Caleb Meier <me...@gmail.com>
Committed: Thu Jun 2 13:42:27 2016 -0400
----------------------------------------------------------------------
extras/indexing/pom.xml | 294 ++++++++++---------
.../external/tupleSet/AccumuloIndexSet.java | 57 ++--
.../rya/indexing/pcj/matching/PCJOptimizer.java | 2 +-
.../external/AccumuloPcjIntegrationTest.java | 35 ++-
.../AccumuloIndexSetColumnVisibilityTest.java | 218 ++++++++++++++
.../external/tupleSet/AccumuloIndexSetTest.java | 102 +++----
6 files changed, 475 insertions(+), 233 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/extras/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/extras/indexing/pom.xml b/extras/indexing/pom.xml
index d819199..ad38855 100644
--- a/extras/indexing/pom.xml
+++ b/extras/indexing/pom.xml
@@ -1,160 +1,162 @@
<?xml version='1.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
+<!-- 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. -->
- http://www.apache.org/licenses/LICENSE-2.0
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.extras</artifactId>
+ <version>3.2.10-SNAPSHOT</version>
+ </parent>
-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.
--->
+ <artifactId>rya.indexing</artifactId>
+ <name>Apache Rya Secondary Indexing</name>
-<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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.rya</groupId>
- <artifactId>rya.extras</artifactId>
- <version>3.2.10-SNAPSHOT</version>
- </parent>
+ <dependencies>
- <artifactId>rya.indexing</artifactId>
- <name>Apache Rya Secondary Indexing</name>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-minicluster</artifactId>
+ <version>${accumulo.version}</version>
+ <scope>test</scope>
+ </dependency>
- <dependencies>
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>rya.sail</artifactId>
- <exclusions>
- <exclusion>
- <artifactId>hsqldb</artifactId>
- <groupId>hsqldb</groupId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.sail</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>hsqldb</artifactId>
+ <groupId>hsqldb</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>accumulo.rya</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>mongodb.rya</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.prospector</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>accumulo.rya</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>mongodb.rya</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>rya.prospector</artifactId>
- </dependency>
+ <!-- Free Text Indexing -->
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers</artifactId>
+ </dependency>
- <!-- Free Text Indexing -->
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers</artifactId>
- </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </dependency>
+ <!-- Geo Indexing -->
+ <dependency>
+ <groupId>org.locationtech.geomesa</groupId>
+ <artifactId>geomesa-accumulo-datastore</artifactId>
+ </dependency>
- <!-- Geo Indexing -->
- <dependency>
- <groupId>org.locationtech.geomesa</groupId>
- <artifactId>geomesa-accumulo-datastore</artifactId>
- </dependency>
+ <!-- PCJ Indexing -->
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.indexing.pcj</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.rya</groupId>
+ <artifactId>rya.pcj.fluo.api</artifactId>
+ </dependency>
- <!-- PCJ Indexing -->
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>rya.indexing.pcj</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.rya</groupId>
- <artifactId>rya.pcj.fluo.api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <!-- RDF data Files -->
- <exclude>**/*.ttl</exclude>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- RDF data Files -->
+ <exclude>**/*.ttl</exclude>
- <!-- Services Files -->
- <exclude>**/resources/META-INF/services/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <executions>
- <execution>
- <configuration>
- <shadedArtifactAttached>true</shadedArtifactAttached>
- <shadedClassifierName>map-reduce</shadedClassifierName>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- </transformers>
- </configuration>
- </execution>
- <execution>
- <id>accumulo-server</id>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <shadedArtifactAttached>true</shadedArtifactAttached>
- <shadedClassifierName>accumulo-server</shadedClassifierName>
- <artifactSet>
- <excludes>
- <exclude>org.locationtech.geomesa:*</exclude>
- <exclude>scala:*</exclude>
- <exclude>org.apache.accumulo:*</exclude>
- <exclude>org.apache.thrift:*</exclude>
- <exclude>org.apache.hadoop:*</exclude>
- <exclude>org.apache.zookeeper:*</exclude>
- </excludes>
- </artifactSet>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <!-- Services Files -->
+ <exclude>**/resources/META-INF/services/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <configuration>
+ <shadedArtifactAttached>true</shadedArtifactAttached>
+ <shadedClassifierName>map-reduce</shadedClassifierName>
+ <transformers>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+ </transformers>
+ </configuration>
+ </execution>
+ <execution>
+ <id>accumulo-server</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedArtifactAttached>true</shadedArtifactAttached>
+ <shadedClassifierName>accumulo-server</shadedClassifierName>
+ <artifactSet>
+ <excludes>
+ <exclude>org.locationtech.geomesa:*</exclude>
+ <exclude>scala:*</exclude>
+ <exclude>org.apache.accumulo:*</exclude>
+ <exclude>org.apache.thrift:*</exclude>
+ <exclude>org.apache.hadoop:*</exclude>
+ <exclude>org.apache.zookeeper:*</exclude>
+ </excludes>
+ </artifactSet>
+ <transformers>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSet.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSet.java b/extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSet.java
index 2ca8f4a..a45ba2b 100644
--- a/extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSet.java
+++ b/extras/indexing/src/main/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSet.java
@@ -35,7 +35,9 @@ import mvm.rya.accumulo.pcj.iterators.BindingSetHashJoinIterator.HashJoinType;
import mvm.rya.accumulo.pcj.iterators.IteratorCombiner;
import mvm.rya.accumulo.pcj.iterators.PCJKeyToCrossProductBindingSetIterator;
import mvm.rya.accumulo.pcj.iterators.PCJKeyToJoinBindingSetIterator;
+import mvm.rya.api.RdfCloudTripleStoreConfiguration;
import mvm.rya.api.utils.IteratorWrapper;
+import mvm.rya.indexing.accumulo.ConfigUtils;
import mvm.rya.indexing.pcj.matching.PCJOptimizerUtilities;
import mvm.rya.rdftriplestore.evaluation.ExternalBatchingIterator;
@@ -43,11 +45,11 @@ import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.rya.indexing.pcj.storage.PcjException;
import org.apache.rya.indexing.pcj.storage.PcjMetadata;
@@ -105,12 +107,14 @@ import com.google.common.collect.Sets;
public class AccumuloIndexSet extends ExternalTupleSet implements
ExternalBatchingIterator {
- private final Connector accCon; // connector to Accumulo table where results
+ private Connector accCon; // connector to Accumulo table where results
// are stored
- private final String tablename; // name of Accumulo table
+ private String tablename; // name of Accumulo table
private List<String> varOrder = null; // orders in which results are written
// to table
private PcjTables pcj = new PcjTables();
+ private Authorizations auths;
+
@Override
public Map<String, Set<String>> getSupportedVariableOrders() {
@@ -135,15 +139,16 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
* @throws MalformedQueryException
* @throws SailException
* @throws QueryEvaluationException
- * @throws MutationsRejectedException
* @throws TableNotFoundException
+ * @throws AccumuloSecurityException
+ * @throws AccumuloException
*/
- public AccumuloIndexSet(String sparql, Connector accCon,
+ public AccumuloIndexSet(String sparql, Configuration conf,
String tablename) throws MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException,
- TableNotFoundException {
+ QueryEvaluationException, TableNotFoundException, AccumuloException, AccumuloSecurityException {
this.tablename = tablename;
- this.accCon = accCon;
+ this.accCon = ConfigUtils.getConnector(conf);
+ this.auths = getAuthorizations(conf);
SPARQLParser sp = new SPARQLParser();
ParsedTupleQuery pq = (ParsedTupleQuery) sp.parseQuery(sparql, null);
TupleExpr te = pq.getTupleExpr();
@@ -181,13 +186,15 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
* @throws MalformedQueryException
* @throws SailException
* @throws QueryEvaluationException
- * @throws MutationsRejectedException
* @throws TableNotFoundException
+ * @throws AccumuloSecurityException
+ * @throws AccumuloException
*/
- public AccumuloIndexSet(Connector accCon, String tablename)
+ public AccumuloIndexSet(Configuration conf, String tablename)
throws MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException,
- TableNotFoundException {
+ QueryEvaluationException, TableNotFoundException, AccumuloException, AccumuloSecurityException {
+ this.accCon = ConfigUtils.getConnector(conf);
+ this.auths = getAuthorizations(conf);
PcjMetadata meta = null;
try {
meta = pcj.getPcjMetadata(accCon, tablename);
@@ -196,7 +203,6 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
}
this.tablename = tablename;
- this.accCon = accCon;
SPARQLParser sp = new SPARQLParser();
ParsedTupleQuery pq = (ParsedTupleQuery) sp.parseQuery(
meta.getSparql(), null);
@@ -212,6 +218,15 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
this.setSupportedVariableOrderMap(varOrder);
}
+
+ private Authorizations getAuthorizations(Configuration conf) {
+ final String authString = conf.get(RdfCloudTripleStoreConfiguration.CONF_QUERY_AUTH, "");
+ if (authString.isEmpty()) {
+ return new Authorizations();
+ }
+ return new Authorizations(authString.split(","));
+ }
+
/**
* returns size of table for query planning
*/
@@ -392,9 +407,7 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
// BindingSets
if ((useColumnScan || crossProductBs.size() > 0)
&& bindingSetHashMap.size() == 0) {
- // TODO doesn't use user specified Authorizations
- Scanner scanner = accCon.createScanner(tablename,
- new Authorizations());
+ Scanner scanner = accCon.createScanner(tablename, auths);
// cross product with no cross product constraints here
scanner.setRange(crossProductRange);
scanner.fetchColumnFamily(new Text(localityGroupOrder));
@@ -411,9 +424,7 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
List<CloseableIteration<BindingSet, QueryEvaluationException>> iteratorList = new ArrayList<>();
// create cross product iterator
- // TODO doesn't use user specified Authorizations
- Scanner scanner1 = accCon.createScanner(tablename,
- new Authorizations());
+ Scanner scanner1 = accCon.createScanner(tablename, auths);
scanner1.setRange(crossProductRange);
scanner1.fetchColumnFamily(new Text(localityGroupOrder));
iteratorList.add(new PCJKeyToCrossProductBindingSetIterator(
@@ -421,9 +432,7 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
getTableVarMap()));
// create hash join iterator
- // TODO doesn't use user specified Authorizations
- BatchScanner scanner2 = accCon.createBatchScanner(tablename,
- new Authorizations(), 10);
+ BatchScanner scanner2 = accCon.createBatchScanner(tablename, auths, 10);
scanner2.setRanges(hashJoinRanges);
PCJKeyToJoinBindingSetIterator iterator = new PCJKeyToJoinBindingSetIterator(
scanner2, getTableVarMap(), maxPrefixLen);
@@ -435,9 +444,7 @@ public class AccumuloIndexSet extends ExternalTupleSet implements
} else {
// only hash join BindingSets exist
- // TODO doesn't use user specified auths
- BatchScanner scanner = accCon.createBatchScanner(tablename,
- new Authorizations(), 10);
+ BatchScanner scanner = accCon.createBatchScanner(tablename, auths, 10);
// only need to create hash join iterator
scanner.setRanges(hashJoinRanges);
PCJKeyToJoinBindingSetIterator iterator = new PCJKeyToJoinBindingSetIterator(
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/extras/indexing/src/main/java/mvm/rya/indexing/pcj/matching/PCJOptimizer.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/main/java/mvm/rya/indexing/pcj/matching/PCJOptimizer.java b/extras/indexing/src/main/java/mvm/rya/indexing/pcj/matching/PCJOptimizer.java
index a4ec2a0..a481c96 100644
--- a/extras/indexing/src/main/java/mvm/rya/indexing/pcj/matching/PCJOptimizer.java
+++ b/extras/indexing/src/main/java/mvm/rya/indexing/pcj/matching/PCJOptimizer.java
@@ -339,7 +339,7 @@ public class PCJOptimizer implements QueryOptimizer, Configurable {
} else {
for (final String table : indexTables.keySet()) {
final String indexSparqlString = indexTables.get(table);
- index.add(new AccumuloIndexSet(indexSparqlString, c, table));
+ index.add(new AccumuloIndexSet(indexSparqlString, conf, table));
}
}
return index;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/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 a8136a0..393ae74 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
@@ -24,8 +24,11 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
+import mvm.rya.accumulo.AccumuloRdfConfiguration;
+import mvm.rya.api.RdfCloudTripleStoreConfiguration;
import mvm.rya.api.persist.RyaDAOException;
import mvm.rya.indexing.IndexPlanValidator.IndexPlanValidator;
+import mvm.rya.indexing.accumulo.ConfigUtils;
import mvm.rya.indexing.external.tupleSet.AccumuloIndexSet;
import mvm.rya.indexing.external.tupleSet.ExternalTupleSet;
import mvm.rya.indexing.pcj.matching.PCJOptimizer;
@@ -38,8 +41,7 @@ import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.TableOperations;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.hadoop.conf.Configuration;
import org.apache.rya.indexing.pcj.storage.PcjException;
import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory;
import org.junit.After;
@@ -75,6 +77,7 @@ public class AccumuloPcjIntegrationTest {
private SailRepositoryConnection conn, pcjConn;
private SailRepository repo, pcjRepo;
private Connector accCon;
+ private Configuration conf = getConf();
private final String prefix = "table_";
private final String tablename = "table_INDEX_";
private URI obj, obj2, subclass, subclass2, talksTo;
@@ -109,7 +112,7 @@ public class AccumuloPcjIntegrationTest {
conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2"));
conn.add(sub2, talksTo, obj2);
- accCon = new MockInstance("instance").getConnector("root", new PasswordToken(""));
+ accCon = ConfigUtils.getConnector(conf);
}
@@ -1079,14 +1082,14 @@ public class AccumuloPcjIntegrationTest {
indexSparqlString, new String[] { "dog", "pig", "duck" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais1 = new AccumuloIndexSet(accCon,
+ final AccumuloIndexSet ais1 = new AccumuloIndexSet(conf,
tablename + 1);
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 2,
indexSparqlString2, new String[] { "o", "f", "e", "c", "l" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais2 = new AccumuloIndexSet(accCon,
+ final AccumuloIndexSet ais2 = new AccumuloIndexSet(conf,
tablename + 2);
final Set<String> ais1Set1 = Sets.newHashSet();
@@ -1253,13 +1256,13 @@ public class AccumuloPcjIntegrationTest {
indexSparqlString, new String[] { "dog", "pig", "duck" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais1 = new AccumuloIndexSet(accCon, tablename+1);
+ final AccumuloIndexSet ais1 = new AccumuloIndexSet(conf, tablename+1);
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename+2,
indexSparqlString2, new String[] { "o", "f", "e", "c", "l" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais2 = new AccumuloIndexSet(accCon, tablename+2);
+ final AccumuloIndexSet ais2 = new AccumuloIndexSet(conf, tablename+2);
final List<ExternalTupleSet> index = new ArrayList<>();
index.add(ais1);
@@ -1347,20 +1350,20 @@ public class AccumuloPcjIntegrationTest {
indexSparqlString, new String[] { "dog", "pig", "duck" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais1 = new AccumuloIndexSet(accCon, tablename+1);
+ final AccumuloIndexSet ais1 = new AccumuloIndexSet(conf, tablename+1);
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename+2,
indexSparqlString2, new String[] { "o", "f", "e", "c", "l" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais2 = new AccumuloIndexSet(accCon, tablename+2);
+ final AccumuloIndexSet ais2 = new AccumuloIndexSet(conf, tablename+2);
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename+3,
indexSparqlString3,
new String[] { "wolf", "sheep", "chicken" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais3 = new AccumuloIndexSet(accCon, tablename+3);
+ final AccumuloIndexSet ais3 = new AccumuloIndexSet(conf, tablename+3);
final List<ExternalTupleSet> index = new ArrayList<>();
index.add(ais1);
@@ -1423,6 +1426,18 @@ public class AccumuloPcjIntegrationTest {
throws QueryResultHandlerException {
}
+
+ }
+
+ private static Configuration getConf() {
+ final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
+ conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, true);
+ conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya_");
+ conf.set(ConfigUtils.CLOUDBASE_USER, "root");
+ conf.set(ConfigUtils.CLOUDBASE_PASSWORD, "");
+ conf.set(ConfigUtils.CLOUDBASE_INSTANCE, "instance");
+ conf.set(ConfigUtils.CLOUDBASE_AUTHS, "");
+ return conf;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetColumnVisibilityTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetColumnVisibilityTest.java b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetColumnVisibilityTest.java
new file mode 100644
index 0000000..8951e30
--- /dev/null
+++ b/extras/indexing/src/test/java/mvm/rya/indexing/external/tupleSet/AccumuloIndexSetColumnVisibilityTest.java
@@ -0,0 +1,218 @@
+package mvm.rya.indexing.external.tupleSet;
+
+import info.aduna.iteration.CloseableIteration;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import mvm.rya.accumulo.AccumuloRdfConfiguration;
+import mvm.rya.api.RdfCloudTripleStoreConfiguration;
+import mvm.rya.indexing.accumulo.ConfigUtils;
+import mvm.rya.indexing.external.accumulo.AccumuloPcjStorage;
+
+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.TableNotFoundException;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.log4j.Logger;
+import org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage.PCJStorageException;
+import org.apache.rya.indexing.pcj.storage.accumulo.VariableOrder;
+import org.apache.rya.indexing.pcj.storage.accumulo.VisibilityBindingSet;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openrdf.model.impl.NumericLiteralImpl;
+import org.openrdf.model.impl.URIImpl;
+import org.openrdf.model.vocabulary.XMLSchema;
+import org.openrdf.query.Binding;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.algebra.evaluation.QueryBindingSet;
+import org.openrdf.query.impl.BindingImpl;
+import org.openrdf.repository.RepositoryException;
+
+import com.google.common.collect.Sets;
+import com.google.common.io.Files;
+
+public class AccumuloIndexSetColumnVisibilityTest {
+
+ private static final Logger log = Logger
+ .getLogger(AccumuloIndexSetColumnVisibilityTest.class);
+
+ private static Connector accCon;
+ private static String pcjTableName;
+ private static AccumuloPcjStorage storage;
+ private static Configuration conf;
+ private static final String sparql = "SELECT ?name ?age " + "{"
+ + "?name <http://hasAge> ?age ."
+ + "?name <http://playsSport> \"Soccer\" " + "}";
+ private static QueryBindingSet pcjBs1, pcjBs2, pcjBs3;
+ private static MiniAccumuloCluster accumulo;
+ private static String instance;
+ private static String zooKeepers;
+
+ @BeforeClass
+ public static void init() throws AccumuloException,
+ AccumuloSecurityException, PCJStorageException, IOException,
+ InterruptedException, TableNotFoundException {
+ accumulo = startMiniAccumulo();
+ accumulo.getZooKeepers();
+ instance = accumulo.getInstanceName();
+ zooKeepers = accumulo.getZooKeepers();
+ conf = getConf();
+ accCon.securityOperations().changeUserAuthorizations("root", new Authorizations("U","USA"));
+ storage = new AccumuloPcjStorage(accCon, "rya_");
+ Set<VariableOrder> varOrders = new HashSet<>();
+ varOrders.add(new VariableOrder("age;name"));
+ varOrders.add(new VariableOrder("name;age"));
+ pcjTableName = storage.createPcj(sparql, varOrders);
+
+ Binding exBinding1 = new BindingImpl("age", new NumericLiteralImpl(14,
+ XMLSchema.INTEGER));
+ Binding exBinding2 = new BindingImpl("name",
+ new URIImpl("http://Alice"));
+ Binding exBinding3 = new BindingImpl("age", new NumericLiteralImpl(16,
+ XMLSchema.INTEGER));
+ Binding exBinding4 = new BindingImpl("name", new URIImpl("http://Bob"));
+ Binding exBinding5 = new BindingImpl("age", new NumericLiteralImpl(34,
+ XMLSchema.INTEGER));
+ Binding exBinding6 = new BindingImpl("name", new URIImpl("http://Joe"));
+
+ pcjBs1 = new QueryBindingSet();
+ pcjBs1.addBinding(exBinding1);
+ pcjBs1.addBinding(exBinding2);
+
+ pcjBs2 = new QueryBindingSet();
+ pcjBs2.addBinding(exBinding3);
+ pcjBs2.addBinding(exBinding4);
+
+ pcjBs3 = new QueryBindingSet();
+ pcjBs3.addBinding(exBinding5);
+ pcjBs3.addBinding(exBinding6);
+
+ Set<BindingSet> bindingSets = new HashSet<>();
+ bindingSets.add(pcjBs1);
+ bindingSets.add(pcjBs2);
+ bindingSets.add(pcjBs3);
+
+ Set<VisibilityBindingSet> visBs = new HashSet<>();
+ for (BindingSet bs : bindingSets) {
+ visBs.add(new VisibilityBindingSet(bs, "U|USA"));
+ }
+
+ storage.addResults(pcjTableName, visBs);
+
+// Scanner scanner = accCon.createScanner(pcjTableName, new Authorizations("U","USA"));
+// for(Entry<Key, Value> entry : scanner) {
+// System.out.println(entry.getKey());
+// }
+
+
+ }
+
+ @AfterClass
+ public static void close() throws RepositoryException, PCJStorageException {
+ storage.close();
+
+ 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);
+ }
+ }
+ }
+
+ @Test
+ public void variableInstantiationTest() throws Exception {
+
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
+ final QueryBindingSet bs = new QueryBindingSet();
+ bs.addBinding("name", new URIImpl("http://Alice"));
+
+ final QueryBindingSet bs2 = new QueryBindingSet();
+ bs2.addBinding("name", new URIImpl("http://Bob"));
+
+ final Set<BindingSet> bSets = Sets.<BindingSet> newHashSet(bs, bs2);
+
+ final CloseableIteration<BindingSet, QueryEvaluationException> results = ais
+ .evaluate(bSets);
+
+ Set<BindingSet> expected = new HashSet<>();
+ expected.add(pcjBs1);
+ expected.add(pcjBs2);
+ final Set<BindingSet> fetchedResults = new HashSet<>();
+ while (results.hasNext()) {
+ final BindingSet next = results.next();
+ fetchedResults.add(next);
+ }
+
+ Assert.assertEquals(expected, fetchedResults);
+ }
+
+ @Test
+ public void accumuloIndexSetTestAttemptJoinAccrossTypes() throws Exception {
+ // Load some Triples into Rya.
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
+
+ final QueryBindingSet bs1 = new QueryBindingSet();
+ bs1.addBinding("age", new NumericLiteralImpl(16, XMLSchema.INTEGER));
+ final QueryBindingSet bs2 = new QueryBindingSet();
+ bs2.addBinding("age", new NumericLiteralImpl(14, XMLSchema.INTEGER));
+
+ final Set<BindingSet> bSets = Sets.<BindingSet> newHashSet(bs1, bs2);
+
+ final CloseableIteration<BindingSet, QueryEvaluationException> results = ais
+ .evaluate(bSets);
+ Set<BindingSet> expected = new HashSet<>();
+ expected.add(pcjBs1);
+ expected.add(pcjBs2);
+ final Set<BindingSet> fetchedResults = new HashSet<>();
+ while (results.hasNext()) {
+ final BindingSet next = results.next();
+ fetchedResults.add(next);
+ }
+
+ Assert.assertEquals(expected, fetchedResults);
+ }
+
+ 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());
+ accCon = instance.getConnector("root", new PasswordToken("password"));
+
+ return accumulo;
+ }
+
+ private static Configuration getConf() {
+ final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
+ conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya_");
+ conf.set(ConfigUtils.CLOUDBASE_USER, "root");
+ conf.set(ConfigUtils.CLOUDBASE_PASSWORD, "password");
+ conf.set(ConfigUtils.CLOUDBASE_INSTANCE, instance);
+ conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, zooKeepers);
+ conf.set(RdfCloudTripleStoreConfiguration.CONF_QUERY_AUTH, "U,USA");
+ return conf;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/a28472b3/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 f7f249f..9aac2d6 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
@@ -40,12 +40,8 @@ import mvm.rya.sail.config.RyaSailFactory;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.TableOperations;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.conf.Configuration;
import org.apache.rya.indexing.pcj.storage.PcjException;
import org.apache.rya.indexing.pcj.storage.accumulo.PcjTableNameFactory;
@@ -111,16 +107,17 @@ public class AccumuloIndexSetTest {
/**
* TODO doc
*
- * @throws MutationsRejectedException
* @throws QueryEvaluationException
* @throws SailException
* @throws MalformedQueryException
+ * @throws AccumuloSecurityException
+ * @throws AccumuloException
*/
@Test
public void accumuloIndexSetTestWithEmptyBindingSet()
throws RepositoryException, PcjException, TableNotFoundException,
RyaTypeResolverException, MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException {
+ QueryEvaluationException, AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -145,6 +142,12 @@ public class AccumuloIndexSetTest {
ryaConn.add(triple);
}
+// Scanner scanner = accumuloConn.createScanner(prefix + "spo",
+// new Authorizations("U","USA"));
+// for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : scanner) {
+// System.out.println(e.getKey());
+// }
+
// Create a PCJ table will include those triples in its results.
final String sparql = "SELECT ?name ?age " + "{"
+ "FILTER(?age < 30) ." + "?name <http://hasAge> ?age."
@@ -157,8 +160,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
- pcjTableName);
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
final CloseableIteration<BindingSet, QueryEvaluationException> results = ais
.evaluate(new QueryBindingSet());
@@ -187,16 +189,17 @@ public class AccumuloIndexSetTest {
/**
* TODO doc
*
- * @throws MutationsRejectedException
* @throws QueryEvaluationException
* @throws SailException
* @throws MalformedQueryException
+ * @throws AccumuloSecurityException
+ * @throws AccumuloException
*/
@Test
public void accumuloIndexSetTestWithBindingSet()
throws RepositoryException, PcjException, TableNotFoundException,
RyaTypeResolverException, MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException {
+ QueryEvaluationException, AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -234,8 +237,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
- pcjTableName);
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
final QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("name", new URIImpl("http://Alice"));
@@ -253,7 +255,7 @@ public class AccumuloIndexSetTest {
public void accumuloIndexSetTestWithTwoBindingSets()
throws RepositoryException, PcjException, TableNotFoundException,
RyaTypeResolverException, MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException {
+ QueryEvaluationException, AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -291,8 +293,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
- pcjTableName);
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
final QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("birthDate", new LiteralImpl("1983-03-17", new URIImpl(
@@ -324,7 +325,6 @@ public class AccumuloIndexSetTest {
final Set<BindingSet> fetchedResults = new HashSet<>();
while (results.hasNext()) {
final BindingSet next = results.next();
- System.out.println(next);
fetchedResults.add(next);
}
@@ -336,7 +336,7 @@ public class AccumuloIndexSetTest {
public void accumuloIndexSetTestWithNoBindingSet()
throws RepositoryException, PcjException, TableNotFoundException,
RyaTypeResolverException, MalformedQueryException, SailException,
- QueryEvaluationException, MutationsRejectedException {
+ QueryEvaluationException, AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -374,7 +374,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
final CloseableIteration<BindingSet, QueryEvaluationException> results = ais
@@ -388,7 +388,7 @@ public class AccumuloIndexSetTest {
public void multipleCommonVarBindingTest() throws RepositoryException,
PcjException, TableNotFoundException, RyaTypeResolverException,
MalformedQueryException, SailException, QueryEvaluationException,
- MutationsRejectedException {
+ AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -426,7 +426,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
final QueryBindingSet bs = new QueryBindingSet();
@@ -465,7 +465,7 @@ public class AccumuloIndexSetTest {
public void manyCommonVarBindingTest() throws RepositoryException,
PcjException, TableNotFoundException, RyaTypeResolverException,
MalformedQueryException, SailException, QueryEvaluationException,
- MutationsRejectedException {
+ AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -503,7 +503,7 @@ public class AccumuloIndexSetTest {
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
final QueryBindingSet bs = new QueryBindingSet();
@@ -556,7 +556,6 @@ public class AccumuloIndexSetTest {
final Set<BindingSet> fetchedResults = new HashSet<>();
while (results.hasNext()) {
final BindingSet next = results.next();
- System.out.println(next);
fetchedResults.add(next);
}
@@ -568,7 +567,7 @@ public class AccumuloIndexSetTest {
public void variableNormalizationTest() throws RepositoryException,
PcjException, TableNotFoundException, RyaTypeResolverException,
MalformedQueryException, SailException, QueryEvaluationException,
- MutationsRejectedException {
+ AccumuloException, AccumuloSecurityException {
// Load some Triples into Rya.
final Set<Statement> triples = new HashSet<>();
triples.add(new StatementImpl(new URIImpl("http://Alice"), new URIImpl(
@@ -616,7 +615,7 @@ public class AccumuloIndexSetTest {
final Map<String, String> map = new HashMap<>();
map.put("x", "name");
map.put("y", "age");
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
ais.setProjectionExpr((Projection) pq.getTupleExpr());
ais.setTableVarMap(map);
@@ -653,7 +652,6 @@ public class AccumuloIndexSetTest {
final Set<BindingSet> fetchedResults = new HashSet<>();
while (results.hasNext()) {
final BindingSet next = results.next();
- System.out.println(next);
fetchedResults.add(next);
}
@@ -707,7 +705,7 @@ public class AccumuloIndexSetTest {
final ParsedQuery pq1 = p.parseQuery(sparql, null);
final ParsedQuery pq2 = p.parseQuery(sparql2, null);
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
@@ -766,7 +764,7 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
final QueryBindingSet bs1 = new QueryBindingSet();
bs1.addBinding("age", new LiteralImpl("16"));
@@ -821,7 +819,7 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
final QueryBindingSet bs1 = new QueryBindingSet();
bs1.addBinding("name", new URIImpl("http://Alice"));
@@ -895,7 +893,7 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age" },
Optional.<PcjVarOrderFactory> absent());
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs1 = new QueryBindingSet();
bs1.addBinding("name", new URIImpl("http://Alice"));
@@ -996,7 +994,7 @@ public class AccumuloIndexSetTest {
final ParsedQuery pq1 = p.parseQuery(sparql, null);
final ParsedQuery pq2 = p.parseQuery(sparql2, null);
- final AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn,
+ final AccumuloIndexSet ais = new AccumuloIndexSet(conf,
pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
@@ -1080,7 +1078,7 @@ public class AccumuloIndexSetTest {
ParsedQuery pq1 = p.parseQuery(sparql, null);
ParsedQuery pq2 = p.parseQuery(sparql2, null);
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
.get(0));
@@ -1163,7 +1161,7 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age", "sport",
"weight" }, Optional.<PcjVarOrderFactory> absent());
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("name", new URIImpl("http://Bob"));
@@ -1246,7 +1244,7 @@ public class AccumuloIndexSetTest {
ParsedQuery pq1 = p.parseQuery(sparql, null);
ParsedQuery pq2 = p.parseQuery(sparql2, null);
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
.get(0));
@@ -1336,7 +1334,7 @@ public class AccumuloIndexSetTest {
ParsedQuery pq1 = p.parseQuery(sparql, null);
ParsedQuery pq2 = p.parseQuery(sparql2, null);
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
.get(0));
@@ -1408,17 +1406,17 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age", "sport",
"weight" }, Optional.<PcjVarOrderFactory> absent());
- Scanner scanner = accumuloConn.createScanner(pcjTableName,
- new Authorizations());
- for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : scanner) {
- System.out.println(e.getKey().getRow());
- }
+// Scanner scanner = accumuloConn.createScanner(pcjTableName,
+// new Authorizations());
+// for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : scanner) {
+// System.out.println(e.getKey().getRow());
+// }
SPARQLParser p = new SPARQLParser();
ParsedQuery pq1 = p.parseQuery(sparql, null);
ParsedQuery pq2 = p.parseQuery(sparql2, null);
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
ais.setProjectionExpr((Projection) QueryVariableNormalizer
.getNormalizedIndex(pq2.getTupleExpr(), pq1.getTupleExpr())
.get(0));
@@ -1505,7 +1503,7 @@ public class AccumuloIndexSetTest {
// {
// System.out.println(e.getKey().getRow());
// }
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("location", new URIImpl("http://Virginia"));
@@ -1612,7 +1610,7 @@ public class AccumuloIndexSetTest {
// {
// System.out.println(e.getKey().getRow());
// }
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("name", new URIImpl("http://Joe"));
@@ -1705,7 +1703,7 @@ public class AccumuloIndexSetTest {
// {
// System.out.println(e.getKey().getRow());
// }
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("name", new URIImpl("http://Joe"));
@@ -1826,6 +1824,7 @@ public class AccumuloIndexSetTest {
+ "OPTIONAL{?name <http://playsSport> ?sport} . "
+ "?name <http://hasWeight> ?weight " + "}";
+
String pcjTableName = new PcjTableNameFactory().makeTableName(prefix,
"testPcj");
@@ -1833,13 +1832,14 @@ public class AccumuloIndexSetTest {
PcjIntegrationTestingUtil.createAndPopulatePcj(ryaConn, accumuloConn,
pcjTableName, sparql, new String[] { "name", "age", "sport",
"weight" }, Optional.<PcjVarOrderFactory> absent());
- // Scanner scanner = accumuloConn.createScanner(pcjTableName,
- // new Authorizations());
- // for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : scanner)
- // {
- // System.out.println(e.getKey().getRow());
- // }
- AccumuloIndexSet ais = new AccumuloIndexSet(accumuloConn, pcjTableName);
+
+// scanner = accumuloConn.createScanner(pcjTableName,
+// new Authorizations("U"));
+// for (Map.Entry<Key, org.apache.accumulo.core.data.Value> e : scanner) {
+// System.out.println(e.getKey());
+// }
+
+ AccumuloIndexSet ais = new AccumuloIndexSet(conf, pcjTableName);
QueryBindingSet bs = new QueryBindingSet();
bs.addBinding("name", new URIImpl("http://Alice"));