commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [46/50] incubator-commonsrdf git commit: Added JenaGeneralizedQuadLike and JenaGeneralizedTripleLike interfaces
Date Fri, 07 Oct 2016 14:22:59 GMT
Added JenaGeneralizedQuadLike and JenaGeneralizedTripleLike interfaces

to avoid the <Generics> overload in the factory

Also made AbstractQuadLike superclass


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

Branch: refs/heads/master
Commit: 51d7b41176815c708eaaf941692c711d8f8ad903
Parents: b3baff4
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Oct 7 14:47:49 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Oct 7 14:47:49 2016 +0100

----------------------------------------------------------------------
 .../rdf/jena/JenaGeneralizedQuadLike.java       |  37 +++++
 .../rdf/jena/JenaGeneralizedTripleLike.java     |  38 +++++
 .../commons/rdf/jena/JenaRDFTermFactory.java    |   5 +-
 .../commons/rdf/jena/impl/AbstractQuadLike.java | 141 +++++++++++++++++++
 .../commons/rdf/jena/impl/JenaFactory.java      |  18 +--
 .../rdf/jena/impl/JenaGeneralizedQuad.java      | 141 -------------------
 .../jena/impl/JenaGeneralizedQuadLikeImpl.java  |  39 +++++
 .../impl/JenaGeneralizedTripleLikeImpl.java     |  37 +++++
 .../commons/rdf/jena/impl/JenaQuadImpl.java     |   2 +-
 .../commons/rdf/jena/impl/JenaTripleImpl.java   |   2 +-
 10 files changed, 306 insertions(+), 154 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/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
