commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [5/8] incubator-commonsrdf git commit: COMMONSRDF-42 Avoid generics in TripleLike
Date Fri, 14 Oct 2016 12:17:51 GMT
COMMONSRDF-42 Avoid generics in TripleLike

.. and almost avoid it in QuadLike


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

Branch: refs/heads/master
Commit: 6e694fce7ee092a66c0b8599d3193567d1ad989b
Parents: 8560610
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Oct 14 13:09:31 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Oct 14 13:09:31 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/rdf/api/Dataset.java   |  2 +-
 .../java/org/apache/commons/rdf/api/Graph.java     |  2 +-
 .../java/org/apache/commons/rdf/api/GraphLike.java |  9 +--------
 .../main/java/org/apache/commons/rdf/api/Quad.java |  2 +-
 .../java/org/apache/commons/rdf/api/QuadLike.java  | 16 ++--------------
 .../java/org/apache/commons/rdf/api/Triple.java    |  2 +-
 .../org/apache/commons/rdf/api/TripleLike.java     | 17 +++++------------
 .../commons/rdf/jena/JenaGeneralizedQuadLike.java  |  2 +-
 .../rdf/jena/JenaGeneralizedTripleLike.java        |  2 +-
 .../java/org/apache/commons/rdf/jena/JenaQuad.java |  4 +---
 .../org/apache/commons/rdf/jena/JenaQuadLike.java  |  4 ++--
 .../commons/rdf/jena/JenaRDFTermFactory.java       |  8 ++++----
 .../org/apache/commons/rdf/jena/JenaTriple.java    |  6 +-----
 .../apache/commons/rdf/jena/JenaTripleLike.java    |  4 ++--
 .../rdf/jena/experimental/JenaRDFParser.java       |  8 ++++----
 .../commons/rdf/jena/impl/AbstractQuadLike.java    |  2 +-
 .../apache/commons/rdf/jsonldjava/JsonLdGraph.java |  4 ++--
 .../commons/rdf/jsonldjava/JsonLdGraphLike.java    | 10 ++++++----
 .../apache/commons/rdf/jsonldjava/JsonLdQuad.java  | 10 +---------
 .../commons/rdf/jsonldjava/JsonLdQuadLike.java     |  5 ++---
 .../commons/rdf/jsonldjava/JsonLdTriple.java       |  9 ++-------
 .../commons/rdf/jsonldjava/JsonLdTripleLike.java   | 16 ++++++++++++++++
 .../apache/commons/rdf/rdf4j/RDF4JGraphLike.java   |  7 ++-----
 .../apache/commons/rdf/rdf4j/RDF4JTermFactory.java |  2 +-
 .../apache/commons/rdf/rdf4j/RDF4JTripleLike.java  |  5 +----
 .../rdf4j/impl/AbstractRepositoryGraphLike.java    |  5 +----
 src/site/markdown/userguide.md                     | 13 +++++++++++++
 27 files changed, 76 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Dataset.java b/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
index c809bc9..3b602d3 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
@@ -28,7 +28,7 @@ import java.util.stream.Stream;
  * <a href="http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1 Concepts and Abstract
  * Syntax</a>, a W3C Recommendation published on 25 February 2014.
  */
