You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2016/10/28 13:14:25 UTC
[03/49] incubator-commonsrdf git commit: RDFFactory methods no longer
throw UnsupportedOperationException
RDFFactory methods no longer throw UnsupportedOperationException
Thus we can remove the `default` methods and simplify the
AbstractRDFTermFactoryTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/518eacb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/518eacb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/518eacb5
Branch: refs/heads/master
Commit: 518eacb516ff9ab6a98149c254728056eec80778
Parents: 2f4a276
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed Oct 19 17:19:55 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Wed Oct 19 17:19:55 2016 +0100
----------------------------------------------------------------------
.../org/apache/commons/rdf/api/RDFFactory.java | 84 ++-----
.../rdf/api/AbstractRDFTermFactoryTest.java | 233 ++++---------------
.../rdf/api/DefaultRDFTermFactoryTest.java | 33 ---
.../commons/rdf/rdf4j/NativeStoreGraphTest.java | 11 +-
.../commons/rdf/simple/DefaultGraphTest.java | 51 ----
5 files changed, 71 insertions(+), 341 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/518eacb5/api/src/main/java/org/apache/commons/rdf/api/RDFFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFFactory.java b/api/src/main/java/org/apache/commons/rdf/api/RDFFactory.java
index 2e97a03..470d0cf 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/RDFFactory.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFFactory.java
@@ -25,11 +25,6 @@ import java.util.Locale;
* <p>
* It is not specified how an implementation should provide a RDFFactory.
* <p>
- * If an implementation does not support a particular method (e.g. it requires
- * additional parameters or can't create graphs), then it MAY throw
- * {@link UnsupportedOperationException}, as provided by the <code>default</code>
- * implementations in this interface.
- * <p>
* If a factory method does not allow or support a provided parameter, e.g.
* because an IRI is considered invalid, then it SHOULD throw
* {@link IllegalArgumentException}.
@@ -47,13 +42,8 @@ public interface RDFFactory {
* {@link BlankNode} instances according to {@link BlankNode#equals(Object)}.
*
* @return A new, unique {@link BlankNode}
- * @throws UnsupportedOperationException
- * If the operation is not supported.
*/
- default BlankNode createBlankNode() throws UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createBlankNode() not supported");
- }
+ BlankNode createBlankNode();
/**
* Create a blank node based on the given name.
@@ -77,14 +67,8 @@ public interface RDFFactory {
* A non-empty, non-null, String that is unique to this blank
* node in the context of this {@link RDFFactory}.
* @return A BlankNode for the given name
- * @throws UnsupportedOperationException
- * If the operation is not supported.
*/
- default BlankNode createBlankNode(String name)
- throws UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createBlankNode(String) not supported");
- }
+ BlankNode createBlankNode(String name);
/**
* Create a new graph.
@@ -93,11 +77,8 @@ public interface RDFFactory {
* mechanism.
*
* @return A new Graph
- * @throws UnsupportedOperationException If the operation is not supported.
*/
- default Graph createGraph() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("createGraph() not supported");
- }
+ Graph createGraph();
/**
* Create a new dataset.
@@ -106,11 +87,8 @@ public interface RDFFactory {
* mechanism.
*
* @return A new Dataset
- * @throws UnsupportedOperationException If the operation is not supported.
*/
- default Dataset createDataset() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("createDataset() not supported");
- }
+ Dataset createDataset();
/**
* Create an IRI from a (possibly escaped) String.
@@ -123,13 +101,8 @@ public interface RDFFactory {
* @return A new IRI
* @throws IllegalArgumentException If the provided string is not acceptable, e.g. does not
* conform to the RFC3987 syntax.
- * @throws UnsupportedOperationException If the operation is not supported.
*/
- default IRI createIRI(String iri) throws IllegalArgumentException,
- UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createIRI(String) not supported");
- }
+ IRI createIRI(String iri) throws IllegalArgumentException;
/**
* Create a simple literal.
@@ -146,14 +119,9 @@ public interface RDFFactory {
* @param lexicalForm The literal value in plain text
* @return The created Literal
* @throws IllegalArgumentException If the provided lexicalForm is not acceptable, e.g. because
- * it is too large for an underlying storage.
- * @throws UnsupportedOperationException If the operation is not supported.
+ * it is too large for an underlying storage.
*/
- default Literal createLiteral(String lexicalForm)
- throws IllegalArgumentException, UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createLiteral(String) not supported");
- }
+ Literal createLiteral(String lexicalForm) throws IllegalArgumentException;
/**
* Create a literal with the specified data type.
@@ -180,14 +148,10 @@ public interface RDFFactory {
* <code>http://www.w3.org/2001/XMLSchema#integer</code>
* @return The created Literal
* @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g.
- * because the provided dataType is not permitted.
- * @throws UnsupportedOperationException If the operation is not supported.
+ * because the provided dataType is not permitted.
*/
- default Literal createLiteral(String lexicalForm, IRI dataType)
- throws IllegalArgumentException, UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createLiteral(String) not supported");
- }
+ Literal createLiteral(String lexicalForm, IRI dataType)
+ throws IllegalArgumentException;
/**
* Create a language-tagged literal.
@@ -215,14 +179,10 @@ public interface RDFFactory {
* href="http://tools.ietf.org/html/bcp47">BCP47</a>
* @return The created Literal
* @throws IllegalArgumentException If the provided values are not acceptable, e.g. because the
- * languageTag was syntactically invalid.
- * @throws UnsupportedOperationException If the operation is not supported.
+ * languageTag was syntactically invalid.
*/
- default Literal createLiteral(String lexicalForm, String languageTag)
- throws IllegalArgumentException, UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createLiteral(String,String) not supported");
- }
+ Literal createLiteral(String lexicalForm, String languageTag)
+ throws IllegalArgumentException;
/**
* Create a triple.
@@ -239,14 +199,9 @@ public interface RDFFactory {
* @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g.
* because a Literal has a lexicalForm that is too large for an
* underlying storage.
- * @throws UnsupportedOperationException If the operation is not supported.
*/
- default Triple createTriple(BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object) throws IllegalArgumentException,
- UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported");
- }
+ Triple createTriple(BlankNodeOrIRI subject, IRI predicate,
+ RDFTerm object) throws IllegalArgumentException;
/**
* Create a quad.
@@ -266,13 +221,8 @@ public interface RDFFactory {
* @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g.
* because a Literal has a lexicalForm that is too large for an
* underlying storage.
- * @throws UnsupportedOperationException If the operation is not supported.
*/
- default Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object) throws IllegalArgumentException,
- UnsupportedOperationException {
- throw new UnsupportedOperationException(
- "createQuad(BlankNodeOrIRI,BlankNodeOrIRI,IRI,RDFTerm) not supported");
- }
+ Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate,
+ RDFTerm object) throws IllegalArgumentException;
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/518eacb5/api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTermFactoryTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTermFactoryTest.java b/api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTermFactoryTest.java
index 412b812..5afa9f2 100644
--- a/api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTermFactoryTest.java
+++ b/api/src/test/java/org/apache/commons/rdf/api/AbstractRDFTermFactoryTest.java
@@ -57,13 +57,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateBlankNode() throws Exception {
- BlankNode bnode;
- try {
- bnode = factory.createBlankNode();
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ BlankNode bnode = factory.createBlankNode();
BlankNode bnode2 = factory.createBlankNode();
assertNotEquals(
@@ -75,8 +69,6 @@ public abstract class AbstractRDFTermFactoryTest {
public void testCreateBlankNodeIdentifierEmpty() throws Exception {
try {
factory.createBlankNode("");
- } catch (UnsupportedOperationException e) {
- Assume.assumeNoException(e);
} catch (IllegalArgumentException e) {
// Expected exception
}
@@ -84,25 +76,15 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateBlankNodeIdentifier() throws Exception {
- try {
- factory.createBlankNode("example1");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ factory.createBlankNode("example1");
}
@Test
public void testCreateBlankNodeIdentifierTwice() throws Exception {
BlankNode bnode1, bnode2, bnode3;
- try {
- bnode1 = factory.createBlankNode("example1");
- bnode2 = factory.createBlankNode("example1");
- bnode3 = factory.createBlankNode("differ");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ bnode1 = factory.createBlankNode("example1");
+ bnode2 = factory.createBlankNode("example1");
+ bnode3 = factory.createBlankNode("differ");
// We don't know what the identifier is, but it MUST be the same
assertEquals(bnode1.uniqueReference(), bnode2.uniqueReference());
// We don't know what the ntriplesString is, but it MUST be the same
@@ -116,24 +98,18 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateBlankNodeIdentifierTwiceDifferentFactories() throws Exception {
BlankNode bnode1, differentFactory;
- try {
- bnode1 = factory.createBlankNode();
- // it MUST differ from a second factory
- differentFactory = createFactory().createBlankNode();
-
- // NOTE: We can't make similar assumption if we provide a
- // name to createBlankNode(String) as its documentation
- // only says:
- //
- // * BlankNodes created using this method with the same parameter, for
- // * different instances of RDFFactory, SHOULD NOT be equivalent.
- //
- // https://github.com/apache/incubator-commonsrdf/pull/7#issuecomment-92312779
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ bnode1 = factory.createBlankNode();
+ // it MUST differ from a second factory
+ differentFactory = createFactory().createBlankNode();
+
+ // NOTE: We can't make similar assumption if we provide a
+ // name to createBlankNode(String) as its documentation
+ // only says:
+ //
+ // * BlankNodes created using this method with the same parameter, for
+ // * different instances of RDFFactory, SHOULD NOT be equivalent.
//
+ // https://github.com/apache/incubator-commonsrdf/pull/7#issuecomment-92312779
assertNotEquals(bnode1, differentFactory);
assertNotEquals(bnode1.uniqueReference(),
differentFactory.uniqueReference());
@@ -144,13 +120,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateGraph() {
- Graph graph;
- try {
- graph = factory.createGraph();
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ Graph graph = factory.createGraph();
assertEquals("Graph was not empty", 0, graph.size());
graph.add(factory.createBlankNode(),
@@ -165,13 +135,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateIRI() throws Exception {
- IRI example;
- try {
- example = factory.createIRI("http://example.com/");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException("createIRI not supported", ex);
- return;
- }
+ IRI example = factory.createIRI("http://example.com/");
assertEquals("http://example.com/", example.getIRIString());
assertEquals("<http://example.com/>", example.ntriplesString());
@@ -208,7 +172,7 @@ public abstract class AbstractRDFTermFactoryTest {
// be possible to resolve to an absolute IRI)
try {
factory.createIRI("../relative");
- } catch (UnsupportedOperationException | IllegalArgumentException ex) {
+ } catch (IllegalArgumentException ex) {
Assume.assumeNoException(ex);
return;
}
@@ -227,14 +191,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateLiteral() throws Exception {
- Literal example;
- try {
- example = factory.createLiteral("Example");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
-
+ Literal example = factory.createLiteral("Example");
assertEquals("Example", example.getLexicalForm());
assertFalse(example.getLanguageTag().isPresent());
assertEquals("http://www.w3.org/2001/XMLSchema#string", example
@@ -245,16 +202,10 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateLiteralDateTime() throws Exception {
- Literal dateTime;
- try {
- dateTime = factory
+ Literal dateTime = factory
.createLiteral(
"2014-12-27T00:50:00T-0600",
factory.createIRI("http://www.w3.org/2001/XMLSchema#dateTime"));
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
assertEquals("2014-12-27T00:50:00T-0600", dateTime.getLexicalForm());
assertFalse(dateTime.getLanguageTag().isPresent());
assertEquals("http://www.w3.org/2001/XMLSchema#dateTime", dateTime
@@ -266,13 +217,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateLiteralLang() throws Exception {
- Literal example;
- try {
- example = factory.createLiteral("Example", "en");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ Literal example = factory.createLiteral("Example", "en");
assertEquals("Example", example.getLexicalForm());
assertEquals("en", example.getLanguageTag().get());
@@ -284,14 +229,7 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateLiteralLangISO693_3() throws Exception {
// see https://issues.apache.org/jira/browse/JENA-827
- Literal vls;
- try {
- vls = factory.createLiteral("Herbert Van de Sompel", "vls"); // JENA-827
- // reference
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ Literal vls = factory.createLiteral("Herbert Van de Sompel", "vls"); // JENA-827
assertEquals("vls", vls.getLanguageTag().get());
assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",
@@ -301,14 +239,8 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateLiteralString() throws Exception {
- Literal example;
- try {
- example = factory.createLiteral("Example", factory
+ Literal example = factory.createLiteral("Example", factory
.createIRI("http://www.w3.org/2001/XMLSchema#string"));
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
assertEquals("Example", example.getLexicalForm());
assertFalse(example.getLanguageTag().isPresent());
assertEquals("http://www.w3.org/2001/XMLSchema#string", example
@@ -319,19 +251,10 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateTripleBnodeBnode() {
- BlankNode subject;
- IRI predicate;
- BlankNode object;
- Triple triple;
- try {
- subject = factory.createBlankNode("b1");
- predicate = factory.createIRI("http://example.com/pred");
- object = factory.createBlankNode("b2");
- triple = factory.createTriple(subject, predicate, object);
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ BlankNode subject = factory.createBlankNode("b1");
+ IRI predicate = factory.createIRI("http://example.com/pred");
+ BlankNode object = factory.createBlankNode("b2");
+ Triple triple = factory.createTriple(subject, predicate, object);
// bnode equivalence should be OK as we used the same
// factory and have not yet inserted Triple into a Graph
@@ -342,19 +265,10 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateTripleBnodeIRI() {
- BlankNode subject;
- IRI predicate;
- IRI object;
- Triple triple;
- try {
- subject = factory.createBlankNode("b1");
- predicate = factory.createIRI("http://example.com/pred");
- object = factory.createIRI("http://example.com/obj");
- triple = factory.createTriple(subject, predicate, object);
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
+ BlankNode subject = factory.createBlankNode("b1");
+ IRI predicate = factory.createIRI("http://example.com/pred");
+ IRI object = factory.createIRI("http://example.com/obj");
+ Triple triple = factory.createTriple(subject, predicate, object);
// bnode equivalence should be OK as we used the same
// factory and have not yet inserted Triple into a Graph
@@ -365,20 +279,11 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void testCreateTripleBnodeTriple() {
- BlankNode subject;
- IRI predicate;
- Literal object;
- Triple triple;
- try {
- subject = factory.createBlankNode();
- predicate = factory.createIRI("http://example.com/pred");
- object = factory.createLiteral("Example", "en");
- triple = factory.createTriple(subject, predicate, object);
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(ex);
- return;
- }
-
+ BlankNode subject = factory.createBlankNode();
+ IRI predicate = factory.createIRI("http://example.com/pred");
+ Literal object = factory.createLiteral("Example", "en");
+ Triple triple = factory.createTriple(subject, predicate, object);
+
// bnode equivalence should be OK as we used the same
// factory and have not yet inserted Triple into a Graph
assertEquals(subject, triple.getSubject());
@@ -391,10 +296,6 @@ public abstract class AbstractRDFTermFactoryTest {
BlankNode withColon;
try {
withColon = factory.createBlankNode("with:colon");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException("createBlankNode(String) not supported",
- ex);
- return;
} catch (IllegalArgumentException ex) {
// Good!
return;
@@ -410,23 +311,12 @@ public abstract class AbstractRDFTermFactoryTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidIRI() throws Exception {
- try {
- factory.createIRI("<no_brackets>");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException("createIRI not supported", ex);
- return;
- }
+ factory.createIRI("<no_brackets>");
}
@Test(expected = IllegalArgumentException.class)
public void testInvalidLiteralLang() throws Exception {
- try {
- factory.createLiteral("Example", "with space");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createLiteral(String,String) not supported", ex);
- return;
- }
+ factory.createLiteral("Example", "with space");
}
@Test(expected = Exception.class)
@@ -439,40 +329,19 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void hashCodeBlankNode() throws Exception {
- BlankNode bnode1;
- try {
- bnode1 = factory.createBlankNode();
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createBlankNode() not supported", ex);
- return;
- }
+ BlankNode bnode1 = factory.createBlankNode();
assertEquals(bnode1.uniqueReference().hashCode(), bnode1.hashCode());
}
@Test
public void hashCodeIRI() throws Exception {
- IRI iri;
- try {
- iri = factory.createIRI("http://example.com/");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createIRI(String) not supported", ex);
- return;
- }
+ IRI iri = factory.createIRI("http://example.com/");
assertEquals(iri.getIRIString().hashCode(), iri.hashCode());
}
@Test
public void hashCodeLiteral() throws Exception {
- Literal literal;
- try {
- literal = factory.createLiteral("Hello");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createLiteral(String) not supported", ex);
- return;
- }
+ Literal literal = factory.createLiteral("Hello");
assertEquals(Objects.hash(
literal.getLexicalForm(),
literal.getDatatype(),
@@ -483,22 +352,8 @@ public abstract class AbstractRDFTermFactoryTest {
@Test
public void hashCodeTriple() throws Exception {
- IRI iri;
- try {
- iri = factory.createIRI("http://example.com/");
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createIRI() not supported", ex);
- return;
- }
- Triple triple;
- try {
- triple = factory.createTriple(iri, iri, iri);
- } catch (UnsupportedOperationException ex) {
- Assume.assumeNoException(
- "createTriple() not supported", ex);
- return;
- }
+ IRI iri = factory.createIRI("http://example.com/");
+ Triple triple = factory.createTriple(iri, iri, iri);
assertEquals(Objects.hash(iri, iri, iri),
triple.hashCode());
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/518eacb5/api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFactoryTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFactoryTest.java b/api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFactoryTest.java
deleted file mode 100644
index d7db514..0000000
--- a/api/src/test/java/org/apache/commons/rdf/api/DefaultRDFTermFactoryTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.rdf.api;
-
-/**
- * The default RDFFactory might be useless (every method throws
- * UnsupportedOperationException), but this test ensures that
- * AbstractRDFTermFactoryTest does not fall over on unsupported operations.
- */
-public class DefaultRDFTermFactoryTest extends AbstractRDFTermFactoryTest {
-
- @Override
- public RDFFactory createFactory() {
- return new RDFFactory() {
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/518eacb5/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
index 9a5ab50..91a0b14 100644
--- a/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
+++ b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/NativeStoreGraphTest.java
@@ -24,8 +24,10 @@ import java.util.Set;
import org.apache.commons.rdf.api.AbstractGraphTest;
import org.apache.commons.rdf.api.BlankNodeOrIRI;
+import org.apache.commons.rdf.api.Dataset;
import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.api.Literal;
+import org.apache.commons.rdf.api.Quad;
import org.apache.commons.rdf.api.RDFTerm;
import org.apache.commons.rdf.api.RDFFactory;
import org.eclipse.rdf4j.repository.RepositoryConnection;
@@ -59,7 +61,10 @@ public class NativeStoreGraphTest extends AbstractGraphTest {
Set<RDF4JBlankNode> context = Collections.singleton(rdf4jFactory.createBlankNode());
return rdf4jFactory.asRDFTermGraph(getRepository(), context);
}
-
+ public Dataset createDataset() {
+ return rdf4jFactory.asRDFTermDataset(getRepository());
+ }
+
// Delegate methods
public RDF4JBlankNode createBlankNode() {
return rdf4jFactory.createBlankNode();
@@ -82,6 +87,10 @@ public class NativeStoreGraphTest extends AbstractGraphTest {
public RDF4JTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
return rdf4jFactory.createTriple(subject, predicate, object);
}
+ public Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
+ throws IllegalArgumentException {
+ return rdf4jFactory.createQuad(graphName, subject, predicate, object);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/518eacb5/simple/src/test/java/org/apache/commons/rdf/simple/DefaultGraphTest.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/DefaultGraphTest.java b/simple/src/test/java/org/apache/commons/rdf/simple/DefaultGraphTest.java
deleted file mode 100644
index 4b100b3..0000000
--- a/simple/src/test/java/org/apache/commons/rdf/simple/DefaultGraphTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.rdf.simple;
-
-import org.apache.commons.rdf.api.AbstractGraphTest;
-import org.apache.commons.rdf.api.Graph;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFFactory;
-
-/**
- * Ensure AbstractGraphTest does not crash if the RDFFactory throws
- * UnsupportedOperationException
- */
-
-public class DefaultGraphTest extends AbstractGraphTest {
-
- @Override
- public RDFFactory createFactory() {
- // The most minimal RDFFactory that would still
- // make sense with a Graph
- return new RDFFactory() {
- @Override
- public Graph createGraph() throws UnsupportedOperationException {
- return new GraphImpl(new SimpleRDFTermFactory());
- }
-
- @Override
- public IRI createIRI(String iri)
- throws UnsupportedOperationException,
- IllegalArgumentException {
- return new IRIImpl(iri);
- }
- };
- }
-
-}