new file mode 100644
index 0000000..272421d
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.java
@@ -0,0 +1,37 @@
+/**
+ * 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.jena;
+
+import org.apache.commons.rdf.api.Quad;
+import org.apache.commons.rdf.api.RDFTerm;
+
+/**
+ * A generalized quad representation.
+ * <p>
+ * A <em>generalized quad</em> is a quad-like object which allow any
+ * {@link RDFTerm} type for its {@link #getSubject()}, {@link #getPredicate()}
+ * {@link #getObject()} and {@link #getGraphName()}. This might be useful with
+ * some serializations like JSON-LD.
+ * <p>
+ * Note that unlike {@link Quad}, this type does not have fixed semantics for
+ * {@link #equals(Object)} or {@link #hashCode()} beyond object identity.
+ * 
+ */
+public interface JenaGeneralizedQuadLike extends JenaQuadLike<RDFTerm, RDFTerm, RDFTerm,
RDFTerm> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/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
new file mode 100644
index 0000000..68e5264
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.java
@@ -0,0 +1,38 @@
+/**
+ * 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.jena;
+
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.commons.rdf.api.Triple;
+
+/**
+ * A generalized triple representation.
+ * <p>
+ * A <em>generalized triple</em> is a triple-like object which allow any
+ * {@link RDFTerm} type for its {@link #getSubject()}, {@link #getPredicate()}
+ * and {@link #getObject()}. This might be useful with some serializations like
+ * JSON-LD.
+ * <p>
+ * Note that unlike {@link Triple}, this type does not have fixed semantics for
+ * {@link #equals(Object)} or {@link #hashCode()} beyond object identity.
+ * 
+ */
+public interface JenaGeneralizedTripleLike
+		extends JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> {
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/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 25db850..4d5c592 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
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.commons.rdf.jena;
 
 import java.util.Optional;
@@ -163,7 +162,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *         does <strong>not</strong> implement {@link Triple#equals(Object)}
 	 *         or {@link Triple#hashCode()}.
 	 */
-	public JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> createGeneralizedTriple(
+	public JenaGeneralizedTripleLike createGeneralizedTriple(
 			RDFTerm subject, RDFTerm predicate, RDFTerm object) {
 		return jenaFactory.createGeneralizedTriple(subject, predicate, object);
 	}
@@ -190,7 +189,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *         <strong>not</strong> implement {@link Quad#equals(Object)} or
 	 *         {@link Quad#hashCode()}.
 	 */
-	public JenaQuadLike<RDFTerm, RDFTerm, RDFTerm, RDFTerm> createGeneralizedQuad(
+	public JenaGeneralizedQuadLike createGeneralizedQuad(
 			RDFTerm subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
 		return jenaFactory.createGeneralizedQuad(subject, predicate, object, graphName);
 	}	

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/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
new file mode 100644
index 0000000..f8451ea
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/AbstractQuadLike.java
@@ -0,0 +1,141 @@
+/**
+ * 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.jena.impl;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.apache.commons.rdf.api.QuadLike;
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.commons.rdf.jena.JenaQuad;
+import org.apache.commons.rdf.jena.JenaQuadLike;
+import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaTriple;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.sparql.core.Quad;
+
+/**
+ * A generalized {@link QuadLike}, backed by a Jena {@link Quad} or {@link Triple}.
+ * <p>
+ * This class does not implement any particular {@link #equals(Object)} or
+ * {@link #hashCode()} but can otherwise be used as a base class for both
+ * a {@link JenaTriple} and a {@link JenaQuad}.
+ * 
+ * @see JenaTripleImpl
+ * @see JenaQuadImpl
+ * @see jenaFactory#createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
+ * @see jenaFactory#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> {
+
+	private static JenaFactory jenaFactory = new JenaFactory(){};
+	
+	final Optional<G> graphName;
+	final S subject;
+	final P predicate;
+	final O object;
+	org.apache.jena.sparql.core.Quad quad = null;
+	org.apache.jena.graph.Triple triple = null;
+	
+	AbstractQuadLike(S subject, P predicate, O object, Optional<G> graphName) {
+		this.subject = Objects.requireNonNull(subject);
+		this.predicate = Objects.requireNonNull(predicate);
+		this.object = Objects.requireNonNull(object);
+		this.graphName = Objects.requireNonNull(graphName);
+	}
+
+	AbstractQuadLike(S subject, P predicate, O object) {
+		this(subject, predicate, object, Optional.empty());
+	}
+	 
+	@SuppressWarnings("unchecked")
+	AbstractQuadLike(org.apache.jena.sparql.core.Quad quad, UUID salt) {
+		this.quad = Objects.requireNonNull(quad);
+		this.subject = (S) jenaFactory.fromJena(quad.getSubject(), salt);
+		this.predicate = (P) jenaFactory.fromJena(quad.getPredicate(), salt);
+		this.object = (O)jenaFactory.fromJena(quad.getObject(), salt);
+		this.graphName = Optional.of((G) jenaFactory.fromJena(quad.getGraph(), salt));		
+	}
+
+	@SuppressWarnings("unchecked")
+	AbstractQuadLike(org.apache.jena.graph.Triple triple, UUID salt) {
+		this.triple = Objects.requireNonNull(triple);		
+		this.subject = (S) jenaFactory.fromJena(triple.getSubject(), salt);
+		this.predicate = (P) jenaFactory.fromJena(triple.getPredicate(), salt);
+		this.object = (O)jenaFactory.fromJena(triple.getObject(), salt);
+		this.graphName = Optional.empty();
+	}
+
+	@Override
+	public org.apache.jena.sparql.core.Quad asJenaQuad() {
+		JenaRDFTermFactory factory = new JenaRDFTermFactory();
+		if (quad == null) {
+			quad = org.apache.jena.sparql.core.Quad.create(
+					factory.toJena(graphName.orElse(null)),
+					factory.toJena(subject), 
+					factory.toJena(predicate),
+					factory.toJena(object));
+		}
+		return quad;
+	}
+
+	@Override
+	public org.apache.jena.graph.Triple asJenaTriple() {
+		JenaRDFTermFactory factory = new JenaRDFTermFactory();
+		if (triple == null) {
+			triple = org.apache.jena.graph.Triple.create(
+				factory.toJena(subject), 
+				factory.toJena(predicate),
+				factory.toJena(object));
+		}
+		return triple;
+	}	
+	
+	@Override
+	public S getSubject() {
+		return subject;
+	}
+
+	@Override
+	public P getPredicate() {
+		return predicate;
+	}
+	
+	@Override
+	public O getObject() {
+		return object;
+	}
+
+	@Override
+	public Optional<G> getGraphName() {
+		return graphName;
+	}
+
+	@Override
+	public String toString() {
+		// kind of nquad syntax
+		return getSubject().ntriplesString() + " " + 
+				getPredicate().ntriplesString() + " "
+				+ getObject().ntriplesString() + " " + 
+				getGraphName().map(RDFTerm::ntriplesString).orElse("") + ".";
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
index 30b96ed..ec15d35 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaFactory.java
@@ -28,6 +28,8 @@ import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.jena.ConversionException;
 import org.apache.commons.rdf.jena.JenaBlankNode;
 import org.apache.commons.rdf.jena.JenaDataset;
+import org.apache.commons.rdf.jena.JenaGeneralizedQuadLike;
+import org.apache.commons.rdf.jena.JenaGeneralizedTripleLike;
 import org.apache.commons.rdf.jena.JenaGraph;
 import org.apache.commons.rdf.jena.JenaIRI;
 import org.apache.commons.rdf.jena.JenaLiteral;
@@ -99,12 +101,12 @@ public abstract class JenaFactory {
 		return new JenaQuadImpl(subject, predicate, object, Optional.ofNullable(graphName));
 	}
 
-	public JenaTripleLike<RDFTerm,RDFTerm,RDFTerm> createGeneralizedTriple(RDFTerm subject,
RDFTerm predicate, RDFTerm object) {
-		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(subject, predicate,
object);
+	public JenaGeneralizedTripleLike createGeneralizedTriple(RDFTerm subject, RDFTerm predicate,
RDFTerm object) {
+		return new JenaGeneralizedTripleLikeImpl(subject, predicate, object);
 	}
 
-	public JenaQuadLike<RDFTerm,RDFTerm,RDFTerm,RDFTerm> createGeneralizedQuad(RDFTerm
subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
-		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(subject, predicate,
object, Optional.ofNullable(graphName));
+	public JenaGeneralizedQuadLike createGeneralizedQuad(RDFTerm subject, RDFTerm predicate,
RDFTerm object, RDFTerm graphName) {
+		return new JenaGeneralizedQuadLikeImpl(subject, predicate, object, Optional.ofNullable(graphName));
 	}
 	
 	public JenaRDFTerm fromJena(Node node, UUID salt) throws ConversionException {
@@ -147,12 +149,12 @@ public abstract class JenaFactory {
 		return new JenaTripleImpl(triple, salt);
 	}
 
-	public JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> fromJenaGeneralized(org.apache.jena.graph.Triple
triple, UUID salt) {
-		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(triple, salt);
+	public JenaGeneralizedTripleLike fromJenaGeneralized(org.apache.jena.graph.Triple triple,
UUID salt) {
+		return new JenaGeneralizedTripleLikeImpl(triple, salt);
 	}
 
-	public JenaQuadLike<RDFTerm,RDFTerm,RDFTerm,RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad
quad, UUID salt) {
-		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(quad, salt);
+	public JenaGeneralizedQuadLike fromJenaGeneralized(org.apache.jena.sparql.core.Quad quad,
UUID salt) {
+		return new JenaGeneralizedQuadLikeImpl(quad, salt);
 	}
 	
 	public JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad, UUID salt) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuad.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuad.java
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuad.java
deleted file mode 100644
index 607defd..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuad.java
+++ /dev/null
@@ -1,141 +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.jena.impl;
-
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
-
-import org.apache.commons.rdf.api.QuadLike;
-import org.apache.commons.rdf.api.RDFTerm;
-import org.apache.commons.rdf.jena.JenaQuad;
-import org.apache.commons.rdf.jena.JenaQuadLike;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
-import org.apache.commons.rdf.jena.JenaTriple;
-import org.apache.jena.graph.Triple;
-import org.apache.jena.sparql.core.Quad;
-
-/**
- * A generalized {@link QuadLike}, backed by a Jena {@link Quad} or {@link Triple}.
- * <p>
- * This class does not implement any particular {@link #equals(Object)} or
- * {@link #hashCode()} but can otherwise be used as a base class for both
- * a {@link JenaTriple} and a {@link JenaQuad}.
- * 
- * @see JenaTripleImpl
- * @see JenaQuadImpl
- * @see jenaFactory#createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
- * @see jenaFactory#createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
- *
- */
-class JenaGeneralizedQuad<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm, G extends
RDFTerm> implements JenaQuadLike<S,P,O,G> {
-
-	private static JenaFactory jenaFactory = new JenaFactory(){};
-	
-	final Optional<G> graphName;
-	final S subject;
-	final P predicate;
-	final O object;
-	org.apache.jena.sparql.core.Quad quad = null;
-	org.apache.jena.graph.Triple triple = null;
-	
-	JenaGeneralizedQuad(S subject, P predicate, O object, Optional<G> graphName) {
-		this.subject = Objects.requireNonNull(subject);
-		this.predicate = Objects.requireNonNull(predicate);
-		this.object = Objects.requireNonNull(object);
-		this.graphName = Objects.requireNonNull(graphName);
-	}
-
-	JenaGeneralizedQuad(S subject, P predicate, O object) {
-		this(subject, predicate, object, Optional.empty());
-	}
-	 
-	@SuppressWarnings("unchecked")
-	JenaGeneralizedQuad(org.apache.jena.sparql.core.Quad quad, UUID salt) {
-		this.quad = Objects.requireNonNull(quad);
-		this.subject = (S) jenaFactory.fromJena(quad.getSubject(), salt);
-		this.predicate = (P) jenaFactory.fromJena(quad.getPredicate(), salt);
-		this.object = (O)jenaFactory.fromJena(quad.getObject(), salt);
-		this.graphName = Optional.of((G) jenaFactory.fromJena(quad.getGraph(), salt));		
-	}
-
-	@SuppressWarnings("unchecked")
-	JenaGeneralizedQuad(org.apache.jena.graph.Triple triple, UUID salt) {
-		this.triple = Objects.requireNonNull(triple);		
-		this.subject = (S) jenaFactory.fromJena(triple.getSubject(), salt);
-		this.predicate = (P) jenaFactory.fromJena(triple.getPredicate(), salt);
-		this.object = (O)jenaFactory.fromJena(triple.getObject(), salt);
-		this.graphName = Optional.empty();
-	}
-
-	@Override
-	public org.apache.jena.sparql.core.Quad asJenaQuad() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory();
-		if (quad == null) {
-			quad = org.apache.jena.sparql.core.Quad.create(
-					factory.toJena(graphName.orElse(null)),
-					factory.toJena(subject), 
-					factory.toJena(predicate),
-					factory.toJena(object));
-		}
-		return quad;
-	}
-
-	@Override
-	public org.apache.jena.graph.Triple asJenaTriple() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory();
-		if (triple == null) {
-			triple = org.apache.jena.graph.Triple.create(
-				factory.toJena(subject), 
-				factory.toJena(predicate),
-				factory.toJena(object));
-		}
-		return triple;
-	}	
-	
-	@Override
-	public S getSubject() {
-		return subject;
-	}
-
-	@Override
-	public P getPredicate() {
-		return predicate;
-	}
-	
-	@Override
-	public O getObject() {
-		return object;
-	}
-
-	@Override
-	public Optional<G> getGraphName() {
-		return graphName;
-	}
-
-	@Override
-	public String toString() {
-		// kind of nquad syntax
-		return getSubject().ntriplesString() + " " + 
-				getPredicate().ntriplesString() + " "
-				+ getObject().ntriplesString() + " " + 
-				getGraphName().map(RDFTerm::ntriplesString).orElse("") + ".";
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuadLikeImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuadLikeImpl.java
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuadLikeImpl.java
new file mode 100644
index 0000000..df74900
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedQuadLikeImpl.java
@@ -0,0 +1,39 @@
+/**
+ * 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.jena.impl;
+
+import java.util.Optional;
+import java.util.UUID;
+
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.commons.rdf.jena.JenaGeneralizedQuadLike;
+import org.apache.jena.sparql.core.Quad;
+
+class JenaGeneralizedQuadLikeImpl extends AbstractQuadLike<RDFTerm, RDFTerm, RDFTerm,
RDFTerm>
+	implements JenaGeneralizedQuadLike {
+
+	JenaGeneralizedQuadLikeImpl(RDFTerm subject, RDFTerm predicate, RDFTerm object,
+			Optional<RDFTerm> ofNullable) {
+		super(subject, predicate, object, ofNullable);
+	}
+
+	JenaGeneralizedQuadLikeImpl(Quad quad, UUID salt) {
+		super(quad, salt);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedTripleLikeImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedTripleLikeImpl.java
b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedTripleLikeImpl.java
new file mode 100644
index 0000000..ecaa46a
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGeneralizedTripleLikeImpl.java
@@ -0,0 +1,37 @@
+/**
+ * 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.jena.impl;
+
+import java.util.UUID;
+
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.commons.rdf.jena.JenaGeneralizedTripleLike;
+import org.apache.jena.graph.Triple;
+
+class JenaGeneralizedTripleLikeImpl extends AbstractQuadLike<RDFTerm, RDFTerm, RDFTerm,
RDFTerm>
+	implements JenaGeneralizedTripleLike {
+
+	JenaGeneralizedTripleLikeImpl(RDFTerm subject, RDFTerm predicate, RDFTerm object) {
+		super(subject, predicate, object);
+	}
+
+	JenaGeneralizedTripleLikeImpl(Triple triple, UUID salt) {
+		super(triple, salt);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
index 9d65374..61ddf9b 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaQuadImpl.java
@@ -29,7 +29,7 @@ import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.jena.ConversionException;
 import org.apache.commons.rdf.jena.JenaQuad;
 
-class JenaQuadImpl	extends JenaGeneralizedQuad<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI>
+class JenaQuadImpl	extends AbstractQuadLike<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI>
 	implements JenaQuad {
 
 	JenaQuadImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object, Optional<BlankNodeOrIRI>
graphName) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/51d7b411/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
index 502b575..453300c 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaTripleImpl.java
@@ -28,7 +28,7 @@ import org.apache.commons.rdf.api.Triple;
 import org.apache.commons.rdf.jena.ConversionException;
 import org.apache.commons.rdf.jena.JenaTriple;
 
-class JenaTripleImpl extends JenaGeneralizedQuad<BlankNodeOrIRI, IRI, RDFTerm, RDFTerm>
+class JenaTripleImpl extends AbstractQuadLike<BlankNodeOrIRI, IRI, RDFTerm, RDFTerm>
 		implements JenaTriple {
 
 	JenaTripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {


Mime
View raw message