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 2018/04/23 13:21:30 UTC
[25/48] incubator-rya git commit: RYA-405 Migration of OpenRDF Sesame
libraries to RDF4J
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/entity/StarQueryTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/entity/StarQueryTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/entity/StarQueryTest.java
index 993c758..54b5dcd 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/entity/StarQueryTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/entity/StarQueryTest.java
@@ -28,26 +28,26 @@ import org.apache.rya.api.domain.RyaType;
import org.apache.rya.api.resolver.RdfToRyaConversions;
import org.apache.rya.api.resolver.RyaContext;
import org.apache.rya.api.resolver.RyaTypeResolverException;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.query.MalformedQueryException;
+import org.eclipse.rdf4j.query.algebra.StatementPattern;
+import org.eclipse.rdf4j.query.algebra.TupleExpr;
+import org.eclipse.rdf4j.query.algebra.Var;
+import org.eclipse.rdf4j.query.algebra.evaluation.QueryBindingSet;
+import org.eclipse.rdf4j.query.algebra.helpers.StatementPatternCollector;
+import org.eclipse.rdf4j.query.parser.ParsedQuery;
+import org.eclipse.rdf4j.query.parser.sparql.SPARQLParser;
import org.junit.Assert;
import org.junit.Test;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.query.MalformedQueryException;
-import org.openrdf.query.algebra.StatementPattern;
-import org.openrdf.query.algebra.TupleExpr;
-import org.openrdf.query.algebra.Var;
-import org.openrdf.query.algebra.evaluation.QueryBindingSet;
-import org.openrdf.query.algebra.helpers.StatementPatternCollector;
-import org.openrdf.query.parser.ParsedQuery;
-import org.openrdf.query.parser.sparql.SPARQLParser;
import com.google.common.collect.Sets;
import com.google.common.primitives.Bytes;
public class StarQueryTest {
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
@Test
@@ -115,8 +115,8 @@ public class StarQueryTest {
QueryBindingSet bs1 = new QueryBindingSet();
QueryBindingSet bs2 = new QueryBindingSet();
- Value v1 = vf.createURI("uri:hank");
- Value v2 = vf.createURI("uri:bob");
+ Value v1 = vf.createIRI("uri:hank");
+ Value v2 = vf.createIRI("uri:bob");
bs1.addBinding("X",v1);
bs2.addBinding("X", v1);
@@ -176,8 +176,8 @@ public class StarQueryTest {
QueryBindingSet bs1 = new QueryBindingSet();
QueryBindingSet bs2 = new QueryBindingSet();
- Value v1 = vf.createURI("uri:hank");
- Value v2 = vf.createURI("uri:bob");
+ Value v1 = vf.createIRI("uri:hank");
+ Value v2 = vf.createIRI("uri:bob");
bs1.addBinding("X",v1);
bs2.addBinding("X", v1);
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
index 531085d..62396e4 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/freetext/AccumuloFreeTextIndexerTest.java
@@ -1,32 +1,3 @@
-package org.apache.rya.indexing.accumulo.freetext;
-
-import java.util.HashSet;
-import java.util.List;
-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.Scanner;
-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.data.Key;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.model.vocabulary.RDFS;
-
-import com.google.common.collect.Sets;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -35,9 +6,9 @@ import com.google.common.collect.Sets;
* 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
@@ -45,10 +16,22 @@ import com.google.common.collect.Sets;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.rya.indexing.accumulo.freetext;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
-
-import info.aduna.iteration.CloseableIteration;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.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.accumulo.AccumuloRdfConfiguration;
import org.apache.rya.api.domain.RyaStatement;
import org.apache.rya.api.domain.RyaType;
@@ -57,6 +40,19 @@ import org.apache.rya.api.resolver.RdfToRyaConversions;
import org.apache.rya.api.resolver.RyaToRdfConversions;
import org.apache.rya.indexing.StatementConstraints;
import org.apache.rya.indexing.accumulo.ConfigUtils;
+import org.eclipse.rdf4j.common.iteration.CloseableIteration;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Statement;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
public class AccumuloFreeTextIndexerTest {
private static final StatementConstraints EMPTY_CONSTRAINTS = new StatementConstraints();
@@ -96,13 +92,13 @@ public class AccumuloFreeTextIndexerTest {
f.setMultiTableBatchWriter(ConfigUtils.createMultitableBatchWriter(conf));
f.init();
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
- URI subject = new URIImpl("foo:subj");
- URI predicate = RDFS.LABEL;
+ IRI subject = vf.createIRI("foo:subj");
+ IRI predicate = RDFS.LABEL;
Value object = vf.createLiteral("this is a new hat");
- URI context = new URIImpl("foo:context");
+ IRI context = vf.createIRI("foo:context");
Statement statement = vf.createStatement(subject, predicate, object, context);
f.storeStatement(RdfToRyaConversions.convertStatement(statement));
@@ -139,22 +135,22 @@ public class AccumuloFreeTextIndexerTest {
f.setMultiTableBatchWriter(ConfigUtils.createMultitableBatchWriter(conf));
f.init();
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
- URI subject1 = new URIImpl("foo:subj");
- URI predicate1 = RDFS.LABEL;
+ IRI subject1 = vf.createIRI("foo:subj");
+ IRI predicate1 = RDFS.LABEL;
Value object1 = vf.createLiteral("this is a new hat");
- URI context1 = new URIImpl("foo:context");
+ IRI context1 = vf.createIRI("foo:context");
Statement statement1 = vf.createStatement(subject1, predicate1, object1, context1);
f.storeStatement(RdfToRyaConversions.convertStatement(statement1));
- URI subject2 = new URIImpl("foo:subject");
- URI predicate2 = RDFS.LABEL;
+ IRI subject2 = vf.createIRI("foo:subject");
+ IRI predicate2 = RDFS.LABEL;
Value object2 = vf.createLiteral("Do you like my new hat?");
- URI context2 = new URIImpl("foo:context");
+ IRI context2 = vf.createIRI("foo:context");
Statement statement2 = vf.createStatement(subject2, predicate2, object2, context2);
f.storeStatement(RdfToRyaConversions.convertStatement(statement2));
@@ -231,11 +227,11 @@ public class AccumuloFreeTextIndexerTest {
f.setMultiTableBatchWriter(ConfigUtils.createMultitableBatchWriter(conf));
f.init();
- ValueFactory vf = new ValueFactoryImpl();
- URI subject = new URIImpl("foo:subj");
- URI predicate = new URIImpl(RDFS.COMMENT.toString());
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ IRI subject = vf.createIRI("foo:subj");
+ IRI predicate = vf.createIRI(RDFS.COMMENT.toString());
Value object = vf.createLiteral("this is a new hat");
- URI context = new URIImpl("foo:context");
+ IRI context = vf.createIRI("foo:context");
Statement statement = vf.createStatement(subject, predicate, object, context);
f.storeStatement(RdfToRyaConversions.convertStatement(statement));
@@ -244,7 +240,7 @@ public class AccumuloFreeTextIndexerTest {
Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryText("hat", EMPTY_CONSTRAINTS)));
Assert.assertEquals(Sets.newHashSet(statement), getSet(f.queryText("hat", new StatementConstraints().setContext(context))));
Assert.assertEquals(Sets.newHashSet(),
- getSet(f.queryText("hat", new StatementConstraints().setContext(vf.createURI("foo:context2")))));
+ getSet(f.queryText("hat", new StatementConstraints().setContext(vf.createIRI("foo:context2")))));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
index bba1b0d..c8f482d 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexerTest.java
@@ -1,5 +1,3 @@
-package org.apache.rya.indexing.accumulo.temporal;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +16,7 @@ package org.apache.rya.indexing.accumulo.temporal;
* specific language governing permissions and limitations
* under the License.
*/
-
+package org.apache.rya.indexing.accumulo.temporal;
import static org.apache.rya.api.resolver.RdfToRyaConversions.convertStatement;
import static org.junit.Assert.assertEquals;
@@ -62,24 +60,22 @@ import org.apache.rya.indexing.TemporalInstant;
import org.apache.rya.indexing.TemporalInstantRfc3339;
import org.apache.rya.indexing.TemporalInterval;
import org.apache.rya.indexing.accumulo.ConfigUtils;
+import org.eclipse.rdf4j.common.iteration.CloseableIteration;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Statement;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.eclipse.rdf4j.query.QueryEvaluationException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.StatementImpl;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.model.vocabulary.RDFS;
-import org.openrdf.query.QueryEvaluationException;
import com.google.common.collect.Lists;
-import info.aduna.iteration.CloseableIteration;
-
/**
* JUnit tests for TemporalIndexer and it's implementation AccumuloTemporalIndexer
*
@@ -174,7 +170,7 @@ public final class AccumuloTemporalIndexerTest {
seriesTs = new TemporalInstant[SERIES_OF_SECONDS];
for (int i = 0; i <= 40; i++)
seriesTs[i] = makeInstant(i);
- };
+ }
/**
* Make an uniform instant with given seconds.
@@ -185,23 +181,23 @@ public final class AccumuloTemporalIndexerTest {
static {
// Setup the statements only once. Each test will store some of these in there own index table.
- ValueFactory vf = new ValueFactoryImpl();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
// tiB03_E20 read as: time interval that Begins 3 seconds, ends at 20 seconds,
// Each time element the same, except seconds. year, month, .... minute are the same for each statement below.
- spo_B00_E01 = new StatementImpl(vf.createURI("foo:event0"), pred1_atTime, vf.createLiteral(tvB00_E01.toString()));
- spo_B02_E29 = new StatementImpl(vf.createURI("foo:event2"), pred1_atTime, vf.createLiteral(tvB02_E29.toString()));
- spo_B02_E30 = new StatementImpl(vf.createURI("foo:event2"), pred1_atTime, vf.createLiteral(tvB02_E30.toString()));
- spo_B02_E31 = new StatementImpl(vf.createURI("foo:event3"), pred1_atTime, vf.createLiteral(tvB02_E31.toString()));
- spo_B02_E40 = new StatementImpl(vf.createURI("foo:event4"), pred1_atTime, vf.createLiteral(tvB02_E40.toString()));
- spo_B03_E20 = new StatementImpl(vf.createURI("foo:event5"), pred1_atTime, vf.createLiteral(tvB03_E20.toString()));
- spo_B29_E30 = new StatementImpl(vf.createURI("foo:event1"), pred1_atTime, vf.createLiteral(tvB29_E30.toString()));
- spo_B30_E32 = new StatementImpl(vf.createURI("foo:event1"), pred1_atTime, vf.createLiteral(tvB30_E32.toString()));
- spo_B02 = new StatementImpl(vf.createURI("foo:event6"), pred1_atTime, vf.createLiteral(tsB02.getAsReadable()));
+ spo_B00_E01 = vf.createStatement(vf.createIRI("foo:event0"), pred1_atTime, vf.createLiteral(tvB00_E01.toString()));
+ spo_B02_E29 = vf.createStatement(vf.createIRI("foo:event2"), pred1_atTime, vf.createLiteral(tvB02_E29.toString()));
+ spo_B02_E30 = vf.createStatement(vf.createIRI("foo:event2"), pred1_atTime, vf.createLiteral(tvB02_E30.toString()));
+ spo_B02_E31 = vf.createStatement(vf.createIRI("foo:event3"), pred1_atTime, vf.createLiteral(tvB02_E31.toString()));
+ spo_B02_E40 = vf.createStatement(vf.createIRI("foo:event4"), pred1_atTime, vf.createLiteral(tvB02_E40.toString()));
+ spo_B03_E20 = vf.createStatement(vf.createIRI("foo:event5"), pred1_atTime, vf.createLiteral(tvB03_E20.toString()));
+ spo_B29_E30 = vf.createStatement(vf.createIRI("foo:event1"), pred1_atTime, vf.createLiteral(tvB29_E30.toString()));
+ spo_B30_E32 = vf.createStatement(vf.createIRI("foo:event1"), pred1_atTime, vf.createLiteral(tvB30_E32.toString()));
+ spo_B02 = vf.createStatement(vf.createIRI("foo:event6"), pred1_atTime, vf.createLiteral(tsB02.getAsReadable()));
// Create statements about time instants 0 - 40 seconds
for (int i = 0; i < seriesTs.length; i++) {
- seriesSpo[i] = new StatementImpl(vf.createURI("foo:event0" + i), pred1_atTime, vf.createLiteral(seriesTs[i].getAsReadable()));
+ seriesSpo[i] = vf.createStatement(vf.createIRI("foo:event0" + i), pred1_atTime, vf.createLiteral(seriesTs[i].getAsReadable()));
}
}
@@ -273,7 +269,7 @@ public final class AccumuloTemporalIndexerTest {
}
/**
- * Test method for {@link AccumuloTemporalIndexer#storeStatement(convertStatement(org.openrdf.model.Statement)}
+ * Test method for {@link AccumuloTemporalIndexer#storeStatement(convertStatement(org.eclipse.rdf4j.model.Statement)}
*
* @throws NoSuchAlgorithmException
*/
@@ -282,21 +278,21 @@ public final class AccumuloTemporalIndexerTest {
// count rows expected to store:
int rowsStoredExpected = 0;
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
- URI pred2_circa = vf.createURI(URI_PROPERTY_CIRCA);
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
+ IRI pred2_circa = vf.createIRI(URI_PROPERTY_CIRCA);
// Should not be stored because they are not in the predicate list
String validDateStringWithThirteens = "1313-12-13T13:13:13Z";
- tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj1"), RDFS.LABEL, vf.createLiteral(validDateStringWithThirteens))));
+ tIndexer.storeStatement(convertStatement(vf.createStatement(vf.createIRI("foo:subj1"), RDFS.LABEL, vf.createLiteral(validDateStringWithThirteens))));
// Test: Should not store an improper date, and log a warning (log warning not tested).
final String invalidDateString = "ThisIsAnInvalidDate";
// // Silently logs a warning for bad dates. Old: Set true when we catch the error:
// boolean catchErrorThrownCorrectly = false;
// try {
- tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj2"), pred1_atTime, vf.createLiteral(invalidDateString))));
+ tIndexer.storeStatement(convertStatement(vf.createStatement(vf.createIRI("foo:subj2"), pred1_atTime, vf.createLiteral(invalidDateString))));
// } catch (IllegalArgumentException e) {
// catchErrorThrownCorrectly = true;
// Assert.assertTrue(
@@ -314,15 +310,15 @@ public final class AccumuloTemporalIndexerTest {
// These should be stored because they are in the predicate list.
// BUT they will get converted to the same exact datetime in UTC.
- Statement s3 = new StatementImpl(vf.createURI("foo:subj3"), pred1_atTime, vf.createLiteral(testDate2014InBRST));
- Statement s4 = new StatementImpl(vf.createURI("foo:subj4"), pred2_circa, vf.createLiteral(testDate2016InET));
+ Statement s3 = vf.createStatement(vf.createIRI("foo:subj3"), pred1_atTime, vf.createLiteral(testDate2014InBRST));
+ Statement s4 = vf.createStatement(vf.createIRI("foo:subj4"), pred2_circa, vf.createLiteral(testDate2016InET));
tIndexer.storeStatement(convertStatement(s3));
rowsStoredExpected++;
tIndexer.storeStatement(convertStatement(s4));
rowsStoredExpected++;
// This should not be stored because the object is not a literal
- tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj5"), pred1_atTime, vf.createURI("in:valid"))));
+ tIndexer.storeStatement(convertStatement(vf.createStatement(vf.createIRI("foo:subj5"), pred1_atTime, vf.createIRI("in:valid"))));
tIndexer.flush();
@@ -336,18 +332,18 @@ public final class AccumuloTemporalIndexerTest {
// count rows expected to store:
int rowsStoredExpected = 0;
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
- URI pred2_circa = vf.createURI(URI_PROPERTY_CIRCA);
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
+ IRI pred2_circa = vf.createIRI(URI_PROPERTY_CIRCA);
final String testDate2014InBRST = "2014-12-31T23:59:59-02:00";
final String testDate2016InET = "2016-12-31T20:59:59-05:00";
// These should be stored because they are in the predicate list.
// BUT they will get converted to the same exact datetime in UTC.
- Statement s1 = new StatementImpl(vf.createURI("foo:subj3"), pred1_atTime, vf.createLiteral(testDate2014InBRST));
- Statement s2 = new StatementImpl(vf.createURI("foo:subj4"), pred2_circa, vf.createLiteral(testDate2016InET));
+ Statement s1 = vf.createStatement(vf.createIRI("foo:subj3"), pred1_atTime, vf.createLiteral(testDate2014InBRST));
+ Statement s2 = vf.createStatement(vf.createIRI("foo:subj4"), pred2_circa, vf.createLiteral(testDate2016InET));
tIndexer.storeStatement(convertStatement(s1));
rowsStoredExpected++;
tIndexer.storeStatement(convertStatement(s2));
@@ -367,12 +363,12 @@ public final class AccumuloTemporalIndexerTest {
@Test
public void testStoreStatementWithInterestingLiterals() throws Exception {
- ValueFactory vf = new ValueFactoryImpl();
+ ValueFactory vf = SimpleValueFactory.getInstance();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
- tIndexer.storeStatement(convertStatement(new StatementImpl(
- vf.createURI("foo:subj2"),
+ tIndexer.storeStatement(convertStatement(vf.createStatement(
+ vf.createIRI("foo:subj2"),
pred1_atTime,
vf.createLiteral("A number of organizations located, gathered, or classed together. [Derived from Concise Oxford English Dictionary, 11th Edition, 2008]"))));
@@ -381,7 +377,7 @@ public final class AccumuloTemporalIndexerTest {
}
/**
- * Test method for {@link AccumuloTemporalIndexer#storeStatement(convertStatement(org.openrdf.model.Statement)}
+ * Test method for {@link AccumuloTemporalIndexer#storeStatement(convertStatement(org.eclipse.rdf4j.model.Statement)}
*
* @throws NoSuchAlgorithmException
*/
@@ -390,16 +386,16 @@ public final class AccumuloTemporalIndexerTest {
// count rows expected to store:
int rowsStoredExpected = 0;
- ValueFactory vf = new ValueFactoryImpl();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
// Test: Should not store an improper date interval, and log a warning (log warning not tested).
final String invalidDateIntervalString="[bad,interval]";
// Silently logs a warning for bad dates.
- tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj1"), pred1_atTime, vf.createLiteral(invalidDateIntervalString))));
+ tIndexer.storeStatement(convertStatement(vf.createStatement(vf.createIRI("foo:subj1"), pred1_atTime, vf.createLiteral(invalidDateIntervalString))));
final String validDateIntervalString="[2016-12-31T20:59:59-05:00,2016-12-31T21:00:00-05:00]";
- tIndexer.storeStatement(convertStatement(new StatementImpl(vf.createURI("foo:subj2"), pred1_atTime, vf.createLiteral(validDateIntervalString))));
+ tIndexer.storeStatement(convertStatement(vf.createStatement(vf.createIRI("foo:subj2"), pred1_atTime, vf.createLiteral(validDateIntervalString))));
rowsStoredExpected++;
tIndexer.flush();
@@ -410,9 +406,9 @@ public final class AccumuloTemporalIndexerTest {
@Test
public void testStoreStatementsSameTime() throws IOException, NoSuchAlgorithmException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException {
- ValueFactory vf = new ValueFactoryImpl();
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
- URI pred2_circa = vf.createURI(URI_PROPERTY_CIRCA);
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
+ IRI pred2_circa = vf.createIRI(URI_PROPERTY_CIRCA);
// These are the same datetime instant but from different time
// zones.
@@ -424,9 +420,9 @@ public final class AccumuloTemporalIndexerTest {
// These all should be stored because they are in the predicate list.
// BUT they will get converted to the same exact datetime in UTC.
// So we have to make the key distinct! Good luck indexer!
- Statement s1 = new StatementImpl(vf.createURI("foo:subj1"), pred2_circa, vf.createLiteral(ZONETestDateInET));
- Statement s2 = new StatementImpl(vf.createURI("foo:subj2"), pred1_atTime, vf.createLiteral(ZONETestDateInZulu));
- Statement s3 = new StatementImpl(vf.createURI("foo:subj3"), pred1_atTime, vf.createLiteral(ZONETestDateInBRST));
+ Statement s1 = vf.createStatement(vf.createIRI("foo:subj1"), pred2_circa, vf.createLiteral(ZONETestDateInET));
+ Statement s2 = vf.createStatement(vf.createIRI("foo:subj2"), pred1_atTime, vf.createLiteral(ZONETestDateInZulu));
+ Statement s3 = vf.createStatement(vf.createIRI("foo:subj3"), pred1_atTime, vf.createLiteral(ZONETestDateInBRST));
int rowsStoredExpected = 0;
tIndexer.storeStatement(convertStatement(s1));
rowsStoredExpected++;
@@ -894,28 +890,28 @@ public final class AccumuloTemporalIndexerTest {
for (int s = 0; s <= searchForSeconds + expectedResultCount; s++) { // <== logic here
tIndexer.storeStatement(convertStatement(seriesSpo[s]));
}
- ValueFactory vf = new ValueFactoryImpl();
- URI pred3_CIRCA_ = vf.createURI(URI_PROPERTY_CIRCA); // this one to ignore.
- URI pred2_eventTime = vf.createURI(URI_PROPERTY_EVENT_TIME);
- URI pred1_atTime = vf.createURI(URI_PROPERTY_AT_TIME);
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ IRI pred3_CIRCA_ = vf.createIRI(URI_PROPERTY_CIRCA); // this one to ignore.
+ IRI pred2_eventTime = vf.createIRI(URI_PROPERTY_EVENT_TIME);
+ IRI pred1_atTime = vf.createIRI(URI_PROPERTY_AT_TIME);
// add the predicate = EventTime ; Store in an array for verification.
Statement[] SeriesTs_EventTime = new Statement[expectedResultCount+1];
for (int s = 0; s <= searchForSeconds + expectedResultCount; s++) { // <== logic here
- Statement statement = new StatementImpl(vf.createURI("foo:EventTimeSubj0" + s), pred2_eventTime, vf.createLiteral(seriesTs[s].getAsReadable()));
+ Statement statement = vf.createStatement(vf.createIRI("foo:EventTimeSubj0" + s), pred2_eventTime, vf.createLiteral(seriesTs[s].getAsReadable()));
tIndexer.storeStatement(convertStatement(statement));
if (s>searchForSeconds)
SeriesTs_EventTime[s - searchForSeconds -1 ] = statement;
}
// add the predicate = CIRCA ; to be ignored because it is not in the constraints.
for (int s = 0; s <= searchForSeconds + expectedResultCount; s++) { // <== logic here
- Statement statement = new StatementImpl(vf.createURI("foo:CircaEventSubj0" + s), pred3_CIRCA_, vf.createLiteral(seriesTs[s].getAsReadable()));
+ Statement statement = vf.createStatement(vf.createIRI("foo:CircaEventSubj0" + s), pred3_CIRCA_, vf.createLiteral(seriesTs[s].getAsReadable()));
tIndexer.storeStatement(convertStatement(statement));
}
tIndexer.flush();
CloseableIteration<Statement, QueryEvaluationException> iter;
StatementConstraints constraints = new StatementConstraints();
- constraints.setPredicates(new HashSet<URI>(Arrays.asList( pred2_eventTime, pred1_atTime )));
+ constraints.setPredicates(new HashSet<IRI>(Arrays.asList( pred2_eventTime, pred1_atTime )));
iter = tIndexer.queryInstantAfterInstant(seriesTs[searchForSeconds], constraints); // EMPTY_CONSTRAINTS);//
int count_AtTime = 0;
@@ -953,7 +949,7 @@ public final class AccumuloTemporalIndexerTest {
*/
@Test
public void testGetIndexablePredicates() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, IOException {
- Set<URI> p = tIndexer.getIndexablePredicates();
+ Set<IRI> p = tIndexer.getIndexablePredicates();
Assert.assertEquals("number of predicates returned:", 3, p.size());
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/entity/query/EntityQueryNodeIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/query/EntityQueryNodeIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/query/EntityQueryNodeIT.java
index 66b79ef..c5b7fa1 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/query/EntityQueryNodeIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/query/EntityQueryNodeIT.java
@@ -22,10 +22,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.apache.rya.api.domain.RyaURI;
+import org.apache.rya.api.domain.VarNameUtils;
import org.apache.rya.api.resolver.RdfToRyaConversions;
import org.apache.rya.indexing.entity.model.Entity;
import org.apache.rya.indexing.entity.model.Property;
@@ -33,22 +35,21 @@ import org.apache.rya.indexing.entity.model.Type;
import org.apache.rya.indexing.entity.storage.EntityStorage;
import org.apache.rya.indexing.entity.storage.mongo.MongoEntityStorage;
import org.apache.rya.mongodb.MongoITBase;
+import org.eclipse.rdf4j.common.iteration.CloseableIteration;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.query.BindingSet;
+import org.eclipse.rdf4j.query.MalformedQueryException;
+import org.eclipse.rdf4j.query.QueryEvaluationException;
+import org.eclipse.rdf4j.query.algebra.StatementPattern;
+import org.eclipse.rdf4j.query.algebra.helpers.StatementPatternCollector;
+import org.eclipse.rdf4j.query.impl.MapBindingSet;
+import org.eclipse.rdf4j.query.parser.sparql.SPARQLParser;
import org.junit.Test;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.model.vocabulary.RDF;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.MalformedQueryException;
-import org.openrdf.query.QueryEvaluationException;
-import org.openrdf.query.algebra.StatementPattern;
-import org.openrdf.query.algebra.helpers.StatementPatternCollector;
-import org.openrdf.query.impl.MapBindingSet;
-import org.openrdf.query.parser.sparql.SPARQLParser;
import com.google.common.collect.ImmutableSet;
-import info.aduna.iteration.CloseableIteration;
-
/**
* Integration tests the methods of {@link EntityQueryNode}.
*/
@@ -152,12 +153,12 @@ public class EntityQueryNodeIT extends MongoITBase {
@Test
public void evaluate_constantSubject() throws Exception {
final EntityStorage storage = new MongoEntityStorage(super.getMongoClient(), "testDB");
- final ValueFactory vf = ValueFactoryImpl.getInstance();
+ final ValueFactory vf = SimpleValueFactory.getInstance();
final RyaURI subject = new RyaURI("urn:SSN:111-11-1111");
final Entity entity = Entity.builder()
.setSubject(subject)
.setExplicitType(PERSON_TYPE.getId())
- .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20))))
+ .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(BigInteger.valueOf(20)))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue"))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob"))))
.build();
@@ -187,12 +188,12 @@ public class EntityQueryNodeIT extends MongoITBase {
@Test
public void evaluate_variableSubject() throws Exception {
final EntityStorage storage = new MongoEntityStorage(super.getMongoClient(), "testDB");
- final ValueFactory vf = ValueFactoryImpl.getInstance();
+ final ValueFactory vf = SimpleValueFactory.getInstance();
RyaURI subject = new RyaURI("urn:SSN:111-11-1111");
final Entity bob = Entity.builder()
.setSubject(subject)
.setExplicitType(PERSON_TYPE.getId())
- .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20))))
+ .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(BigInteger.valueOf(20)))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue"))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob"))))
.build();
@@ -201,7 +202,7 @@ public class EntityQueryNodeIT extends MongoITBase {
final Entity fred = Entity.builder()
.setSubject(subject)
.setExplicitType(PERSON_TYPE.getId())
- .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(25))))
+ .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(BigInteger.valueOf(25)))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("brown"))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Fred"))))
.build();
@@ -240,18 +241,18 @@ public class EntityQueryNodeIT extends MongoITBase {
@Test
public void evaluate_constantObject() throws Exception {
final EntityStorage storage = new MongoEntityStorage(super.getMongoClient(), "testDB");
- final ValueFactory vf = ValueFactoryImpl.getInstance();
+ final ValueFactory vf = SimpleValueFactory.getInstance();
final RyaURI subject = new RyaURI("urn:SSN:111-11-1111");
final Entity entity = Entity.builder()
.setSubject(subject)
.setExplicitType(PERSON_TYPE.getId())
- .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20))))
+ .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(BigInteger.valueOf(20)))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue"))))
.setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob"))))
.build();
storage.create(entity);
- // A set of patterns that match a sepecific Entity subject.
+ // A set of patterns that match a specific Entity subject.
final List<StatementPattern> patterns = getSPs(
"SELECT * WHERE { " +
"<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ."+
@@ -264,7 +265,7 @@ public class EntityQueryNodeIT extends MongoITBase {
final CloseableIteration<BindingSet, QueryEvaluationException> rez = node.evaluate(new MapBindingSet());
final MapBindingSet expected = new MapBindingSet();
expected.addBinding("age", vf.createLiteral("20"));
- expected.addBinding("-const-blue", vf.createLiteral("blue"));
+ expected.addBinding(VarNameUtils.createUniqueConstVarNameLiteral("blue"), vf.createLiteral("blue"));
expected.addBinding("name", vf.createLiteral("Bob"));
while(rez.hasNext()) {
assertEquals(expected, rez.next());
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/EntityDocumentConverterTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/EntityDocumentConverterTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/EntityDocumentConverterTest.java
index 79ea998..b124470 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/EntityDocumentConverterTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/EntityDocumentConverterTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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
@@ -26,8 +26,8 @@ import org.apache.rya.indexing.entity.model.Entity;
import org.apache.rya.indexing.entity.model.Property;
import org.apache.rya.indexing.entity.storage.mongo.DocumentConverter.DocumentConverterException;
import org.bson.Document;
+import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import org.junit.Test;
-import org.openrdf.model.vocabulary.XMLSchema;
/**
* Tests the methods of {@link EntityDocumentConverter}.
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorageIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorageIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorageIT.java
index 8e33d37..cec989e 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorageIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/MongoEntityStorageIT.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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
@@ -37,8 +37,8 @@ import org.apache.rya.indexing.entity.storage.EntityStorage.EntityAlreadyExistsE
import org.apache.rya.indexing.entity.storage.EntityStorage.EntityStorageException;
import org.apache.rya.indexing.entity.storage.EntityStorage.StaleUpdateException;
import org.apache.rya.mongodb.MongoITBase;
+import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import org.junit.Test;
-import org.openrdf.model.vocabulary.XMLSchema;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/RyaTypeDocumentConverterTest.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/RyaTypeDocumentConverterTest.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/RyaTypeDocumentConverterTest.java
index 3196793..5ffde39 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/RyaTypeDocumentConverterTest.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/storage/mongo/RyaTypeDocumentConverterTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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
@@ -24,9 +24,9 @@ import org.apache.rya.api.domain.RyaType;
import org.apache.rya.api.resolver.RdfToRyaConversions;
import org.apache.rya.indexing.entity.storage.mongo.DocumentConverter.DocumentConverterException;
import org.bson.Document;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import org.junit.Test;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.model.vocabulary.XMLSchema;
/**
* Tests the methods of {@link RyaTypeDocumentConverter}.
@@ -36,7 +36,7 @@ public class RyaTypeDocumentConverterTest {
@Test
public void toDocument() {
// Convert the RyaType into a Document.
- final RyaType ryaType = RdfToRyaConversions.convertLiteral( new ValueFactoryImpl().createLiteral( 4.5 ) );
+ final RyaType ryaType = RdfToRyaConversions.convertLiteral( SimpleValueFactory.getInstance().createLiteral( 4.5 ) );
final Document document = new RyaTypeDocumentConverter().toDocument( ryaType );
// Show the document has the correct structure.
@@ -55,7 +55,7 @@ public class RyaTypeDocumentConverterTest {
final RyaType ryaType = new RyaTypeDocumentConverter().fromDocument( document );
// Show the converted value has the expected structure.
- final RyaType expected = RdfToRyaConversions.convertLiteral( new ValueFactoryImpl().createLiteral( 4.5 ) );
+ final RyaType expected = RdfToRyaConversions.convertLiteral( SimpleValueFactory.getInstance().createLiteral( 4.5 ) );
assertEquals(expected, ryaType);
}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
index 28fd330..dd1644b 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/entity/update/mongo/MongoEntityIndexerIT.java
@@ -1,4 +1,4 @@
-/**
+/*
* 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
@@ -33,9 +33,9 @@ import org.apache.rya.indexing.entity.storage.TypeStorage;
import org.apache.rya.indexing.entity.storage.mongo.MongoEntityStorage;
import org.apache.rya.indexing.entity.storage.mongo.MongoTypeStorage;
import org.apache.rya.mongodb.MongoITBase;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.model.vocabulary.XMLSchema;
import org.junit.Test;
-import org.openrdf.model.vocabulary.RDF;
-import org.openrdf.model.vocabulary.XMLSchema;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/81b99327/extras/indexing/src/test/java/org/apache/rya/indexing/external/AccumuloConstantPcjIT.java
----------------------------------------------------------------------
diff --git a/extras/indexing/src/test/java/org/apache/rya/indexing/external/AccumuloConstantPcjIT.java b/extras/indexing/src/test/java/org/apache/rya/indexing/external/AccumuloConstantPcjIT.java
index 5d53737..1644ed1 100644
--- a/extras/indexing/src/test/java/org/apache/rya/indexing/external/AccumuloConstantPcjIT.java
+++ b/extras/indexing/src/test/java/org/apache/rya/indexing/external/AccumuloConstantPcjIT.java
@@ -1,7 +1,3 @@
-package org.apache.rya.indexing.external;
-
-import java.net.UnknownHostException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,7 +16,9 @@ import java.net.UnknownHostException;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.rya.indexing.external;
+import java.net.UnknownHostException;
import java.util.List;
import org.apache.accumulo.core.client.AccumuloException;
@@ -30,42 +28,41 @@ import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.rya.api.persist.RyaDAOException;
import org.apache.rya.indexing.pcj.storage.PcjException;
-import org.apache.rya.indexing.pcj.storage.accumulo.PcjVarOrderFactory;
+import org.apache.rya.rdftriplestore.inference.InferenceEngineException;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.eclipse.rdf4j.query.BindingSet;
+import org.eclipse.rdf4j.query.MalformedQueryException;
+import org.eclipse.rdf4j.query.QueryEvaluationException;
+import org.eclipse.rdf4j.query.QueryLanguage;
+import org.eclipse.rdf4j.query.QueryResultHandlerException;
+import org.eclipse.rdf4j.query.TupleQueryResultHandler;
+import org.eclipse.rdf4j.query.TupleQueryResultHandlerException;
+import org.eclipse.rdf4j.repository.RepositoryException;
+import org.eclipse.rdf4j.repository.sail.SailRepository;
+import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection;
+import org.eclipse.rdf4j.sail.SailException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.LiteralImpl;
-import org.openrdf.model.impl.URIImpl;
-import org.openrdf.model.vocabulary.RDF;
-import org.openrdf.model.vocabulary.RDFS;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.MalformedQueryException;
-import org.openrdf.query.QueryEvaluationException;
-import org.openrdf.query.QueryLanguage;
-import org.openrdf.query.QueryResultHandlerException;
-import org.openrdf.query.TupleQueryResultHandler;
-import org.openrdf.query.TupleQueryResultHandlerException;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.repository.sail.SailRepositoryConnection;
-import org.openrdf.sail.SailException;
import com.google.common.base.Optional;
-import org.apache.rya.api.persist.RyaDAOException;
-import org.apache.rya.rdftriplestore.inference.InferenceEngineException;
-
public class AccumuloConstantPcjIT {
+ private static final ValueFactory VF = SimpleValueFactory.getInstance();
private SailRepositoryConnection conn, pcjConn;
private SailRepository repo, pcjRepo;
private Connector accCon;
String prefix = "table_";
String tablename = "table_INDEX_";
- URI obj, obj2, subclass, subclass2, talksTo;
+ IRI obj, obj2, subclass, subclass2, talksTo;
@Before
public void init() throws RepositoryException,
@@ -81,21 +78,21 @@ public class AccumuloConstantPcjIT {
pcjRepo = PcjIntegrationTestingUtil.getAccumuloPcjRepo(prefix, "instance");
pcjConn = pcjRepo.getConnection();
- final URI sub = new URIImpl("uri:entity");
- subclass = new URIImpl("uri:class");
- obj = new URIImpl("uri:obj");
- talksTo = new URIImpl("uri:talksTo");
+ final IRI sub = VF.createIRI("uri:entity");
+ subclass = VF.createIRI("uri:class");
+ obj = VF.createIRI("uri:obj");
+ talksTo = VF.createIRI("uri:talksTo");
conn.add(sub, RDF.TYPE, subclass);
- conn.add(sub, RDFS.LABEL, new LiteralImpl("label"));
+ conn.add(sub, RDFS.LABEL, VF.createLiteral("label"));
conn.add(sub, talksTo, obj);
- final URI sub2 = new URIImpl("uri:entity2");
- subclass2 = new URIImpl("uri:class2");
- obj2 = new URIImpl("uri:obj2");
+ final IRI sub2 = VF.createIRI("uri:entity2");
+ subclass2 = VF.createIRI("uri:class2");
+ obj2 = VF.createIRI("uri:obj2");
conn.add(sub2, RDF.TYPE, subclass2);
- conn.add(sub2, RDFS.LABEL, new LiteralImpl("label2"));
+ conn.add(sub2, RDFS.LABEL, VF.createLiteral("label2"));
conn.add(sub2, talksTo, obj2);
accCon = new MockInstance("instance").getConnector("root",new PasswordToken(""));
@@ -120,16 +117,16 @@ public class AccumuloConstantPcjIT {
MalformedQueryException, SailException, QueryEvaluationException,
TupleQueryResultHandlerException {
- final URI superclass = new URIImpl("uri:superclass");
- final URI superclass2 = new URIImpl("uri:superclass2");
+ final IRI superclass = VF.createIRI("uri:superclass");
+ final IRI superclass2 = VF.createIRI("uri:superclass2");
conn.add(subclass, RDF.TYPE, superclass);
conn.add(subclass2, RDF.TYPE, superclass2);
- conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
- conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+ conn.add(obj, RDFS.LABEL, VF.createLiteral("label"));
+ conn.add(obj2, RDFS.LABEL, VF.createLiteral("label2"));
- conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
- conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+ conn.add(obj, RDFS.LABEL, VF.createLiteral("label"));
+ conn.add(obj2, RDFS.LABEL, VF.createLiteral("label2"));
final String indexSparqlString = ""//
+ "SELECT ?dog ?pig ?duck " //
@@ -158,10 +155,10 @@ public class AccumuloConstantPcjIT {
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1,
indexSparqlString, new String[] { "dog", "pig", "duck" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 2,
indexSparqlString2, new String[] { "o", "f", "e", "c", "l" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
final CountingResultHandler crh1 = new CountingResultHandler();
final CountingResultHandler crh2 = new CountingResultHandler();
@@ -182,26 +179,26 @@ public class AccumuloConstantPcjIT {
MalformedQueryException, SailException, QueryEvaluationException,
TupleQueryResultHandlerException {
- final URI superclass = new URIImpl("uri:superclass");
- final URI superclass2 = new URIImpl("uri:superclass2");
+ final IRI superclass = VF.createIRI("uri:superclass");
+ final IRI superclass2 = VF.createIRI("uri:superclass2");
- final URI sub = new URIImpl("uri:entity");
- subclass = new URIImpl("uri:class");
- obj = new URIImpl("uri:obj");
- talksTo = new URIImpl("uri:talksTo");
+ final IRI sub = VF.createIRI("uri:entity");
+ subclass = VF.createIRI("uri:class");
+ obj = VF.createIRI("uri:obj");
+ talksTo = VF.createIRI("uri:talksTo");
- final URI howlsAt = new URIImpl("uri:howlsAt");
- final URI subType = new URIImpl("uri:subType");
+ final IRI howlsAt = VF.createIRI("uri:howlsAt");
+ final IRI subType = VF.createIRI("uri:subType");
conn.add(subclass, RDF.TYPE, superclass);
conn.add(subclass2, RDF.TYPE, superclass2);
- conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
- conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+ conn.add(obj, RDFS.LABEL, VF.createLiteral("label"));
+ conn.add(obj2, RDFS.LABEL, VF.createLiteral("label2"));
conn.add(sub, howlsAt, superclass);
conn.add(superclass, subType, obj);
- conn.add(obj, RDFS.LABEL, new LiteralImpl("label"));
- conn.add(obj2, RDFS.LABEL, new LiteralImpl("label2"));
+ conn.add(obj, RDFS.LABEL, VF.createLiteral("label"));
+ conn.add(obj2, RDFS.LABEL, VF.createLiteral("label2"));
final String indexSparqlString = ""//
+ "SELECT ?dog ?pig ?duck " //
@@ -239,14 +236,14 @@ public class AccumuloConstantPcjIT {
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1,
indexSparqlString, new String[] { "dog", "pig", "duck" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 2,
indexSparqlString2, new String[] { "o", "f", "e", "c", "l" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 3,
indexSparqlString3,
new String[] { "wolf", "sheep", "chicken" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
final CountingResultHandler crh1 = new CountingResultHandler();
final CountingResultHandler crh2 = new CountingResultHandler();
@@ -269,15 +266,15 @@ public class AccumuloConstantPcjIT {
TupleQueryResultHandlerException, AccumuloException,
AccumuloSecurityException {
- final URI e1 = new URIImpl("uri:e1");
- final URI e2 = new URIImpl("uri:e2");
- final URI e3 = new URIImpl("uri:e3");
- final URI f1 = new URIImpl("uri:f1");
- final URI f2 = new URIImpl("uri:f2");
- final URI f3 = new URIImpl("uri:f3");
- final URI g1 = new URIImpl("uri:g1");
- final URI g2 = new URIImpl("uri:g2");
- final URI g3 = new URIImpl("uri:g3");
+ final IRI e1 = VF.createIRI("uri:e1");
+ final IRI e2 = VF.createIRI("uri:e2");
+ final IRI e3 = VF.createIRI("uri:e3");
+ final IRI f1 = VF.createIRI("uri:f1");
+ final IRI f2 = VF.createIRI("uri:f2");
+ final IRI f3 = VF.createIRI("uri:f3");
+ final IRI g1 = VF.createIRI("uri:g1");
+ final IRI g2 = VF.createIRI("uri:g2");
+ final IRI g3 = VF.createIRI("uri:g3");
conn.add(e1, talksTo, f1);
conn.add(f1, talksTo, g1);
@@ -309,7 +306,7 @@ public class AccumuloConstantPcjIT {
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1,
indexSparqlString, new String[] { "a", "b", "c", "d" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
final CountingResultHandler crh1 = new CountingResultHandler();
final CountingResultHandler crh2 = new CountingResultHandler();
@@ -330,8 +327,8 @@ public class AccumuloConstantPcjIT {
TableNotFoundException,
TupleQueryResultHandlerException, AccumuloException, AccumuloSecurityException {
- final URI e1 = new URIImpl("uri:e1");
- final URI f1 = new URIImpl("uri:f1");
+ final IRI e1 = VF.createIRI("uri:e1");
+ final IRI f1 = VF.createIRI("uri:f1");
conn.add(e1, talksTo, e1);
conn.add(e1, talksTo, f1);
@@ -357,7 +354,7 @@ public class AccumuloConstantPcjIT {
PcjIntegrationTestingUtil.createAndPopulatePcj(conn, accCon, tablename + 1,
indexSparqlString, new String[] { "a", "b", "c", "d" },
- Optional.<PcjVarOrderFactory> absent());
+ Optional.absent());
final CountingResultHandler crh1 = new CountingResultHandler();
final CountingResultHandler crh2 = new CountingResultHandler();