commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [7/8] incubator-commonsrdf git commit: reduce visibility of JenaFactory and impl
Date Fri, 07 Oct 2016 13:48:25 GMT
reduce visibility of JenaFactory and impl


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

Branch: refs/heads/jena
Commit: b3baff420a91eb24e081e423d7a21f2e9344f7cc
Parents: a072cb9
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Oct 7 14:33:33 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Oct 7 14:33:33 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/jena/JenaRDFTermFactory.java    | 44 ++++++++--------
 .../rdf/jena/impl/JenaBlankNodeImpl.java        |  4 +-
 .../commons/rdf/jena/impl/JenaDatasetImpl.java  |  4 +-
 .../commons/rdf/jena/impl/JenaFactory.java      | 53 ++++++++++----------
 .../rdf/jena/impl/JenaGeneralizedQuad.java      | 24 +++++----
 .../commons/rdf/jena/impl/JenaGraphImpl.java    |  2 +-
 .../commons/rdf/jena/impl/JenaIRIImpl.java      |  6 +--
 .../commons/rdf/jena/impl/JenaLiteralImpl.java  |  8 +--
 .../commons/rdf/jena/impl/JenaQuadImpl.java     |  2 +-
 .../commons/rdf/jena/impl/JenaTripleImpl.java   |  2 +-
 .../commons/rdf/jena/TestBlankNodeJena.java     |  6 ++-
 11 files changed, 82 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/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 8b53c76..25db850 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