-public interface Dataset extends AutoCloseable, GraphLike<Quad, BlankNodeOrIRI, IRI, RDFTerm>
{
+public interface Dataset extends AutoCloseable, GraphLike<Quad> {
 
 	/**
 	 * Add a quad to the dataset, possibly mapping any of the components of the

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Graph.java b/api/src/main/java/org/apache/commons/rdf/api/Graph.java
index 7340e86..ff78ec3 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Graph.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Graph.java
@@ -27,7 +27,7 @@ import java.util.stream.Stream;
  * href="http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1 Concepts and Abstract
  * Syntax</a>, a W3C Recommendation published on 25 February 2014.
  */
-public interface Graph extends AutoCloseable,GraphLike<Triple, BlankNodeOrIRI, IRI, RDFTerm>
{
+public interface Graph extends AutoCloseable,GraphLike<Triple> {
 
     /**
      * Add a triple to the graph, possibly mapping any of the components of the

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java b/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
index f8d052f..0f73c4e 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
@@ -39,20 +39,13 @@ import java.util.stream.Stream;
  * @param <T>
  *            A {@link TripleLike} type used by the graph methods, typically
  *            {@link Triple} or {@link Quad}
- * @param <S>
- *            The type of subjects in the statements, typically
- *            {@link BlankNodeOrIRI}
- * @param <P>
- *            The type of predicates in the statements, typically {@link IRI}
- * @param <O>
- *            The type of objects in the statements, typically {@link RDFTerm}
  *            
  * @since 0.3.0-incubating
  * @see Graph
  * @see Dataset
  * @see TripleLike
  */
-public interface GraphLike<T extends TripleLike<S, P, O>, S extends RDFTerm, P extends
RDFTerm, O extends RDFTerm> {
+public interface GraphLike<T extends TripleLike> {
 
 	/**
 	 * Add a statement.

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/Quad.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Quad.java b/api/src/main/java/org/apache/commons/rdf/api/Quad.java
index d52a3c3..6ce9a95 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Quad.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Quad.java
@@ -35,7 +35,7 @@ import java.util.Optional;
  *      1.1: On Semantics of RDF Datasets</a>
  * @see <a href="http://www.w3.org/TR/rdf11-concepts/#section-dataset"> </a>
  */
-public interface Quad extends QuadLike<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI> {
+public interface Quad extends QuadLike<BlankNodeOrIRI> {
 
 	/**
 	 * The graph name (graph label) of this quad, if present.

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
index 8de180a..9eaa5dc 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
@@ -31,25 +31,13 @@ import java.util.Optional;
  * (e.g. a {@link BlankNode} as predicate).
  * <p>
  * Implementations should specialise which specific {@link RDFTerm} types they
- * return for {@link #getSubject()}, {@link #getPredicate()},
+ * return by overriding {@link #getSubject()}, {@link #getPredicate()},
  * {@link #getObject()} and {@link #getGraphName()}.
  *
- * @param <S>
- *            The type of subjects in the statements, typically
- *            {@link BlankNodeOrIRI}
- * @param <P>
- *            The type of predicates in the statements, typically {@link IRI}
- * @param <O>
- *            The type of objects in the statements, typically {@link RDFTerm}
- * @param <G>
- *            The type of graph names in the statements, typically
- *            {@link BlankNodeOrIRI}
- * 
  * @since 0.3.0-incubating
  * @see Quad
  */
-public interface QuadLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm, G extends
RDFTerm>
-		extends TripleLike<S, P, O> {
+public interface QuadLike<G extends RDFTerm> extends TripleLike {
 
 	/**
 	 * The graph name (graph label) of this statement, if present.

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Triple.java b/api/src/main/java/org/apache/commons/rdf/api/Triple.java
index 9375983..9e7f140 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Triple.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Triple.java
@@ -30,7 +30,7 @@ import java.util.Objects;
  * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" >RDF-1.1
  * Triple</a>
  */
-public interface Triple extends TripleLike<BlankNodeOrIRI, IRI, RDFTerm> {
+public interface Triple extends TripleLike {
 
     /**
      * The subject of this triple, which may be either a {@link BlankNode} or an

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java
index 55d0380..30e303a 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java
@@ -29,37 +29,30 @@ package org.apache.commons.rdf.api;
  * used for <em>generalised triples</em> (e.g. a {@link BlankNode} as predicate).
  * <p>
  * Implementations should specialise which specific {@link RDFTerm} types they
- * return for {@link #getSubject()}, {@link #getPredicate()} and
+ * return by overriding {@link #getSubject()}, {@link #getPredicate()} and
  * {@link #getObject()}.
  * 
- * @param <S>
- *            The type of subjects in the statements, typically
- *            {@link BlankNodeOrIRI}
- * @param <P>
- *            The type of predicates in the statements, typically {@link IRI}
- * @param <O>
- *            The type of objects in the statements, typically {@link RDFTerm}
  * 
  * @since 0.3.0-incubating
  * @see Triple
  * @see Quad
  * @see QuadLike
  */
-public interface TripleLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm>
{
+public interface TripleLike {
 
 	/**
 	 * The subject of this statement.
 	 *
 	 * @return The subject, typically an {@link IRI} or {@link BlankNode}.
 	 */
-	S getSubject();
+	RDFTerm getSubject();
 
 	/**
 	 * The predicate of this statement.
 	 *
 	 * @return The predicate, typically an {@link IRI}.
 	 */
-	P getPredicate();
+	RDFTerm getPredicate();
 
 	/**
 	 * The object of this statement.
@@ -67,5 +60,5 @@ public interface TripleLike<S extends RDFTerm, P extends RDFTerm, O extends
RDFT
 	 * @return The object, typically an {@link IRI}, {@link BlankNode} or
 	 *         {@link Literal}.
 	 */
-	O getObject();
+	RDFTerm getObject();
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java
index 49e1fe9..a73d92c 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java
@@ -34,5 +34,5 @@ import org.apache.commons.rdf.api.RDFTerm;
  * 
  * @see JenaGeneralizedTripleLike
  */
-public interface JenaGeneralizedQuadLike extends JenaQuadLike<RDFTerm, RDFTerm, RDFTerm,
RDFTerm> {
+public interface JenaGeneralizedQuadLike extends JenaQuadLike<RDFTerm> {
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
index 546089f..634d05c 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
@@ -35,5 +35,5 @@ import org.apache.commons.rdf.api.Triple;
  * @see JenaGeneralizedQuadLike
  */
 public interface JenaGeneralizedTripleLike
-		extends JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> {	
+		extends JenaTripleLike {	
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java
index b593263..fffbef7 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuad.java
@@ -18,8 +18,6 @@
 package org.apache.commons.rdf.jena;
 
 import org.apache.commons.rdf.api.BlankNodeOrIRI;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFTerm;
 
 /** 
  * A Jena-backed {@link org.apache.commons.rdf.api.Quad}.
@@ -28,5 +26,5 @@ import org.apache.commons.rdf.api.RDFTerm;
  * can be accessed with {@link #asJenaQuad()}.
  */
 public interface JenaQuad extends org.apache.commons.rdf.api.Quad, 
-	JenaQuadLike<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI> {	
+	JenaQuadLike<BlankNodeOrIRI> {	
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java
index e21e670..2e869c3 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaQuadLike.java
@@ -32,8 +32,8 @@ import org.apache.jena.sparql.core.Quad;
  * @see JenaGeneralizedQuadLike
  * 
  */
-public interface JenaQuadLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm,
G extends RDFTerm> 
-	extends JenaTripleLike<S,P,O>, QuadLike<S,P,O,G> {
+public interface JenaQuadLike<G extends RDFTerm> 
+	extends JenaTripleLike, QuadLike<G> {
 
 	/**
 	 * Return the adapted Jena quad

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
index 0cc84c0..a4db1bf 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
@@ -303,7 +303,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @throws ConversionException
 	 *             if any of the triple's nodes are not concrete
 	 */
-	public JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> fromJenaGeneralized(org.apache.jena.graph.Triple
triple) throws ConversionException {
+	public JenaTripleLike fromJenaGeneralized(org.apache.jena.graph.Triple triple) throws ConversionException
{
 		return internalJenaFactory.fromJenaGeneralized(triple, getSalt());
 	}
 
@@ -333,7 +333,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @throws ConversionException
 	 *             if any of the quad nodes are not concrete
 	 */
-	public JenaQuadLike<RDFTerm, RDFTerm, RDFTerm, RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad
quad) throws ConversionException {
+	public JenaQuadLike<RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad
quad) throws ConversionException {
 		return internalJenaFactory.fromJenaGeneralized(quad, getSalt());
 	}
 	
@@ -567,7 +567,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return A {@link StreamRDF} that will stream generalized triples to the
 	 *         consumer
 	 */
-	public StreamRDF streamJenaToGeneralizedTriple(Consumer<TripleLike<RDFTerm, RDFTerm,
RDFTerm>> generalizedConsumer) {
+	public StreamRDF streamJenaToGeneralizedTriple(Consumer<TripleLike> generalizedConsumer)
{
 		return new StreamRDFBase() {			
 			@Override
 			public void triple(org.apache.jena.graph.Triple triple) {
@@ -592,7 +592,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return A {@link StreamRDF} that will stream generalized quads to the
 	 *         consumer
 	 */
-	public StreamRDF streamJenaToGeneralizedQuad(Consumer<QuadLike<RDFTerm, RDFTerm, RDFTerm,
RDFTerm>> generalizedConsumer) {
+	public StreamRDF streamJenaToGeneralizedQuad(Consumer<QuadLike<RDFTerm>> generalizedConsumer)
{
 		return new StreamRDFBase() {
 			@Override
 			public void quad(org.apache.jena.sparql.core.Quad quad) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java
index d39bec7..09fe76d 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaTriple.java
@@ -17,15 +17,11 @@
  */
 package org.apache.commons.rdf.jena;
 
-import org.apache.commons.rdf.api.BlankNodeOrIRI;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFTerm;
-
 /** 
  * A Jena-backed {@link org.apache.commons.rdf.api.Triple}.
  * <p>
  * The underlying Jena {@link org.apache.jena.graph.Triple}
  * can be accessed with {@link #asJenaTriple()}.
  */
-public interface JenaTriple extends org.apache.commons.rdf.api.Triple, JenaTripleLike<BlankNodeOrIRI,
IRI, RDFTerm> {
+public interface JenaTriple extends org.apache.commons.rdf.api.Triple, JenaTripleLike {
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.java
index 8821c51..abaec21 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaTripleLike.java
@@ -35,8 +35,8 @@ import org.apache.jena.graph.Triple;
  * @see JenaGeneralizedQuadLike
  * 
  */
-public interface JenaTripleLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm>

-	extends org.apache.commons.rdf.api.TripleLike<S,P,O> {
+public interface JenaTripleLike 
+	extends org.apache.commons.rdf.api.TripleLike {
 
 	/**
 	 * Return the adapted Jena triple

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java
b/jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java
index 0ad12b9..89d2884 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/experimental/JenaRDFParser.java
@@ -40,21 +40,21 @@ import org.apache.jena.riot.system.StreamRDFLib;
 
 public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> implements RDFParser
{
 
-	private Consumer<TripleLike<RDFTerm, RDFTerm, RDFTerm>> generalizedConsumerTriple;
-	private Consumer<QuadLike<RDFTerm, RDFTerm, RDFTerm, RDFTerm>> generalizedConsumerQuad;
+	private Consumer<TripleLike> generalizedConsumerTriple;
+	private Consumer<QuadLike<RDFTerm>> generalizedConsumerQuad;
 
 	protected RDFTermFactory createRDFTermFactory() {
 		return new JenaRDFTermFactory();
 	}
 
-	public JenaRDFParser targetGeneralizedTriple(Consumer<TripleLike<RDFTerm,RDFTerm,RDFTerm>>
consumer) {
+	public JenaRDFParser targetGeneralizedTriple(Consumer<TripleLike> consumer) {
 		JenaRDFParser c = this.clone();
 		c.resetTarget();		
 		c.generalizedConsumerTriple = consumer;
 		return c;
 	}
 
-	public JenaRDFParser targetGeneralizedQuad(Consumer<QuadLike<RDFTerm,RDFTerm,RDFTerm,RDFTerm>>
consumer) {
+	public JenaRDFParser targetGeneralizedQuad(Consumer<QuadLike<RDFTerm>> consumer)
{
 		JenaRDFParser c = this.clone();
 		c.resetTarget();		
 		c.generalizedConsumerQuad = consumer;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java
index dd0d384..1846fc0 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java
@@ -44,7 +44,7 @@ import org.apache.jena.sparql.core.Quad;
  * @see internalJenaFactory#createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
  *
  */
-abstract class AbstractQuadLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm,
G extends RDFTerm> implements JenaQuadLike<S,P,O,G> {
+abstract class AbstractQuadLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm,
G extends RDFTerm> implements JenaQuadLike<G> {
 
 	private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory(){};
 	

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.java
index 0a59cc3..1acba7d 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraph.java
@@ -34,10 +34,10 @@ import com.github.jsonldjava.core.RDFDataset;
  * A {@link Graph} view of a JsonLd {@link RDFDataset}.
  * 
  */
-public interface JsonLdGraph extends JsonLdGraphLike<org.apache.commons.rdf.api.Triple>,
Graph {
+public interface JsonLdGraph extends JsonLdGraphLike<Triple>, Graph {
 }
 
-class JsonLdGraphImpl extends AbstractJsonLdGraphLike<org.apache.commons.rdf.api.Triple>

+class JsonLdGraphImpl extends AbstractJsonLdGraphLike<Triple> 
 	implements JsonLdGraph {
 
 	private final Optional<BlankNodeOrIRI> graphName;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.java
index 1e3df61..579a03a 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdGraphLike.java
@@ -46,8 +46,8 @@ import com.github.jsonldjava.core.RDFDataset.Node;
  *            specialisation of {@link TripleLike}, e.g. {@link Triple} or
  *            {@link org.apache.commons.rdf.api.Quad}
  */
-public interface JsonLdGraphLike <T extends TripleLike<BlankNodeOrIRI, IRI, RDFTerm>>
-	extends GraphLike<T, BlankNodeOrIRI, IRI, RDFTerm> {
+public interface JsonLdGraphLike <T extends TripleLike>
+	extends GraphLike<T> {
 	/**
 	 * Return the underlying JSONLD-Java {@link RDFDataset}.
 	 * <p>
@@ -59,7 +59,7 @@ public interface JsonLdGraphLike <T extends TripleLike<BlankNodeOrIRI,
IRI, RDFT
 	public RDFDataset getRdfDataSet();
 }
 
-abstract class AbstractJsonLdGraphLike<T extends TripleLike<BlankNodeOrIRI, IRI, RDFTerm>>
+abstract class AbstractJsonLdGraphLike<T extends TripleLike>
 	implements JsonLdGraphLike<T> {
 	
 	/** 
@@ -104,7 +104,9 @@ abstract class AbstractJsonLdGraphLike<T extends TripleLike<BlankNodeOrIRI,
IRI,
 			org.apache.commons.rdf.api.Quad q = (org.apache.commons.rdf.api.Quad)t;
 			graphName = q.getGraphName().orElse(null);
 		}
-		add(graphName, t.getSubject(), t.getPredicate(), t.getObject());
+		// FIXME: JSON-LD's rdfDataSet.addQuad method does not support 
+		// generalized RDF, so we have to do a naive cast here
+		add(graphName, (BlankNodeOrIRI)t.getSubject(), (IRI)t.getPredicate(), t.getObject());
 	}	
 
 	void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
{

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.java b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.java
index d9a26b3..fcf71f1 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuad.java
@@ -24,15 +24,7 @@ import org.apache.commons.rdf.api.IRI;
 import org.apache.commons.rdf.api.RDFTerm;
 // Note: To avoid confusion - don't import either Quad
 
-public interface JsonLdQuad extends org.apache.commons.rdf.api.Quad {
-
-	
-	/**
-	 * Return the underlying JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 * 
-	 * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 */
-	public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad();
+public interface JsonLdQuad extends org.apache.commons.rdf.api.Quad, JsonLdTripleLike {
 
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java
index 12fb95d..bd9d472 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdQuadLike.java
@@ -24,12 +24,11 @@ import org.apache.commons.rdf.api.RDFTerm;
 
 import com.github.jsonldjava.core.RDFDataset.Quad;
 
-public interface JsonLdQuadLike<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm,
G extends RDFTerm> extends QuadLike<S,P,O,G> {
+public interface JsonLdQuadLike<G extends RDFTerm> extends QuadLike<G>, JsonLdTripleLike
{
 	
-	public Quad asJsonLdQuad();
 }
 	
-	class JsonLdQuadLikeImpl<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm, G extends
RDFTerm> implements JsonLdQuadLike<S,P,O,G> {
+	class JsonLdQuadLikeImpl<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm, G extends
RDFTerm> implements JsonLdQuadLike<G> {
 		
 		// Note: We always pass the blankNodePrefix and don't rely on the internal
 		// blankNodePrefix in this static factory

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
index 68fe9c0..906e240 100644
--- a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTriple.java
@@ -26,14 +26,9 @@ import org.apache.commons.rdf.api.Triple;
 
 import com.github.jsonldjava.core.RDFDataset.Quad;
 
-public interface JsonLdTriple extends Triple {
+public interface JsonLdTriple extends Triple, JsonLdTripleLike {
+
 
-	/**
-	 * Return the underlying JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 * 
-	 * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
-	 */
-	public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad();
 }
 	
 	final class JsonLdTripleImpl extends JsonLdQuadLikeImpl<BlankNodeOrIRI, IRI, RDFTerm,
RDFTerm>

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
new file mode 100644
index 0000000..1b606b0
--- /dev/null
+++ b/jsonld-java/src/main/java/org/apache/commons/rdf/jsonldjava/JsonLdTripleLike.java
@@ -0,0 +1,16 @@
+package org.apache.commons.rdf.jsonldjava;
+
+import org.apache.commons.rdf.api.BlankNodeOrIRI;
+import org.apache.commons.rdf.api.IRI;
+import org.apache.commons.rdf.api.TripleLike;
+
+public interface JsonLdTripleLike extends TripleLike {
+
+	/**
+	 * Return the underlying JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
+	 * 
+	 * @return The JsonLD {@link com.github.jsonldjava.core.RDFDataset.Quad}
+	 */
+	public com.github.jsonldjava.core.RDFDataset.Quad asJsonLdQuad();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java
index 3b781e0..430369a 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JGraphLike.java
@@ -19,10 +19,7 @@ package org.apache.commons.rdf.rdf4j;
 
 import java.util.Optional;
 
-import org.apache.commons.rdf.api.BlankNodeOrIRI;
 import org.apache.commons.rdf.api.GraphLike;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.api.TripleLike;
 import org.eclipse.rdf4j.model.Model;
 import org.eclipse.rdf4j.repository.Repository;
@@ -40,8 +37,8 @@ import org.eclipse.rdf4j.repository.Repository;
  * @see RDF4JDataset
  * @see RDF4JGraph
  */
-public interface RDF4JGraphLike<T extends TripleLike<BlankNodeOrIRI, IRI, RDFTerm>>
-		extends GraphLike<T, BlankNodeOrIRI, IRI, RDFTerm>, AutoCloseable {
+public interface RDF4JGraphLike<T extends TripleLike>
+		extends GraphLike<T>, AutoCloseable {
 
 	/**
 	 * Return the corresponding RDF4J {@link Model}, if present.

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/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 c29b0c4..c503077 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
@@ -408,7 +408,7 @@ public final class RDF4JTermFactory implements RDFTermFactory {
 	 *            A {@link Triple} or {@link Quad} to adapt
 	 * @return A corresponding {@link Statement}
 	 */
-	public Statement asStatement(TripleLike<BlankNodeOrIRI, org.apache.commons.rdf.api.IRI,
RDFTerm> tripleLike) {
+	public Statement asStatement(TripleLike tripleLike) {
 		if (tripleLike instanceof RDF4JTripleLike) {
 			// Return original statement - this covers both RDF4JQuad and
 			// RDF4JTriple

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTripleLike.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTripleLike.java b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTripleLike.java
index a4e40c9..e204e77 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTripleLike.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/RDF4JTripleLike.java
@@ -17,9 +17,6 @@
  */
 package org.apache.commons.rdf.rdf4j;
 
-import org.apache.commons.rdf.api.BlankNodeOrIRI;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.api.TripleLike;
 import org.eclipse.rdf4j.model.Statement;
 
@@ -34,7 +31,7 @@ import org.eclipse.rdf4j.model.Statement;
  * @see RDF4JTriple
  * @see RDF4JQuad
  */
-public interface RDF4JTripleLike extends TripleLike<BlankNodeOrIRI, IRI, RDFTerm> {
+public interface RDF4JTripleLike extends TripleLike {
 	
 	/**
 	 * Return the corresponding RDF4J {@link Statement}.

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.java
b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.java
index 6a1aae6..00388b9 100644
--- a/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.java
+++ b/rdf4j/src/main/java/org/apache/commons/rdf/rdf4j/impl/AbstractRepositoryGraphLike.java
@@ -20,9 +20,6 @@ package org.apache.commons.rdf.rdf4j.impl;
 import java.util.Optional;
 import java.util.UUID;
 
-import org.apache.commons.rdf.api.BlankNodeOrIRI;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.api.TripleLike;
 import org.apache.commons.rdf.rdf4j.RDF4JGraphLike;
 import org.apache.commons.rdf.rdf4j.RDF4JTermFactory;
@@ -31,7 +28,7 @@ import org.eclipse.rdf4j.model.Statement;
 import org.eclipse.rdf4j.repository.Repository;
 import org.eclipse.rdf4j.repository.RepositoryConnection;
 
-abstract class AbstractRepositoryGraphLike<T extends TripleLike<BlankNodeOrIRI, IRI,
RDFTerm>>
+abstract class AbstractRepositoryGraphLike<T extends TripleLike>
 		implements RDF4JGraphLike<T> {
 
 	protected final Repository repository;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/6e694fce/src/site/markdown/userguide.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/userguide.md b/src/site/markdown/userguide.md
index ab59292..33ca66a 100644
--- a/src/site/markdown/userguide.md
+++ b/src/site/markdown/userguide.md
@@ -40,6 +40,7 @@ Commons RDF [API](apidocs/).
             * [Types](#Types)
         * [Language](#Language)
 * [Triple](#Triple)
+* [Quad](#Quad)
 * [Graph](#Graph)
     * [Adding triples](#Adding_triples)
     * [Finding triples](#Finding_triples)
@@ -685,6 +686,18 @@ specified _equality semantics_ for
 [Literals](apidocs/org/apache/commons/rdf/api/Literal.html#equals-java.lang.Object-)
 and even [BlankNodes](apidocs/org/apache/commons/rdf/api/BlankNode.html#equals-java.lang.Object-).
 
+## Quad
+A _quad_ is a triple with an associated _graph name_, and can be a statement in a
+[dataset](http://www.w3.org/TR/rdf11-concepts/#section-dataset).
+
+Commons RDF represents such statements using the class [Quad](apidocs/org/apache/commons/rdf/api/Quad.html),
which consists of:
+
+* The [subject](apidocs/org/apache/commons/rdf/api/Quad.html#getSubject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html)
or a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html)
+* The [predicate](apidocs/org/apache/commons/rdf/api/Quad.html#getPredicate--), which is
an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html)
+* The [object](apidocs/org/apache/commons/rdf/api/Quad.html#getObject--), which is an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html),
a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html) or a [Literal](apidocs/org/apache/commons/rdf/api/Literal.html)
+* The [graph name](apidocs/org/apache/commons/rdf/api/Quad.html#getGraphName--), which is
an [IRI](apidocs/org/apache/commons/rdf/api/IRI.html) or a [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html);
wrapped as an `java.util.Optional`
+
+The graph name is represented as an [Optional](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html?is-external=true),
where `Optional.empty()` indicates that the quad is in the [default graph](https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph)
 
 ## Graph
 



Mime
View raw message