commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject incubator-commonsrdf git commit: Removed generics from RDF4JTerm
Date Fri, 07 Oct 2016 16:15:40 GMT
Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/master 53ca0f9c7 -> 7f866f025


Removed generics from RDF4JTerm


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/7f866f02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/7f866f02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/7f866f02

Branch: refs/heads/master
Commit: 7f866f0250d88b1e184bb3c42081d86d4b5f9d75
Parents: 53ca0f9
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Oct 7 17:15:34 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Oct 7 17:15:34 2016 +0100

----------------------------------------------------------------------
 .../org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java   |  6 +++++-
 .../apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java  |  7 +++++--
 .../java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java  |  3 +--
 .../java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java    |  6 +++++-
 .../org/apache/commons/rdf/rdf4j/RDF4JLiteral.java     |  2 +-
 .../java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java   |  4 ++--
 .../org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java | 13 ++++++-------
 .../commons/rdf/rdf4j/experimental/RDF4JParser.java    |  2 +-
 .../apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java |  2 +-
 .../apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java  |  2 +-
 .../commons/rdf/rdf4j/impl/RepositoryGraphImpl.java    |  6 +++---
 11 files changed, 31 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java
index 7053cd7..3e5a055 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNode.java
@@ -29,5 +29,9 @@ import org.eclipse.rdf4j.model.BNode;
  * 
  * @see RDF4JTermFactory#createBlankNode() 
  */