@@ -61,6 +61,8 @@ import org.apache.jena.sparql.graph.GraphFactory;
  */
 public final class JenaRDFTermFactory implements RDFTermFactory {
 
+	private static JenaFactory jenaFactory = new JenaFactory(){};
+	
 	private final UUID salt;
 
 	/**
@@ -90,55 +92,55 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 
 	@Override
 	public JenaBlankNode createBlankNode() {
-		return JenaFactory.createBlankNode(getSalt());
+		return jenaFactory.createBlankNode(getSalt());
 	}
 
 	@Override
 	public JenaBlankNode createBlankNode(String name) {
-		return JenaFactory.createBlankNode(name, getSalt());
+		return jenaFactory.createBlankNode(name, getSalt());
 	}
 	
 	@Override
 	public JenaDataset createDataset() {
-		return JenaFactory.createDataset(getSalt());
+		return jenaFactory.createDataset(getSalt());
 	}
 
 	@Override
 	public JenaGraph createGraph() {
-		return JenaFactory.createGraph(getSalt());
+		return jenaFactory.createGraph(getSalt());
 	}
 
 	@Override
 	public JenaIRI createIRI(String iri) {
 		validateIRI(iri);
-		return JenaFactory.createIRI(iri);
+		return jenaFactory.createIRI(iri);
 	}
 
 	@Override
 	public JenaLiteral createLiteral(String lexicalForm) {
-		return JenaFactory.createLiteral(lexicalForm);
+		return jenaFactory.createLiteral(lexicalForm);
 	}
 
 	@Override
 	public JenaLiteral createLiteral(String lexicalForm, IRI dataType) {
-		return JenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString());
+		return jenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString());
 	}
 
 	@Override
 	public JenaLiteral createLiteral(String lexicalForm, String languageTag) {
 		validateLang(languageTag);
-		return JenaFactory.createLiteralLang(lexicalForm, languageTag);
+		return jenaFactory.createLiteralLang(lexicalForm, languageTag);
 	}
 
 	@Override
 	public JenaTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		return JenaFactory.createTriple(subject, predicate, object);
+		return jenaFactory.createTriple(subject, predicate, object);
 	}
 	
 	@Override
 	public JenaQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate,
RDFTerm object)
 			throws IllegalArgumentException, UnsupportedOperationException {
-		return JenaFactory.createQuad(subject, predicate, object, graphName);
+		return jenaFactory.createQuad(subject, predicate, object, graphName);
 	}
 
 	/**
@@ -163,7 +165,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 */
 	public JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> createGeneralizedTriple(
 			RDFTerm subject, RDFTerm predicate, RDFTerm object) {
-		return JenaFactory.createGeneralizedTriple(subject, predicate, object);
+		return jenaFactory.createGeneralizedTriple(subject, predicate, object);
 	}
 
 	/**
@@ -190,7 +192,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 */
 	public JenaQuadLike<RDFTerm, RDFTerm, RDFTerm, RDFTerm> createGeneralizedQuad(
 			RDFTerm subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
-		return JenaFactory.createGeneralizedQuad(subject, predicate, object, graphName);
+		return jenaFactory.createGeneralizedQuad(subject, predicate, object, graphName);
 	}	
 	/**
 	 * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}.
@@ -212,7 +214,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *             if the node is not concrete or represents a variable in Jena.
 	 */
 	public JenaRDFTerm fromJena(Node node) throws ConversionException {
-		return JenaFactory.fromJena(node, getSalt());
+		return jenaFactory.fromJena(node, getSalt());
 	}
 
 	/**
@@ -277,7 +279,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *             is a generalized triple
 	 */
 	public JenaTriple fromJena(org.apache.jena.graph.Triple triple) throws ConversionException
{
-		return JenaFactory.fromJena(triple, getSalt());
+		return jenaFactory.fromJena(triple, getSalt());
 	}
 
 	/**
@@ -303,7 +305,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *             if any of the triple's nodes are not concrete
 	 */
 	public JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> fromJenaGeneralized(org.apache.jena.graph.Triple
triple) throws ConversionException {
-		return JenaFactory.fromJenaGeneralized(triple, getSalt());
+		return jenaFactory.fromJenaGeneralized(triple, getSalt());
 	}
 
 	/**
@@ -333,7 +335,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *             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 {
-		return JenaFactory.fromJenaGeneralized(quad, getSalt());
+		return jenaFactory.fromJenaGeneralized(quad, getSalt());
 	}
 	
 	/**
@@ -388,7 +390,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted quad
 	 */	
 	public JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad) {
-		return JenaFactory.fromJena(quad, getSalt());
+		return jenaFactory.fromJena(quad, getSalt());
 	}
 
 	/**
@@ -410,7 +412,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted {@link JenaGraph}
 	 */
 	public JenaGraph fromJena(org.apache.jena.graph.Graph graph) {
-		return JenaFactory.fromJena(graph, getSalt());
+		return jenaFactory.fromJena(graph, getSalt());
 	}
 
 	/**
@@ -429,7 +431,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted {@link JenaGraph}
 	 */
 	public JenaGraph fromJena(org.apache.jena.rdf.model.Model model) {
-		return JenaFactory.fromJena(model, getSalt());
+		return jenaFactory.fromJena(model, getSalt());
 	}	
 
 	/**
@@ -449,7 +451,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted {@link JenaDataset} 
 	 */
 	public JenaDataset fromJena(DatasetGraph datasetGraph) {
-		return JenaFactory.fromJena(datasetGraph, getSalt());
+		return jenaFactory.fromJena(datasetGraph, getSalt());
 	}	
 	
 	/**
@@ -469,7 +471,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted {@link JenaDataset} 
 	 */
 	public JenaDataset fromJena(org.apache.jena.query.Dataset datasetGraph) {
-		return JenaFactory.fromJena(datasetGraph.asDatasetGraph(), getSalt());
+		return jenaFactory.fromJena(datasetGraph.asDatasetGraph(), getSalt());
 	}		
 
 	/**

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
index 0cbd764..a4cc3af 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaBlankNodeImpl.java
@@ -24,11 +24,11 @@ import org.apache.commons.rdf.api.BlankNode;
 import org.apache.commons.rdf.jena.JenaBlankNode;
 import org.apache.jena.graph.Node;
 
-public class JenaBlankNodeImpl extends AbstractJenaRDFTerm implements JenaBlankNode {
+class JenaBlankNodeImpl extends AbstractJenaRDFTerm implements JenaBlankNode {
 
 	private UUID salt;
 
-	/* package */ JenaBlankNodeImpl(Node node, UUID salt) {
+	JenaBlankNodeImpl(Node node, UUID salt) {
 		super(node);
 		if (! node.isBlank()) {
 			throw new IllegalArgumentException("Node is not a blank node: " + node);

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
index 76b018c..fec063f 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaDatasetImpl.java
@@ -40,7 +40,7 @@ import org.apache.jena.riot.RDFDataMgr;
 import org.apache.jena.sparql.core.DatasetGraph;
 import org.apache.jena.sparql.core.GraphView;
 
-public class JenaDatasetImpl implements JenaDataset {
+class JenaDatasetImpl implements JenaDataset {
 
 	private DatasetGraph graph;
 	private UUID salt;
@@ -94,7 +94,7 @@ public class JenaDatasetImpl implements JenaDataset {
 
 	private Node toJenaPattern(Optional<? extends RDFTerm> graphName) {
 		// In theory we could have done:
-		//   factory.toJena(graphName.orElse(JenaFactory::createAnyVariable))
+		//   factory.toJena(graphName.orElse(jenaFactory::createAnyVariable))
 		// but because of generics casting rules that doesn't work :(						
 
 		if (graphName == null) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/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 b349df8..30b96ed 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
@@ -47,66 +47,67 @@ import org.apache.jena.sparql.graph.GraphFactory;
 /**
  * Construct Jena implementations of Commons RDF.
  * <p>
- * This class is primarily an internal helper class, users should instead use
- * {@link JenaRDFTermFactory}.
+ * This class is deliberately an abstract class, as it is an internal helper
+ * which <strong>may change</strong> in any minor version update; users should
+ * instead use {@link JenaRDFTermFactory}.
  * <p>
- * For the purpose of blank node identity, some of 
- * these methods require a {@link UUID} to use as a salt.
- * See {@link BlankNode#uniqueReference()} for details.
+ * For the purpose of blank node identity, some of these methods require a
+ * {@link UUID} to use as a salt. See {@link BlankNode#uniqueReference()} for
+ * details.
  * 
  */
-public class JenaFactory {
+public abstract class JenaFactory {
 
-	public static JenaBlankNode createBlankNode(String id, UUID salt) {
+	public JenaBlankNode createBlankNode(String id, UUID salt) {
 		return new JenaBlankNodeImpl(NodeFactory.createBlankNode(id), salt);
 	}
 
-	public static JenaBlankNode createBlankNode(UUID salt) {
+	public JenaBlankNode createBlankNode(UUID salt) {
 		return new JenaBlankNodeImpl(NodeFactory.createBlankNode(), salt);
 	}
-	public static JenaDataset createDataset(UUID salt) {
+	public JenaDataset createDataset(UUID salt) {
 		DatasetGraph dg = DatasetGraphFactory.createGeneral();
 		// Or which createMethod() -- a bit confusing with lots of choice..
 		return new JenaDatasetImpl(dg, salt);
 	}
 
-	public static JenaGraph createGraph(UUID salt) {
+	public JenaGraph createGraph(UUID salt) {
 		return new JenaGraphImpl(GraphFactory.createDefaultGraph(), salt);
 	}
 
-	public static JenaIRI createIRI(String iriStr) {
+	public JenaIRI createIRI(String iriStr) {
 		return new JenaIRIImpl(iriStr);
 	}
 
-	public static JenaLiteral createLiteral(String lexStr) {
+	public JenaLiteral createLiteral(String lexStr) {
 		return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr));
 	}
 
-	public static JenaLiteral createLiteralDT(String lexStr, String datatypeIRI) {
+	public JenaLiteral createLiteralDT(String lexStr, String datatypeIRI) {
 		return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr, NodeFactory.getType(datatypeIRI)));
 	}
 
-	public static JenaLiteral createLiteralLang(String lexStr, String langTag) {
+	public JenaLiteral createLiteralLang(String lexStr, String langTag) {
 		return new JenaLiteralImpl(NodeFactory.createLiteral(lexStr, langTag));
 	}
 
-	public static JenaTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
{
+	public JenaTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
 		return new JenaTripleImpl(subject, predicate, object);
 	}
 
-	public static JenaQuad createQuad(BlankNodeOrIRI subject, IRI predicate, RDFTerm object,
BlankNodeOrIRI graphName) {
+	public JenaQuad createQuad(BlankNodeOrIRI subject, IRI predicate, RDFTerm object, BlankNodeOrIRI
graphName) {
 		return new JenaQuadImpl(subject, predicate, object, Optional.ofNullable(graphName));
 	}
 
-	public static JenaTripleLike<RDFTerm,RDFTerm,RDFTerm> createGeneralizedTriple(RDFTerm
subject, RDFTerm predicate, RDFTerm object) {
+	public JenaTripleLike<RDFTerm,RDFTerm,RDFTerm> createGeneralizedTriple(RDFTerm subject,
RDFTerm predicate, RDFTerm object) {
 		return new JenaGeneralizedQuad<RDFTerm,RDFTerm,RDFTerm,RDFTerm>(subject, predicate,
object);
 	}
 
-	public static JenaQuadLike<RDFTerm,RDFTerm,RDFTerm,RDFTerm> createGeneralizedQuad(RDFTerm
subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
+	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 static JenaRDFTerm fromJena(Node node, UUID salt) throws ConversionException {
+	public JenaRDFTerm fromJena(Node node, UUID salt) throws ConversionException {
 		if (! node.isConcrete()) {
 			throw new ConversionException("Node is not a concrete RDF Term: " + node); 
 		}
@@ -130,31 +131,31 @@ public class JenaFactory {
 		throw new ConversionException("Unrecognized node type: " + node);
 	}
 
-	public static JenaGraph fromJena(org.apache.jena.graph.Graph graph, UUID salt) {
+	public JenaGraph fromJena(org.apache.jena.graph.Graph graph, UUID salt) {
 		return new JenaGraphImpl(graph, salt);
 	}
 
-	public static JenaGraph fromJena(Model model, UUID salt) {
+	public JenaGraph fromJena(Model model, UUID salt) {
 		return new JenaGraphImpl(model, salt);
 	}
 
-	public static JenaDataset fromJena(DatasetGraph datasetGraph, UUID salt) {
+	public JenaDataset fromJena(DatasetGraph datasetGraph, UUID salt) {
 		return new JenaDatasetImpl(datasetGraph, salt);
 	}
 	
-	public static JenaTriple fromJena(org.apache.jena.graph.Triple triple, UUID salt) {
+	public JenaTriple fromJena(org.apache.jena.graph.Triple triple, UUID salt) {
 		return new JenaTripleImpl(triple, salt);
 	}
 
-	public static JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> fromJenaGeneralized(org.apache.jena.graph.Triple
triple, UUID 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 static JenaQuadLike<RDFTerm,RDFTerm,RDFTerm,RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad
quad, UUID 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 static JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad, UUID salt) {
+	public JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad, UUID salt) {
 		return new JenaQuadImpl(quad, salt);
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/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
index cad2355..607defd 100644
--- 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
@@ -40,12 +40,14 @@ import org.apache.jena.sparql.core.Quad;
  * 
  * @see JenaTripleImpl
  * @see JenaQuadImpl
- * @see JenaFactory#createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
- * @see JenaFactory#createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
+ * @see jenaFactory#createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
+ * @see jenaFactory#createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
  *
  */
-public class JenaGeneralizedQuad<S extends RDFTerm, P extends RDFTerm, O extends RDFTerm,
G extends RDFTerm> implements JenaQuadLike<S,P,O,G> {
+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;
@@ -53,7 +55,7 @@ public class JenaGeneralizedQuad<S extends RDFTerm, P extends RDFTerm,
O extends
 	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) {		
+	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);
@@ -67,18 +69,18 @@ public class JenaGeneralizedQuad<S extends RDFTerm, P extends RDFTerm,
O extends
 	@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));		
+		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.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();
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
index 89162e0..09cc2ab 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaGraphImpl.java
@@ -35,7 +35,7 @@ import org.apache.jena.rdf.model.ModelFactory;
 import org.apache.jena.riot.Lang;
 import org.apache.jena.riot.RDFDataMgr;
 
-public class JenaGraphImpl implements JenaGraph {
+class JenaGraphImpl implements JenaGraph {
 
 	private final org.apache.jena.graph.Graph graph;
 	private final UUID salt;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
index 2aa170f..7fbf284 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaIRIImpl.java
@@ -23,9 +23,9 @@ import org.apache.commons.rdf.jena.JenaIRI;
 import org.apache.jena.graph.Node;
 import org.apache.jena.graph.NodeFactory;
 
-public class JenaIRIImpl extends AbstractJenaRDFTerm implements JenaIRI {
+class JenaIRIImpl extends AbstractJenaRDFTerm implements JenaIRI {
 
-	/* package */ JenaIRIImpl(Node node) {
+	JenaIRIImpl(Node node) {
 		super(node);
 		if (! node.isURI()) {
 			throw new IllegalArgumentException("Node is not a blank node: " + node);
@@ -33,7 +33,7 @@ public class JenaIRIImpl extends AbstractJenaRDFTerm implements JenaIRI
{
 		
 	}
 
-	/* package */ JenaIRIImpl(String iriStr) {
+	JenaIRIImpl(String iriStr) {
 		super(NodeFactory.createURI(iriStr));
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
index 5bbc166..173af4c 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/JenaLiteralImpl.java
@@ -26,9 +26,11 @@ import org.apache.commons.rdf.api.Literal;
 import org.apache.commons.rdf.jena.JenaLiteral;
 import org.apache.jena.graph.Node;
 
-public class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral {
+class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral {
 
-	/* package */ JenaLiteralImpl(Node node) {
+	private static JenaFactory jenaFactory = new JenaFactory(){};
+	
+	JenaLiteralImpl(Node node) {
 		super(node);
 		if (! node.isLiteral()) {
 			throw new IllegalArgumentException("Node is not a literal: " + node);
@@ -50,7 +52,7 @@ public class JenaLiteralImpl extends AbstractJenaRDFTerm implements JenaLiteral
 
 	@Override
 	public IRI getDatatype() {
-		return JenaFactory.createIRI(asJenaNode().getLiteralDatatype().getURI());
+		return jenaFactory.createIRI(asJenaNode().getLiteralDatatype().getURI());
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/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 0f3e3e3..9d65374 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;
 
-public class JenaQuadImpl	extends JenaGeneralizedQuad<BlankNodeOrIRI,IRI,RDFTerm,BlankNodeOrIRI>
+class JenaQuadImpl	extends JenaGeneralizedQuad<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/b3baff42/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 4e497f2..502b575 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;
 
-public class JenaTripleImpl extends JenaGeneralizedQuad<BlankNodeOrIRI, IRI, RDFTerm,
RDFTerm>
+class JenaTripleImpl extends JenaGeneralizedQuad<BlankNodeOrIRI, IRI, RDFTerm, RDFTerm>
 		implements JenaTriple {
 
 	JenaTripleImpl(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/b3baff42/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
index f37922f..0ac6326 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
@@ -26,6 +26,8 @@ import org.apache.commons.rdf.jena.impl.JenaFactory;
 
 public class TestBlankNodeJena extends AbstractBlankNodeTest {
 
+	JenaFactory jenaFactory = new JenaFactory(){};
+	
 	/** 
 	 * Fixed salt for the purpose of this test.
 	 */
@@ -33,12 +35,12 @@ public class TestBlankNodeJena extends AbstractBlankNodeTest {
 
 	@Override
     protected BlankNode getBlankNode() {
-        return JenaFactory.createBlankNode(SALT) ;
+        return jenaFactory.createBlankNode(SALT) ;
     }
     
     @Override
     protected BlankNode getBlankNode(String identifier) {
-        return JenaFactory.createBlankNode(identifier, SALT) ;
+        return jenaFactory.createBlankNode(identifier, SALT) ;
     }
 }
 


Mime
View raw message