-public interface RDF4JBlankNode extends RDF4JBlankNodeOrIRI<BNode>, BlankNode {
+public interface RDF4JBlankNode extends RDF4JBlankNodeOrIRI, BlankNode {
+	
+	@Override
+	public BNode asValue();
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java
index ffecf0e..75b5a32 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java
@@ -29,6 +29,9 @@ import org.eclipse.rdf4j.model.Resource;
  * retrieved with {@link #asValue()}.
  * 
  */
-public interface RDF4JBlankNodeOrIRI<T extends Resource> 
-	extends RDF4JTerm<T>, BlankNodeOrIRI {
+public interface RDF4JBlankNodeOrIRI extends RDF4JTerm, BlankNodeOrIRI {
+
+	@Override
+	public Resource asValue();
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java
index 9079e99..a83a9ab 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraph.java
@@ -27,7 +27,6 @@ import org.apache.commons.rdf.api.IRI;
 import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.api.Triple;
 import org.eclipse.rdf4j.model.Model;
-import org.eclipse.rdf4j.model.Resource;
 import org.eclipse.rdf4j.repository.Repository;
 
 
@@ -70,7 +69,7 @@ public interface RDF4JGraph extends Graph, RDF4JGraphLike<Triple>
{
 	 * @return The context mask as a set of {@link BlankNodeOrIRI} graph names, which
 	 *         may contain the value <code>null</code>.
 	 */
-	public Set<RDF4JBlankNodeOrIRI<Resource>> getContextMask();
+	public Set<RDF4JBlankNodeOrIRI> getContextMask();
 	
 	/**
 	 * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java
index 2fef0c4..37efa0a 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JIRI.java
@@ -27,5 +27,9 @@ package org.apache.commons.rdf.rdf4j;
  * @see RDF4JTermFactory#createIRI(String)
  */
 public interface RDF4JIRI 
-	extends RDF4JBlankNodeOrIRI<org.eclipse.rdf4j.model.IRI>, org.apache.commons.rdf.api.IRI
{
+	extends RDF4JBlankNodeOrIRI, org.apache.commons.rdf.api.IRI {
+	
+	@Override
+	org.eclipse.rdf4j.model.IRI asValue();
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.java
index 0166c67..114d3f9 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JLiteral.java
@@ -26,5 +26,5 @@ package org.apache.commons.rdf.rdf4j;
  * 
  * @see RDF4JTermFactory#createLiteral(String)
  */
-public interface RDF4JLiteral extends RDF4JTerm<org.eclipse.rdf4j.model.Literal>, org.apache.commons.rdf.api.Literal
{
+public interface RDF4JLiteral extends RDF4JTerm, org.apache.commons.rdf.api.Literal {
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java
index 7128b48..e500651 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTerm.java
@@ -27,12 +27,12 @@ import org.eclipse.rdf4j.model.Value;
  * Marker interface for RDF4J implementations of RDFTerm.
  *  
  */
-public interface RDF4JTerm<T extends Value> extends RDFTerm {
+public interface RDF4JTerm extends RDFTerm {
 	
 	/**
 	 * Return the RDF4J {@link Value} that this RDFTerm represents.
 	 * 
 	 * @return The wrapped {@link Value} (e.g. a {@link Literal}, {@link IRI} or {@link BNode}.
 	 */
-	public T asValue();
+	public Value asValue();
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
index 737c53e..543799c 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTermFactory.java
@@ -231,7 +231,7 @@ public final class RDF4JTermFactory implements RDFTermFactory {
 	 * @throws IllegalArgumentException
 	 *             if the value is not a BNode, Literal or IRI
 	 */
-	public <T extends Value> RDF4JTerm<T> asRDFTerm(T value) {
+	public RDF4JTerm asRDFTerm(Value value) {
 		return asRDFTerm(value, salt);
 	}
 	
@@ -260,16 +260,15 @@ public final class RDF4JTermFactory implements RDFTermFactory {
 	 * @throws IllegalArgumentException
 	 *             if the value is not a BNode, Literal or IRI
 	 */
-	@SuppressWarnings("unchecked")
-	public static <T extends Value> RDF4JTerm<T> asRDFTerm(final T value, UUID salt)
{
+	public static RDF4JTerm asRDFTerm(final Value value, UUID salt) {
 		if (value instanceof BNode) {
-			return (RDF4JTerm<T>) rdf4j.createBlankNodeImpl((BNode) value, salt);
+			return rdf4j.createBlankNodeImpl((BNode) value, salt);
 		}
 		if (value instanceof org.eclipse.rdf4j.model.Literal) {
-			return (RDF4JTerm<T>) rdf4j.createLiteralImpl((org.eclipse.rdf4j.model.Literal)
value);
+			return rdf4j.createLiteralImpl((org.eclipse.rdf4j.model.Literal) value);
 		}
 		if (value instanceof org.eclipse.rdf4j.model.IRI) {
-			return (RDF4JTerm<T>) rdf4j.createIRIImpl((org.eclipse.rdf4j.model.IRI) value);
+			return rdf4j.createIRIImpl((org.eclipse.rdf4j.model.IRI) value);
 		}
 		throw new IllegalArgumentException("Value is not a BNode, Literal or IRI: " + value.getClass());
 	}	
@@ -486,7 +485,7 @@ public final class RDF4JTermFactory implements RDFTermFactory {
 		if (term instanceof RDF4JTerm) {
 			// One of our own - avoid converting again.
 			// (This is crucial to avoid double-escaping in BlankNode)
-			return ((RDF4JTerm<?>) term).asValue();
+			return ((RDF4JTerm) term).asValue();
 		}
 		if (term instanceof org.apache.commons.rdf.api.IRI) {
 			org.apache.commons.rdf.api.IRI iri = (org.apache.commons.rdf.api.IRI) term;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java
index 959b46b..17aecf9 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/experimental/RDF4JParser.java
@@ -210,7 +210,7 @@ public class RDF4JParser extends AbstractRDFParser<RDF4JParser>
implements RDFPa
 			if (graph.asRepository().isPresent()) {
 				RDFInserter inserter = new RDFInserter(graph.asRepository().get().getConnection());
 				if (! graph.getContextMask().isEmpty()) {
-					Stream<RDF4JBlankNodeOrIRI<Resource>> b = graph.getContextMask().stream();
+					Stream<RDF4JBlankNodeOrIRI> b = graph.getContextMask().stream();
 					Stream<Resource> c = b.map(RDF4JBlankNodeOrIRI::asValue);
 					Resource[] contexts = c.toArray(Resource[]::new);
 					inserter.enforceContext(contexts);

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java
index 124eb98..b54c715 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRDFTerm.java
@@ -20,7 +20,7 @@ package org.apache.commons.rdf.rdf4j.impl;
 import org.apache.commons.rdf.rdf4j.RDF4JTerm;
 import org.eclipse.rdf4j.model.Value;
 
-abstract class AbstractRDFTerm<T extends Value> implements RDF4JTerm<T> {
+abstract class AbstractRDFTerm<T extends Value> implements RDF4JTerm {
 	T value;
 
 	AbstractRDFTerm(T value) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java
index 17aeccb..a2aaf4b 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/ModelGraphImpl.java
@@ -127,7 +127,7 @@ final class ModelGraphImpl implements RDF4JGraph {
 	}
 	
 	@Override
-	public Set<RDF4JBlankNodeOrIRI<Resource>> getContextMask() {
+	public Set<RDF4JBlankNodeOrIRI> getContextMask() {
 		// ModelGraph always do the unionGraph
 		return Collections.emptySet();
 		// TODO: Should we support contextMask like in RepositoryGraphImpl?

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7f866f02/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.java
index 58eff70..55b909e 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/RepositoryGraphImpl.java
@@ -183,10 +183,10 @@ class RepositoryGraphImpl extends AbstractRepositoryGraphLike<Triple>
implements
 	}
 
 	@Override
-	public Set<RDF4JBlankNodeOrIRI<Resource>> getContextMask() {		
-		Set<RDF4JBlankNodeOrIRI<Resource>> mask = new HashSet<>();
+	public Set<RDF4JBlankNodeOrIRI> getContextMask() {		
+		Set<RDF4JBlankNodeOrIRI> mask = new HashSet<>();
 		for (Resource s : contextMask) {
-			mask.add((RDF4JBlankNodeOrIRI<Resource>) rdf4jTermFactory.asRDFTerm(s));
+			mask.add((RDF4JBlankNodeOrIRI) rdf4jTermFactory.asRDFTerm(s));
 		}
 		return Collections.unmodifiableSet(mask);
 	}


Mime
View raw message