commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [2/3] incubator-commonsrdf git commit: JenaRDFTermFactory -> JenaFactory
Date Wed, 19 Oct 2016 08:54:29 GMT
JenaRDFTermFactory -> JenaFactory


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

Branch: refs/heads/master
Commit: ec8a4aca0df57365c9450b356614f1a458d2e778
Parents: d043b07
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Wed Oct 19 09:49:45 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Wed Oct 19 09:49:45 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rdf/jena/JenaFactory.java    | 727 +++++++++++++++++++
 .../commons/rdf/jena/JenaRDFTermFactory.java    | 727 -------------------
 .../rdf/jena/experimental/JenaRDFParser.java    |  14 +-
 .../commons/rdf/jena/impl/AbstractQuadLike.java |   6 +-
 .../rdf/jena/impl/InternalJenaFactory.java      |   4 +-
 .../commons/rdf/jena/impl/JenaDatasetImpl.java  |  14 +-
 .../commons/rdf/jena/impl/JenaGraphImpl.java    |  12 +-
 .../apache/commons/rdf/jena/TestGraphJena.java  |   2 +-
 .../jena/TestJenaGraphToCommonsRDFGraph.java    |   4 +-
 .../commons/rdf/jena/TestRDFParserBuilder.java  |   2 +-
 .../rdf/jena/TestRDFTermFactoryJena.java        |   2 +-
 src/site/markdown/implementations.md            |  10 +-
 12 files changed, 762 insertions(+), 762 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
new file mode 100644
index 0000000..0d735c7
--- /dev/null
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/JenaFactory.java
@@ -0,0 +1,727 @@
+/**
+ * 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 java.util.Optional;
+import java.util.UUID;
+import java.util.function.Consumer;
+
+import org.apache.commons.rdf.api.BlankNode;
+import org.apache.commons.rdf.api.BlankNodeOrIRI;
+import org.apache.commons.rdf.api.Dataset;
+import org.apache.commons.rdf.api.Graph;
+import org.apache.commons.rdf.api.IRI;
+import org.apache.commons.rdf.api.Literal;
+import org.apache.commons.rdf.api.Quad;
+import org.apache.commons.rdf.api.QuadLike;
+import org.apache.commons.rdf.api.RDFSyntax;
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.commons.rdf.api.RDFTermFactory;
+import org.apache.commons.rdf.api.Triple;
+import org.apache.commons.rdf.api.TripleLike;
+import org.apache.commons.rdf.jena.impl.InternalJenaFactory;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.datatypes.xsd.XSDDatatype;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.RDFLanguages;
+import org.apache.jena.riot.system.StreamRDF;
+import org.apache.jena.riot.system.StreamRDFBase;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.graph.GraphFactory;
+
+/**
+ * RDFTermFactory with Jena-backed objects.
+ * <p>
+ * This factory can also convert existing objects from/to Jena with methods like
+ * {@link #fromJena(org.apache.jena.graph.Graph)} and {@link #toJena(Graph)}.
+ * <p>
+ * For the purpose of {@link BlankNode} identity, this factory will use an internal
+ * {@link UUID} as a salt. See {@link BlankNode#uniqueReference()} for details.
+ * 
+ * @see RDFTermFactory
+ */
+public final class JenaFactory implements RDFTermFactory {
+
+	private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory(){};
+	
+	private final UUID salt;
+
+	/**
+	 * Create a JenaFactory.
+	 * <p>
+	 * This constructor will use a randomly generated {@link UUID} as a salt 
+	 * for the purposes of {@link BlankNode} identity, see {@link #getSalt()}.
+	 */
+	public JenaFactory() {
+		this.salt = UUID.randomUUID();
+	}
+
+	/**
+	 * Create a JenaFactory.
+	 * <p>
+	 * This constructor will use the specified {@link UUID} as a salt for
+	 * the purposes of {@link BlankNode} identity, and should only be used in
+	 * cases where predictable and consistent
+	 * {@link BlankNode#uniqueReference()} are important.
+	 * 
+	 * @param salt
+	 *            {@link UUID} to use as salt for {@link BlankNode} equality
+	 */	
+	public JenaFactory(UUID salt) {
+		this.salt = salt;
+	}
+
+	@Override
+	public JenaBlankNode createBlankNode() {
+		return internalJenaFactory.createBlankNode(getSalt());
+	}
+
+	@Override
+	public JenaBlankNode createBlankNode(String name) {
+		return internalJenaFactory.createBlankNode(name, getSalt());
+	}
+	
+	@Override
+	public JenaDataset createDataset() {
+		return internalJenaFactory.createDataset(getSalt());
+	}
+
+	@Override
+	public JenaGraph createGraph() {
+		return internalJenaFactory.createGraph(getSalt());
+	}
+
+	@Override
+	public JenaIRI createIRI(String iri) {
+		validateIRI(iri);
+		return internalJenaFactory.createIRI(iri);
+	}
+
+	@Override
+	public JenaLiteral createLiteral(String lexicalForm) {
+		return internalJenaFactory.createLiteral(lexicalForm);
+	}
+
+	@Override
+	public JenaLiteral createLiteral(String lexicalForm, IRI dataType) {
+		return internalJenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString());
+	}
+
+	@Override
+	public JenaLiteral createLiteral(String lexicalForm, String languageTag) {
+		validateLang(languageTag);
+		return internalJenaFactory.createLiteralLang(lexicalForm, languageTag);
+	}
+
+	@Override
+	public JenaTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+		return internalJenaFactory.createTriple(subject, predicate, object);
+	}
+	
+	@Override
+	public JenaQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
+			throws IllegalArgumentException, UnsupportedOperationException {
+		return internalJenaFactory.createQuad(subject, predicate, object, graphName);
+	}
+
+	/**
+	 * Create a generalized Jena triple.
+	 * <p>
+	 * The <em>generalized triple</em> supports any {@link RDFTerm} as its
+	 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or
+	 * {@link TripleLike#getObject()}.
+	 *
+	 * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm)
+	 * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
+	 * 
+	 * @param subject
+	 *            The subject of the statement
+	 * @param predicate
+	 *            The predicate of the statement
+	 * @param object
+	 *            The object of the statement
+	 * @return Generalized {@link TripleLike}. Note that the generalized triple
+	 *         does <strong>not</strong> implement {@link Triple#equals(Object)}
+	 *         or {@link Triple#hashCode()}.
+	 */
+	public JenaGeneralizedTripleLike createGeneralizedTriple(
+			RDFTerm subject, RDFTerm predicate, RDFTerm object) {
+		return internalJenaFactory.createGeneralizedTriple(subject, predicate, object);
+	}
+
+	/**
+	 * Create a generalized Jena quad.
+	 * <p>
+	 * The <em>generalized quad</em> supports any {@link RDFTerm} as its
+	 * {@link QuadLike#getSubject()} {@link QuadLike#getPredicate()},
+	 * {@link QuadLike#getObject()} or {@link QuadLike#getObject()}.
+	 * 
+	 * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm)
+	 * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
+	 * 
+	 * @param subject
+	 *            The subject of the statement
+	 * @param predicate
+	 *            The predicate of the statement
+	 * @param object
+	 *            The object of the statement
+	 * @param graphName
+	 *            The graph name of the statement
+	 * @return Generalized {@link QuadLike}. Note that the generalized quad does
+	 *         <strong>not</strong> implement {@link Quad#equals(Object)} or
+	 *         {@link Quad#hashCode()}.
+	 */
+	public JenaGeneralizedQuadLike createGeneralizedQuad(
+			RDFTerm subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
+		return internalJenaFactory.createGeneralizedQuad(subject, predicate, object, graphName);
+	}	
+	/**
+	 * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}.
+	 * <p>
+	 * If {@link Node#isLiteral()}, then the returned value is a {@link Literal}.
+	 * If {@link Node#isURI()}, the returned value is a IRI. If {$@link Node#isBlank()},
+	 * the returned value is a {@link BlankNode}, which will use a {@link UUID}
+	 * salt from this {@link JenaFactory} instance in combination with
+	 * {@link Node#getBlankNodeId()} for the purpose of its
+	 * {@link BlankNode#uniqueReference()}.
+	 * 
+	 * @see #fromJena(RDFTermFactory, Node)
+	 * 
+	 * @param node
+	 *            The Jena Node to adapt. It's {@link Node#isConcrete()} must be
+	 *            <code>true</code>.
+	 * @return Adapted {@link JenaRDFTerm}
+	 * @throws ConversionException If the {@link Node} can't be represented as an {@link RDFTerm}, e.g.
+	 *             if the node is not concrete or represents a variable in Jena.
+	 */
+	public JenaRDFTerm fromJena(Node node) throws ConversionException {
+		return internalJenaFactory.fromJena(node, getSalt());
+	}
+
+	/**
+	 * Convert from Jena {@link Node} to any Commons RDF implementation.
+	 * <p>
+	 * Note that if the {@link Node#isBlank()}, then the factory's 
+	 * {@link RDFTermFactory#createBlankNode(String)} will be used, meaning
+	 * that care should be taken if reusing an {@link RDFTermFactory} instance
+	 * for multiple conversion sessions.
+	 * 
+	 * @see #fromJena(Node)
+	 * 
+	 * @param factory {@link RDFTermFactory} to use for creating {@link RDFTerm}.
+	 * @param node
+	 *            The Jena Node to adapt. It's {@link Node#isConcrete()} must be
+	 *            <code>true</code>.
+	 * @return Adapted {@link RDFTerm}
+	 * @throws ConversionException If the {@link Node} can't be represented as an {@link RDFTerm}, e.g.
+	 *             if the node is not concrete or represents a variable in Jena.
+	 */
+	public static RDFTerm fromJena(RDFTermFactory factory, Node node) {
+		if (node == null) {
+			return null;
+		}
+		if (factory instanceof JenaFactory) {
+			// No need to convert, just wrap
+			return ((JenaFactory) factory).fromJena(node);
+		}
+		if (node.isURI())
+			return factory.createIRI(node.getURI());
+		if (node.isLiteral()) {
+			String lang = node.getLiteralLanguage();
+			if (lang != null && !lang.isEmpty())
+				return factory.createLiteral(node.getLiteralLexicalForm(), lang);
+			if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring))
+				return factory.createLiteral(node.getLiteralLexicalForm());
+			IRI dt = factory.createIRI(node.getLiteralDatatype().getURI());
+			return factory.createLiteral(node.getLiteralLexicalForm(), dt);
+		}
+		if (node.isBlank())
+			// The factory
+			return factory.createBlankNode(node.getBlankNodeLabel());
+		throw new ConversionException("Node is not a concrete RDF Term: " + node);
+	}	
+	
+	/**
+	 * Adapt an existing Jena Triple to CommonsRDF {@link Triple}.
+	 * <p>
+	 * If the triple contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this
+	 * {@link JenaFactory} instance in combination with
+	 * {@link Node#getBlankNodeId()} for the purpose of its
+	 * {@link BlankNode#uniqueReference()}.
+	 *
+	 * @see #fromJena(RDFTermFactory, org.apache.jena.graph.Triple)
+	 * 
+	 * @param triple
+	 *            Jena {@link org.apache.jena.graph.Triple} to adapt
+	 * @return Adapted {@link JenaTriple}
+	 * @throws ConversionException
+	 *             if any of the triple's nodes are not concrete or the triple
+	 *             is a generalized triple
+	 */
+	public JenaTriple fromJena(org.apache.jena.graph.Triple triple) throws ConversionException {
+		return internalJenaFactory.fromJena(triple, getSalt());
+	}
+
+	/**
+	 * Adapt a generalized Jena {@link org.apache.jena.graph.Triple} to a CommonsRDF {@link TripleLike}.
+	 * <p>
+	 * The generalized triple supports any {@link RDFTerm} as its {@link TripleLike#getSubject()}
+	 * {@link TripleLike#getPredicate()} or {@link TripleLike#getObject()}.
+	 * <p>
+	 * If the Jena triple contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this
+	 * {@link JenaFactory} instance in combination with
+	 * {@link Node#getBlankNodeId()} for the purpose of its
+	 * {@link BlankNode#uniqueReference()}.
+	 *
+	 * @see #fromJena(RDFTermFactory, org.apache.jena.graph.Triple)
+	 * 
+	 * @param triple
+	 *            Jena triple
+	 * @return Adapted {@link TripleLike}. Note that the generalized triple does
+	 *         <strong>not</strong> implement {@link Triple#equals(Object)} or
+	 *         {@link Triple#hashCode()}.
+	 * @throws ConversionException
+	 *             if any of the triple's nodes are not concrete
+	 */
+	public JenaTripleLike fromJenaGeneralized(org.apache.jena.graph.Triple triple) throws ConversionException {
+		return internalJenaFactory.fromJenaGeneralized(triple, getSalt());
+	}
+
+	/**
+	 * Adapt a generalized Jena {@link org.apache.jena.sparql.core.Quad} to a CommonsRDF {@link QuadLike}.
+	 * <p>
+	 * The generalized quad supports any {@link RDFTerm} as its 
+	 * {@link QuadLike#getGraphName()}, 
+	 * {@link QuadLike#getSubject()}
+	 * {@link QuadLike#getPredicate()} or 
+	 * {@link QuadLike#getObject()}. 
+	 * <p>
+	 * If the Jena quad contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this
+	 * {@link JenaFactory} instance in combination with
+	 * {@link Node#getBlankNodeId()} for the purpose of its
+	 * {@link BlankNode#uniqueReference()}.
+	 *
+	 * @see #fromJena(org.apache.jena.sparql.core.Quad)
+	 * @see #fromJenaGeneralized(org.apache.jena.graph.Triple)
+	 * 
+	 * @param quad
+	 *            Jena quad
+	 * @return Adapted {@link QuadLike}. Note that the generalized quad does
+	 *         <strong>not</strong> implement {@link Quad#equals(Object)} or
+	 *         {@link Quad#hashCode()}.
+	 * @throws ConversionException
+	 *             if any of the quad nodes are not concrete
+	 */
+	public JenaQuadLike<RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad quad) throws ConversionException {
+		return internalJenaFactory.fromJenaGeneralized(quad, getSalt());
+	}
+	
+	/**
+	 * Convert from Jena {@link org.apache.jena.graph.Triple} to a Commons RDF
+	 * {@link Triple}.
+	 * <p>
+	 * Note that if any of the triple's nodes {@link Node#isBlank()}, then the factory's 
+	 * {@link RDFTermFactory#createBlankNode(String)} will be used, meaning
+	 * that care should be taken if reusing an {@link RDFTermFactory} instance
+	 * for multiple conversion sessions.
+	 * 
+	 * @see #fromJena(org.apache.jena.graph.Triple)
+	 *
+	 * @param factory {@link RDFTermFactory} to use for creating the {@link Triple} and its
+	 * {@link RDFTerm}s.
+	 * @param triple
+	 *            Jena triple
+	 * @return Converted triple
+	 * @throws ConversionException
+	 *             if any of the triple's nodes are not concrete or the triple
+	 *             is a generalized triple
+	 */
+	public static Triple fromJena(RDFTermFactory factory, org.apache.jena.graph.Triple triple) 
+			throws ConversionException{
+		if (factory instanceof JenaFactory) {
+			// No need to convert, just wrap
+			return ((JenaFactory) factory).fromJena(triple);
+		}
+		final BlankNodeOrIRI subject;
+		final IRI predicate;
+		try {
+			subject = (BlankNodeOrIRI) fromJena(factory, triple.getSubject());
+			predicate = (IRI) fromJena(factory, triple.getPredicate());
+		} catch (ClassCastException ex) {
+			throw new ConversionException("Can't convert generalized triple: " + triple, ex);
+		}
+		RDFTerm object = fromJena(factory, triple.getObject());
+		return factory.createTriple(subject, predicate, object);
+	}
+
+	/**
+	 * Adapt an existing Jena {@link org.apache.jena.sparql.core.Quad} to CommonsRDF {@link Quad}.
+	 * <p>
+	 * If the quad contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this 
+	 * {@link JenaFactory} instance
+	 * in combination with {@link Node#getBlankNodeId()} 
+	 * for the purpose of its {@link BlankNode#uniqueReference()}.
+	 * 
+	 * @param quad
+	 *            Jena quad
+	 * @return Adapted quad
+	 */	
+	public JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad) {
+		return internalJenaFactory.fromJena(quad, getSalt());
+	}
+
+	/**
+	 * Adapt an existing Jena {@link org.apache.jena.graph.Graph} to CommonsRDF
+	 * {@link Graph}.
+	 * <p>
+	 * This does not take a copy, changes to the CommonsRDF Graph are reflected
+	 * in the jena graph, which is accessible from
+	 * {@link JenaGraph#asJenaGraph()}.
+	 * <p>
+	 * If the graph contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this
+	 * {@link JenaFactory} instance in combination with
+	 * {@link Node#getBlankNodeId()} for the purpose of its
+	 * {@link BlankNode#uniqueReference()}.
+	 * 
+	 * @param graph
+	 *            Jena {@link org.apache.jena.graph.Graph} to adapt
+	 * @return Adapted {@link JenaGraph}
+	 */
+	public JenaGraph fromJena(org.apache.jena.graph.Graph graph) {
+		return internalJenaFactory.fromJena(graph, getSalt());
+	}
+
+	/**
+	 * Adapt an existing Jena {@link org.apache.jena.rdf.model.Model} to CommonsRDF {@link Graph}. 
+	 * <p>
+	 * This does not ake a copy, changes to the CommonsRDF Graph are reflected in the jena
+	 * graph, which is accessible from {@link JenaGraph#asJenaGraph()}.
+	 * <p>
+	 * If the graph contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this 
+	 * {@link JenaFactory} instance
+	 * in combination with {@link Node#getBlankNodeId()} 
+	 * for the purpose of its {@link BlankNode#uniqueReference()}.
+	 * @param model
+	 *            Jena {@link org.apache.jena.rdf.model.Model} to adapt
+	 * @return Adapted {@link JenaGraph}
+	 */
+	public JenaGraph fromJena(org.apache.jena.rdf.model.Model model) {
+		return internalJenaFactory.fromJena(model, getSalt());
+	}	
+
+	/**
+	 * Adapt an existing Jena {@link DatasetGraph} to CommonsRDF {@link Dataset}. 
+	 * <p>
+	 * This does not
+	 * take a copy, changes to the CommonsRDF Dataset are reflected in the jena
+	 * dataset graph, which is accessible from {@link JenaDataset#asJenaDatasetGraph()}.
+	 * <p>
+	 * If the dataset contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this 
+	 * {@link JenaFactory} instance
+	 * in combination with {@link Node#getBlankNodeId()} 
+	 * for the purpose of its {@link BlankNode#uniqueReference()}.
+	 * 
+	 * @param datasetGraph Jena {@link DatasetGraph} to adapt
+	 * @return Adapted {@link JenaDataset} 
+	 */
+	public JenaDataset fromJena(DatasetGraph datasetGraph) {
+		return internalJenaFactory.fromJena(datasetGraph, getSalt());
+	}	
+	
+	/**
+	 * Adapt an existing Jena {@link org.apache.jena.query.Dataset} to CommonsRDF {@link Dataset}. 
+	 * <p>
+	 * This does not
+	 * take a copy, changes to the CommonsRDF Dataset are reflected in the jena
+	 * dataset graph, which is accessible from {@link JenaDataset#asJenaDatasetGraph()}.
+	 * <p>
+	 * If the dataset contains any {@link Node#isBlank()}, then any corresponding
+	 * {@link BlankNode} will use a {@link UUID} salt from this 
+	 * {@link JenaFactory} instance
+	 * in combination with {@link Node#getBlankNodeId()} 
+	 * for the purpose of its {@link BlankNode#uniqueReference()}.
+	 * 
+	 * @param datasetGraph Jena {@link org.apache.jena.query.Dataset} to adapt
+	 * @return Adapted {@link JenaDataset} 
+	 */
+	public JenaDataset fromJena(org.apache.jena.query.Dataset datasetGraph) {
+		return internalJenaFactory.fromJena(datasetGraph.asDatasetGraph(), getSalt());
+	}		
+
+	/**
+	 * Convert from Jena {@link org.apache.jena.sparql.core.Quad} to a Commons
+	 * RDF {@link Quad}.
+	 * <p>
+	 * Note that if any of the quad's nodes {@link Node#isBlank()}, then the
+	 * factory's {@link RDFTermFactory#createBlankNode(String)} will be used,
+	 * meaning that care should be taken if reusing an {@link RDFTermFactory}
+	 * instance for multiple conversion sessions.
+	 * 
+	 * @see #fromJena(org.apache.jena.sparql.core.Quad)
+	 * @see #fromJenaGeneralized(org.apache.jena.sparql.core.Quad)
+	 *
+	 * @param factory
+	 *            {@link RDFTermFactory} to use for creating the {@link Triple}
+	 *            and its {@link RDFTerm}s.
+	 * @param quad
+	 *            Jena {@link org.apache.jena.sparql.core.Quad} to adapt
+	 * @return Converted {@link Quad}
+	 * @throws ConversionException
+	 *             if any of the quad's nodes are not concrete or the quad
+	 *             is a generalized quad
+	 */
+	public static Quad fromJena(RDFTermFactory factory, org.apache.jena.sparql.core.Quad quad) {
+		if (factory instanceof JenaFactory) {
+			// No need to convert, just wrap
+			return ((JenaFactory) factory).fromJena(quad);
+		}
+		BlankNodeOrIRI graphName = (BlankNodeOrIRI) (fromJena(factory, quad.getGraph()));
+		BlankNodeOrIRI subject = (BlankNodeOrIRI) (fromJena(factory, quad.getSubject()));
+		IRI predicate = (IRI) (fromJena(factory, quad.getPredicate()));
+		RDFTerm object = fromJena(factory, quad.getObject());
+		return factory.createQuad(graphName, subject, predicate, object);
+	}
+
+	/**
+	 * Return {@link RDFSyntax} corresponding to a Jena {@link Lang}.
+	 * 
+	 * @param lang {@link Lang} to convert
+	 * @return Matched {@link RDFSyntax}, otherwise {@link Optional#empty()}
+	 */
+	public Optional<RDFSyntax> langToRdfSyntax(Lang lang) {
+		return RDFSyntax.byMediaType(lang.getContentType().getContentType());
+	}
+
+	/**
+	 * Return Jena {@link Lang} corresponding to a {@link RDFSyntax}.
+	 * 
+	 * @param rdfSyntax {@link RDFSyntax} to convert
+	 * @return Matched {@link Lang}, otherwise {@link Optional#empty()}
+	 */
+	public Optional<Lang> rdfSyntaxToLang(RDFSyntax rdfSyntax) {
+		return Optional.ofNullable(RDFLanguages.contentTypeToLang(rdfSyntax.mediaType));
+	}
+
+	/**
+	 * Create a {@link StreamRDF} instance that inserts the converted
+	 * {@link Quad}s. into a the provided {@link Consumer}.
+	 * <p>
+	 * The returned {@link StreamRDF} can be used for instance with Jena's
+	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
+	 * 
+	 * @param factory
+	 *            {@link RDFTermFactory} to use for creating {@link RDFTerm}s
+	 *            and {@link Quad}s.
+	 * @param consumer
+	 *            A {@link Consumer} of {@link Quad}s
+	 * @return A {@link StreamRDF} that will stream converted quads to the
+	 *         consumer
+	 */
+	public static StreamRDF streamJenaToCommonsRDF(RDFTermFactory factory, Consumer<Quad> consumer) {
+		return new StreamRDFBase() {
+			@Override
+			public void quad(org.apache.jena.sparql.core.Quad quad) {
+				consumer.accept(fromJena(factory, quad));
+			}
+		};
+	}
+	
+	/**
+	 * Create a {@link StreamRDF} instance that inserts generalized
+	 * {@link TripleLike}s. into a the provided {@link Consumer}.
+	 * <p>
+	 * A generalized triple allows any {@link RDFTerm} for
+	 * {@link TripleLike#getSubject()}, {@link TripleLike#getPredicate()} and
+	 * {@link TripleLike#getObject()}.
+	 * <p>
+	 * The returned {@link StreamRDF} can be used for instance with Jena's
+	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
+	 * 
+	 * @param generalizedConsumer
+	 *            A {@link Consumer} of generalized {@link TripleLike}s
+	 * @return A {@link StreamRDF} that will stream generalized triples to the
+	 *         consumer
+	 */
+	public StreamRDF streamJenaToGeneralizedTriple(Consumer<TripleLike> generalizedConsumer) {
+		return new StreamRDFBase() {			
+			@Override
+			public void triple(org.apache.jena.graph.Triple triple) {
+				generalizedConsumer.accept(fromJenaGeneralized(triple));
+			}
+		};
+	}	
+
+	/**
+	 * Create a {@link StreamRDF} instance that inserts generalized
+	 * {@link QuadLike}s. into a the provided {@link Consumer}.
+	 * <p>
+	 * A generalized quad allows any {@link RDFTerm} for
+	 * {@link QuadLike#getSubject()}, {@link TripleLike#getPredicate()},
+	 * {@link QuadLike#getObject()} and {@link QuadLike#getGraphName()} .
+	 * <p>
+	 * The returned {@link StreamRDF} can be used for instance with Jena's
+	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
+	 * 
+	 * @param generalizedConsumer
+	 *            A {@link Consumer} of generalized {@link QuadLike}s
+	 * @return A {@link StreamRDF} that will stream generalized quads to the
+	 *         consumer
+	 */
+	public StreamRDF streamJenaToGeneralizedQuad(Consumer<QuadLike<RDFTerm>> generalizedConsumer) {
+		return new StreamRDFBase() {
+			@Override
+			public void quad(org.apache.jena.sparql.core.Quad quad) {
+				generalizedConsumer.accept(fromJenaGeneralized(quad));
+			}
+		};
+	}	
+	
+	/**
+	 * Convert a CommonsRDF Graph to a Jena Graph. If the Graph was from Jena
+	 * originally, return that original object else create a copy using Jena
+	 * objects.
+	 * 
+	 * @param graph Commons RDF {@link Graph} to convert
+	 * @return Converted Jena {@link org.apache.jena.graph.Graph}
+	 */
+	public org.apache.jena.graph.Graph toJena(Graph graph) {
+		if (graph instanceof JenaGraph)
+			return ((JenaGraph) graph).asJenaGraph();
+		org.apache.jena.graph.Graph g = GraphFactory.createGraphMem();
+		graph.stream().forEach(t -> g.add(toJena(t)));
+		return g;
+	}
+
+	/**
+	 * Convert a CommonsRDF RDFTerm to a Jena Node. If the RDFTerm was from Jena
+	 * originally, return that original object, else create a copy using Jena
+	 * objects.
+	 * 
+	 * @param term Commons RDF {@link RDFTerm} to convert
+	 * @return Converted Jena {@link Node}
+	 */
+	public Node toJena(RDFTerm term) {
+		if (term == null) {
+			return null;
+		}
+		if (term instanceof JenaRDFTerm)
+			// TODO: What if it's a JenaBlankNodeImpl with
+			// a different salt? Do we need to rewrite the
+			// jena blanknode identifier?
+			return ((JenaRDFTerm) term).asJenaNode();
+
+		if (term instanceof IRI)
+			return NodeFactory.createURI(((IRI) term).getIRIString());
+
+		if (term instanceof Literal) {
+			Literal lit = (Literal) term;
+			RDFDatatype dt = NodeFactory.getType(lit.getDatatype().getIRIString());
+			String lang = lit.getLanguageTag().orElse("");
+			return NodeFactory.createLiteral(lit.getLexicalForm(), lang, dt);
+		}
+
+		if (term instanceof BlankNode) {
+			String id = ((BlankNode) term).uniqueReference();
+			return NodeFactory.createBlankNode(id);
+		}
+		throw new ConversionException("Not a concrete RDF Term: " + term);
+	}
+
+	/**
+	 * Convert a CommonsRDF {@link Triple} to a Jena
+	 * {@link org.apache.jena.graph.Triple}.
+	 * <p>
+	 * If the triple was from Jena originally, return that original object, else
+	 * create a copy using Jena objects.
+	 * 
+	 * @param triple Commons RDF {@link Triple} to convert
+	 * @return Converted Jena {@link org.apache.jena.graph.Triple}
+	 */
+	public org.apache.jena.graph.Triple toJena(Triple triple) {
+		if (triple instanceof JenaTriple)
+			return ((JenaTriple) triple).asJenaTriple();
+		return org.apache.jena.graph.Triple.create(
+				toJena(triple.getSubject()), 
+				toJena(triple.getPredicate()),
+				toJena(triple.getObject()));
+	}
+
+
+	/**
+	 * Convert a CommonsRDF {@link Quad} to a Jena
+	 * {@link org.apache.jena.sparql.core.Quad}.
+	 * <p>
+	 * If the quad was from Jena originally, return that original object,
+	 * otherwise create a copy using Jena objects.
+	 *
+	 * @param quad Commons RDF {@link Quad} to convert
+	 * @return Converted Jena {@link org.apache.jena.sparql.core.Quad}
+	 */
+	public org.apache.jena.sparql.core.Quad toJena(Quad quad) {
+		if (quad instanceof JenaQuad) {
+			return ((JenaQuad) quad).asJenaQuad();
+		}
+		return org.apache.jena.sparql.core.Quad.create(
+				toJena(quad.getGraphName().orElse(null)),
+				toJena(quad.getSubject()), 
+				toJena(quad.getPredicate()), 
+				toJena(quad.getObject()));
+	}
+
+	// Some simple validations - full IRI parsing is not cheap.
+	private void validateIRI(String iri) {
+		if (iri.contains(" "))
+			throw new IllegalArgumentException();
+		if (iri.contains("<"))
+			throw new IllegalArgumentException();
+		if (iri.contains(">"))
+			throw new IllegalArgumentException();
+	}
+
+	private static void validateLang(String languageTag) {
+		if (languageTag.contains(" "))
+			throw new IllegalArgumentException("Invalid language tag: " + languageTag);
+	}
+
+	/**
+	 * Return the {@link UUID} salt used by this factory.
+	 * <p>
+	 * The salt is used for the purposes of {@link BlankNode} identity, see
+	 * {@link BlankNode#uniqueReference()} for details.
+	 * <p>
+	 * This salt can be used with the constructor 
+	 * {@link JenaFactory#JenaFactory(UUID)}
+	 * if consistent or reproducible {@link BlankNode}s are desirable. 
+	 * 
+	 * @return The {@link UUID} used as salt
+	 */
+	public UUID getSalt() {
+		return salt;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/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
deleted file mode 100644
index a4db1bf..0000000
--- a/jena/src/main/java/org/apache/commons/rdf/jena/JenaRDFTermFactory.java
+++ /dev/null
@@ -1,727 +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;
-
-import java.util.Optional;
-import java.util.UUID;
-import java.util.function.Consumer;
-
-import org.apache.commons.rdf.api.BlankNode;
-import org.apache.commons.rdf.api.BlankNodeOrIRI;
-import org.apache.commons.rdf.api.Dataset;
-import org.apache.commons.rdf.api.Graph;
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.Literal;
-import org.apache.commons.rdf.api.Quad;
-import org.apache.commons.rdf.api.QuadLike;
-import org.apache.commons.rdf.api.RDFSyntax;
-import org.apache.commons.rdf.api.RDFTerm;
-import org.apache.commons.rdf.api.RDFTermFactory;
-import org.apache.commons.rdf.api.Triple;
-import org.apache.commons.rdf.api.TripleLike;
-import org.apache.commons.rdf.jena.impl.InternalJenaFactory;
-import org.apache.jena.datatypes.RDFDatatype;
-import org.apache.jena.datatypes.xsd.XSDDatatype;
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.NodeFactory;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.RDFLanguages;
-import org.apache.jena.riot.system.StreamRDF;
-import org.apache.jena.riot.system.StreamRDFBase;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.graph.GraphFactory;
-
-/**
- * RDFTermFactory with Jena-backed objects.
- * <p>
- * This factory can also convert existing objects from/to Jena with methods like
- * {@link #fromJena(org.apache.jena.graph.Graph)} and {@link #toJena(Graph)}.
- * <p>
- * For the purpose of {@link BlankNode} identity, this factory will use an internal
- * {@link UUID} as a salt. See {@link BlankNode#uniqueReference()} for details.
- * 
- * @see RDFTermFactory
- */
-public final class JenaRDFTermFactory implements RDFTermFactory {
-
-	private static InternalJenaFactory internalJenaFactory = new InternalJenaFactory(){};
-	
-	private final UUID salt;
-
-	/**
-	 * Create a JenaRDFTermFactory.
-	 * <p>
-	 * This constructor will use a randomly generated {@link UUID} as a salt 
-	 * for the purposes of {@link BlankNode} identity, see {@link #getSalt()}.
-	 */
-	public JenaRDFTermFactory() {
-		this.salt = UUID.randomUUID();
-	}
-
-	/**
-	 * Create a JenaRDFTermFactory.
-	 * <p>
-	 * This constructor will use the specified {@link UUID} as a salt for
-	 * the purposes of {@link BlankNode} identity, and should only be used in
-	 * cases where predictable and consistent
-	 * {@link BlankNode#uniqueReference()} are important.
-	 * 
-	 * @param salt
-	 *            {@link UUID} to use as salt for {@link BlankNode} equality
-	 */	
-	public JenaRDFTermFactory(UUID salt) {
-		this.salt = salt;
-	}
-
-	@Override
-	public JenaBlankNode createBlankNode() {
-		return internalJenaFactory.createBlankNode(getSalt());
-	}
-
-	@Override
-	public JenaBlankNode createBlankNode(String name) {
-		return internalJenaFactory.createBlankNode(name, getSalt());
-	}
-	
-	@Override
-	public JenaDataset createDataset() {
-		return internalJenaFactory.createDataset(getSalt());
-	}
-
-	@Override
-	public JenaGraph createGraph() {
-		return internalJenaFactory.createGraph(getSalt());
-	}
-
-	@Override
-	public JenaIRI createIRI(String iri) {
-		validateIRI(iri);
-		return internalJenaFactory.createIRI(iri);
-	}
-
-	@Override
-	public JenaLiteral createLiteral(String lexicalForm) {
-		return internalJenaFactory.createLiteral(lexicalForm);
-	}
-
-	@Override
-	public JenaLiteral createLiteral(String lexicalForm, IRI dataType) {
-		return internalJenaFactory.createLiteralDT(lexicalForm, dataType.getIRIString());
-	}
-
-	@Override
-	public JenaLiteral createLiteral(String lexicalForm, String languageTag) {
-		validateLang(languageTag);
-		return internalJenaFactory.createLiteralLang(lexicalForm, languageTag);
-	}
-
-	@Override
-	public JenaTriple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
-		return internalJenaFactory.createTriple(subject, predicate, object);
-	}
-	
-	@Override
-	public JenaQuad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		return internalJenaFactory.createQuad(subject, predicate, object, graphName);
-	}
-
-	/**
-	 * Create a generalized Jena triple.
-	 * <p>
-	 * The <em>generalized triple</em> supports any {@link RDFTerm} as its
-	 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or
-	 * {@link TripleLike#getObject()}.
-	 *
-	 * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm)
-	 * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
-	 * 
-	 * @param subject
-	 *            The subject of the statement
-	 * @param predicate
-	 *            The predicate of the statement
-	 * @param object
-	 *            The object of the statement
-	 * @return Generalized {@link TripleLike}. Note that the generalized triple
-	 *         does <strong>not</strong> implement {@link Triple#equals(Object)}
-	 *         or {@link Triple#hashCode()}.
-	 */
-	public JenaGeneralizedTripleLike createGeneralizedTriple(
-			RDFTerm subject, RDFTerm predicate, RDFTerm object) {
-		return internalJenaFactory.createGeneralizedTriple(subject, predicate, object);
-	}
-
-	/**
-	 * Create a generalized Jena quad.
-	 * <p>
-	 * The <em>generalized quad</em> supports any {@link RDFTerm} as its
-	 * {@link QuadLike#getSubject()} {@link QuadLike#getPredicate()},
-	 * {@link QuadLike#getObject()} or {@link QuadLike#getObject()}.
-	 * 
-	 * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm)
-	 * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
-	 * 
-	 * @param subject
-	 *            The subject of the statement
-	 * @param predicate
-	 *            The predicate of the statement
-	 * @param object
-	 *            The object of the statement
-	 * @param graphName
-	 *            The graph name of the statement
-	 * @return Generalized {@link QuadLike}. Note that the generalized quad does
-	 *         <strong>not</strong> implement {@link Quad#equals(Object)} or
-	 *         {@link Quad#hashCode()}.
-	 */
-	public JenaGeneralizedQuadLike createGeneralizedQuad(
-			RDFTerm subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
-		return internalJenaFactory.createGeneralizedQuad(subject, predicate, object, graphName);
-	}	
-	/**
-	 * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}.
-	 * <p>
-	 * If {@link Node#isLiteral()}, then the returned value is a {@link Literal}.
-	 * If {@link Node#isURI()}, the returned value is a IRI. If {$@link Node#isBlank()},
-	 * the returned value is a {@link BlankNode}, which will use a {@link UUID}
-	 * salt from this {@link JenaRDFTermFactory} instance in combination with
-	 * {@link Node#getBlankNodeId()} for the purpose of its
-	 * {@link BlankNode#uniqueReference()}.
-	 * 
-	 * @see #fromJena(RDFTermFactory, Node)
-	 * 
-	 * @param node
-	 *            The Jena Node to adapt. It's {@link Node#isConcrete()} must be
-	 *            <code>true</code>.
-	 * @return Adapted {@link JenaRDFTerm}
-	 * @throws ConversionException If the {@link Node} can't be represented as an {@link RDFTerm}, e.g.
-	 *             if the node is not concrete or represents a variable in Jena.
-	 */
-	public JenaRDFTerm fromJena(Node node) throws ConversionException {
-		return internalJenaFactory.fromJena(node, getSalt());
-	}
-
-	/**
-	 * Convert from Jena {@link Node} to any Commons RDF implementation.
-	 * <p>
-	 * Note that if the {@link Node#isBlank()}, then the factory's 
-	 * {@link RDFTermFactory#createBlankNode(String)} will be used, meaning
-	 * that care should be taken if reusing an {@link RDFTermFactory} instance
-	 * for multiple conversion sessions.
-	 * 
-	 * @see #fromJena(Node)
-	 * 
-	 * @param factory {@link RDFTermFactory} to use for creating {@link RDFTerm}.
-	 * @param node
-	 *            The Jena Node to adapt. It's {@link Node#isConcrete()} must be
-	 *            <code>true</code>.
-	 * @return Adapted {@link RDFTerm}
-	 * @throws ConversionException If the {@link Node} can't be represented as an {@link RDFTerm}, e.g.
-	 *             if the node is not concrete or represents a variable in Jena.
-	 */
-	public static RDFTerm fromJena(RDFTermFactory factory, Node node) {
-		if (node == null) {
-			return null;
-		}
-		if (factory instanceof JenaRDFTermFactory) {
-			// No need to convert, just wrap
-			return ((JenaRDFTermFactory) factory).fromJena(node);
-		}
-		if (node.isURI())
-			return factory.createIRI(node.getURI());
-		if (node.isLiteral()) {
-			String lang = node.getLiteralLanguage();
-			if (lang != null && !lang.isEmpty())
-				return factory.createLiteral(node.getLiteralLexicalForm(), lang);
-			if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring))
-				return factory.createLiteral(node.getLiteralLexicalForm());
-			IRI dt = factory.createIRI(node.getLiteralDatatype().getURI());
-			return factory.createLiteral(node.getLiteralLexicalForm(), dt);
-		}
-		if (node.isBlank())
-			// The factory
-			return factory.createBlankNode(node.getBlankNodeLabel());
-		throw new ConversionException("Node is not a concrete RDF Term: " + node);
-	}	
-	
-	/**
-	 * Adapt an existing Jena Triple to CommonsRDF {@link Triple}.
-	 * <p>
-	 * If the triple contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this
-	 * {@link JenaRDFTermFactory} instance in combination with
-	 * {@link Node#getBlankNodeId()} for the purpose of its
-	 * {@link BlankNode#uniqueReference()}.
-	 *
-	 * @see #fromJena(RDFTermFactory, org.apache.jena.graph.Triple)
-	 * 
-	 * @param triple
-	 *            Jena {@link org.apache.jena.graph.Triple} to adapt
-	 * @return Adapted {@link JenaTriple}
-	 * @throws ConversionException
-	 *             if any of the triple's nodes are not concrete or the triple
-	 *             is a generalized triple
-	 */
-	public JenaTriple fromJena(org.apache.jena.graph.Triple triple) throws ConversionException {
-		return internalJenaFactory.fromJena(triple, getSalt());
-	}
-
-	/**
-	 * Adapt a generalized Jena {@link org.apache.jena.graph.Triple} to a CommonsRDF {@link TripleLike}.
-	 * <p>
-	 * The generalized triple supports any {@link RDFTerm} as its {@link TripleLike#getSubject()}
-	 * {@link TripleLike#getPredicate()} or {@link TripleLike#getObject()}.
-	 * <p>
-	 * If the Jena triple contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this
-	 * {@link JenaRDFTermFactory} instance in combination with
-	 * {@link Node#getBlankNodeId()} for the purpose of its
-	 * {@link BlankNode#uniqueReference()}.
-	 *
-	 * @see #fromJena(RDFTermFactory, org.apache.jena.graph.Triple)
-	 * 
-	 * @param triple
-	 *            Jena triple
-	 * @return Adapted {@link TripleLike}. Note that the generalized triple does
-	 *         <strong>not</strong> implement {@link Triple#equals(Object)} or
-	 *         {@link Triple#hashCode()}.
-	 * @throws ConversionException
-	 *             if any of the triple's nodes are not concrete
-	 */
-	public JenaTripleLike fromJenaGeneralized(org.apache.jena.graph.Triple triple) throws ConversionException {
-		return internalJenaFactory.fromJenaGeneralized(triple, getSalt());
-	}
-
-	/**
-	 * Adapt a generalized Jena {@link org.apache.jena.sparql.core.Quad} to a CommonsRDF {@link QuadLike}.
-	 * <p>
-	 * The generalized quad supports any {@link RDFTerm} as its 
-	 * {@link QuadLike#getGraphName()}, 
-	 * {@link QuadLike#getSubject()}
-	 * {@link QuadLike#getPredicate()} or 
-	 * {@link QuadLike#getObject()}. 
-	 * <p>
-	 * If the Jena quad contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this
-	 * {@link JenaRDFTermFactory} instance in combination with
-	 * {@link Node#getBlankNodeId()} for the purpose of its
-	 * {@link BlankNode#uniqueReference()}.
-	 *
-	 * @see #fromJena(org.apache.jena.sparql.core.Quad)
-	 * @see #fromJenaGeneralized(org.apache.jena.graph.Triple)
-	 * 
-	 * @param quad
-	 *            Jena quad
-	 * @return Adapted {@link QuadLike}. Note that the generalized quad does
-	 *         <strong>not</strong> implement {@link Quad#equals(Object)} or
-	 *         {@link Quad#hashCode()}.
-	 * @throws ConversionException
-	 *             if any of the quad nodes are not concrete
-	 */
-	public JenaQuadLike<RDFTerm> fromJenaGeneralized(org.apache.jena.sparql.core.Quad quad) throws ConversionException {
-		return internalJenaFactory.fromJenaGeneralized(quad, getSalt());
-	}
-	
-	/**
-	 * Convert from Jena {@link org.apache.jena.graph.Triple} to a Commons RDF
-	 * {@link Triple}.
-	 * <p>
-	 * Note that if any of the triple's nodes {@link Node#isBlank()}, then the factory's 
-	 * {@link RDFTermFactory#createBlankNode(String)} will be used, meaning
-	 * that care should be taken if reusing an {@link RDFTermFactory} instance
-	 * for multiple conversion sessions.
-	 * 
-	 * @see #fromJena(org.apache.jena.graph.Triple)
-	 *
-	 * @param factory {@link RDFTermFactory} to use for creating the {@link Triple} and its
-	 * {@link RDFTerm}s.
-	 * @param triple
-	 *            Jena triple
-	 * @return Converted triple
-	 * @throws ConversionException
-	 *             if any of the triple's nodes are not concrete or the triple
-	 *             is a generalized triple
-	 */
-	public static Triple fromJena(RDFTermFactory factory, org.apache.jena.graph.Triple triple) 
-			throws ConversionException{
-		if (factory instanceof JenaRDFTermFactory) {
-			// No need to convert, just wrap
-			return ((JenaRDFTermFactory) factory).fromJena(triple);
-		}
-		final BlankNodeOrIRI subject;
-		final IRI predicate;
-		try {
-			subject = (BlankNodeOrIRI) fromJena(factory, triple.getSubject());
-			predicate = (IRI) fromJena(factory, triple.getPredicate());
-		} catch (ClassCastException ex) {
-			throw new ConversionException("Can't convert generalized triple: " + triple, ex);
-		}
-		RDFTerm object = fromJena(factory, triple.getObject());
-		return factory.createTriple(subject, predicate, object);
-	}
-
-	/**
-	 * Adapt an existing Jena {@link org.apache.jena.sparql.core.Quad} to CommonsRDF {@link Quad}.
-	 * <p>
-	 * If the quad contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this 
-	 * {@link JenaRDFTermFactory} instance
-	 * in combination with {@link Node#getBlankNodeId()} 
-	 * for the purpose of its {@link BlankNode#uniqueReference()}.
-	 * 
-	 * @param quad
-	 *            Jena quad
-	 * @return Adapted quad
-	 */	
-	public JenaQuad fromJena(org.apache.jena.sparql.core.Quad quad) {
-		return internalJenaFactory.fromJena(quad, getSalt());
-	}
-
-	/**
-	 * Adapt an existing Jena {@link org.apache.jena.graph.Graph} to CommonsRDF
-	 * {@link Graph}.
-	 * <p>
-	 * This does not take a copy, changes to the CommonsRDF Graph are reflected
-	 * in the jena graph, which is accessible from
-	 * {@link JenaGraph#asJenaGraph()}.
-	 * <p>
-	 * If the graph contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this
-	 * {@link JenaRDFTermFactory} instance in combination with
-	 * {@link Node#getBlankNodeId()} for the purpose of its
-	 * {@link BlankNode#uniqueReference()}.
-	 * 
-	 * @param graph
-	 *            Jena {@link org.apache.jena.graph.Graph} to adapt
-	 * @return Adapted {@link JenaGraph}
-	 */
-	public JenaGraph fromJena(org.apache.jena.graph.Graph graph) {
-		return internalJenaFactory.fromJena(graph, getSalt());
-	}
-
-	/**
-	 * Adapt an existing Jena {@link org.apache.jena.rdf.model.Model} to CommonsRDF {@link Graph}. 
-	 * <p>
-	 * This does not ake a copy, changes to the CommonsRDF Graph are reflected in the jena
-	 * graph, which is accessible from {@link JenaGraph#asJenaGraph()}.
-	 * <p>
-	 * If the graph contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this 
-	 * {@link JenaRDFTermFactory} instance
-	 * in combination with {@link Node#getBlankNodeId()} 
-	 * for the purpose of its {@link BlankNode#uniqueReference()}.
-	 * @param model
-	 *            Jena {@link org.apache.jena.rdf.model.Model} to adapt
-	 * @return Adapted {@link JenaGraph}
-	 */
-	public JenaGraph fromJena(org.apache.jena.rdf.model.Model model) {
-		return internalJenaFactory.fromJena(model, getSalt());
-	}	
-
-	/**
-	 * Adapt an existing Jena {@link DatasetGraph} to CommonsRDF {@link Dataset}. 
-	 * <p>
-	 * This does not
-	 * take a copy, changes to the CommonsRDF Dataset are reflected in the jena
-	 * dataset graph, which is accessible from {@link JenaDataset#asJenaDatasetGraph()}.
-	 * <p>
-	 * If the dataset contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this 
-	 * {@link JenaRDFTermFactory} instance
-	 * in combination with {@link Node#getBlankNodeId()} 
-	 * for the purpose of its {@link BlankNode#uniqueReference()}.
-	 * 
-	 * @param datasetGraph Jena {@link DatasetGraph} to adapt
-	 * @return Adapted {@link JenaDataset} 
-	 */
-	public JenaDataset fromJena(DatasetGraph datasetGraph) {
-		return internalJenaFactory.fromJena(datasetGraph, getSalt());
-	}	
-	
-	/**
-	 * Adapt an existing Jena {@link org.apache.jena.query.Dataset} to CommonsRDF {@link Dataset}. 
-	 * <p>
-	 * This does not
-	 * take a copy, changes to the CommonsRDF Dataset are reflected in the jena
-	 * dataset graph, which is accessible from {@link JenaDataset#asJenaDatasetGraph()}.
-	 * <p>
-	 * If the dataset contains any {@link Node#isBlank()}, then any corresponding
-	 * {@link BlankNode} will use a {@link UUID} salt from this 
-	 * {@link JenaRDFTermFactory} instance
-	 * in combination with {@link Node#getBlankNodeId()} 
-	 * for the purpose of its {@link BlankNode#uniqueReference()}.
-	 * 
-	 * @param datasetGraph Jena {@link org.apache.jena.query.Dataset} to adapt
-	 * @return Adapted {@link JenaDataset} 
-	 */
-	public JenaDataset fromJena(org.apache.jena.query.Dataset datasetGraph) {
-		return internalJenaFactory.fromJena(datasetGraph.asDatasetGraph(), getSalt());
-	}		
-
-	/**
-	 * Convert from Jena {@link org.apache.jena.sparql.core.Quad} to a Commons
-	 * RDF {@link Quad}.
-	 * <p>
-	 * Note that if any of the quad's nodes {@link Node#isBlank()}, then the
-	 * factory's {@link RDFTermFactory#createBlankNode(String)} will be used,
-	 * meaning that care should be taken if reusing an {@link RDFTermFactory}
-	 * instance for multiple conversion sessions.
-	 * 
-	 * @see #fromJena(org.apache.jena.sparql.core.Quad)
-	 * @see #fromJenaGeneralized(org.apache.jena.sparql.core.Quad)
-	 *
-	 * @param factory
-	 *            {@link RDFTermFactory} to use for creating the {@link Triple}
-	 *            and its {@link RDFTerm}s.
-	 * @param quad
-	 *            Jena {@link org.apache.jena.sparql.core.Quad} to adapt
-	 * @return Converted {@link Quad}
-	 * @throws ConversionException
-	 *             if any of the quad's nodes are not concrete or the quad
-	 *             is a generalized quad
-	 */
-	public static Quad fromJena(RDFTermFactory factory, org.apache.jena.sparql.core.Quad quad) {
-		if (factory instanceof JenaRDFTermFactory) {
-			// No need to convert, just wrap
-			return ((JenaRDFTermFactory) factory).fromJena(quad);
-		}
-		BlankNodeOrIRI graphName = (BlankNodeOrIRI) (fromJena(factory, quad.getGraph()));
-		BlankNodeOrIRI subject = (BlankNodeOrIRI) (fromJena(factory, quad.getSubject()));
-		IRI predicate = (IRI) (fromJena(factory, quad.getPredicate()));
-		RDFTerm object = fromJena(factory, quad.getObject());
-		return factory.createQuad(graphName, subject, predicate, object);
-	}
-
-	/**
-	 * Return {@link RDFSyntax} corresponding to a Jena {@link Lang}.
-	 * 
-	 * @param lang {@link Lang} to convert
-	 * @return Matched {@link RDFSyntax}, otherwise {@link Optional#empty()}
-	 */
-	public Optional<RDFSyntax> langToRdfSyntax(Lang lang) {
-		return RDFSyntax.byMediaType(lang.getContentType().getContentType());
-	}
-
-	/**
-	 * Return Jena {@link Lang} corresponding to a {@link RDFSyntax}.
-	 * 
-	 * @param rdfSyntax {@link RDFSyntax} to convert
-	 * @return Matched {@link Lang}, otherwise {@link Optional#empty()}
-	 */
-	public Optional<Lang> rdfSyntaxToLang(RDFSyntax rdfSyntax) {
-		return Optional.ofNullable(RDFLanguages.contentTypeToLang(rdfSyntax.mediaType));
-	}
-
-	/**
-	 * Create a {@link StreamRDF} instance that inserts the converted
-	 * {@link Quad}s. into a the provided {@link Consumer}.
-	 * <p>
-	 * The returned {@link StreamRDF} can be used for instance with Jena's
-	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
-	 * 
-	 * @param factory
-	 *            {@link RDFTermFactory} to use for creating {@link RDFTerm}s
-	 *            and {@link Quad}s.
-	 * @param consumer
-	 *            A {@link Consumer} of {@link Quad}s
-	 * @return A {@link StreamRDF} that will stream converted quads to the
-	 *         consumer
-	 */
-	public static StreamRDF streamJenaToCommonsRDF(RDFTermFactory factory, Consumer<Quad> consumer) {
-		return new StreamRDFBase() {
-			@Override
-			public void quad(org.apache.jena.sparql.core.Quad quad) {
-				consumer.accept(fromJena(factory, quad));
-			}
-		};
-	}
-	
-	/**
-	 * Create a {@link StreamRDF} instance that inserts generalized
-	 * {@link TripleLike}s. into a the provided {@link Consumer}.
-	 * <p>
-	 * A generalized triple allows any {@link RDFTerm} for
-	 * {@link TripleLike#getSubject()}, {@link TripleLike#getPredicate()} and
-	 * {@link TripleLike#getObject()}.
-	 * <p>
-	 * The returned {@link StreamRDF} can be used for instance with Jena's
-	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
-	 * 
-	 * @param generalizedConsumer
-	 *            A {@link Consumer} of generalized {@link TripleLike}s
-	 * @return A {@link StreamRDF} that will stream generalized triples to the
-	 *         consumer
-	 */
-	public StreamRDF streamJenaToGeneralizedTriple(Consumer<TripleLike> generalizedConsumer) {
-		return new StreamRDFBase() {			
-			@Override
-			public void triple(org.apache.jena.graph.Triple triple) {
-				generalizedConsumer.accept(fromJenaGeneralized(triple));
-			}
-		};
-	}	
-
-	/**
-	 * Create a {@link StreamRDF} instance that inserts generalized
-	 * {@link QuadLike}s. into a the provided {@link Consumer}.
-	 * <p>
-	 * A generalized quad allows any {@link RDFTerm} for
-	 * {@link QuadLike#getSubject()}, {@link TripleLike#getPredicate()},
-	 * {@link QuadLike#getObject()} and {@link QuadLike#getGraphName()} .
-	 * <p>
-	 * The returned {@link StreamRDF} can be used for instance with Jena's
-	 * {@link RDFDataMgr#parse(StreamRDF, String)}.
-	 * 
-	 * @param generalizedConsumer
-	 *            A {@link Consumer} of generalized {@link QuadLike}s
-	 * @return A {@link StreamRDF} that will stream generalized quads to the
-	 *         consumer
-	 */
-	public StreamRDF streamJenaToGeneralizedQuad(Consumer<QuadLike<RDFTerm>> generalizedConsumer) {
-		return new StreamRDFBase() {
-			@Override
-			public void quad(org.apache.jena.sparql.core.Quad quad) {
-				generalizedConsumer.accept(fromJenaGeneralized(quad));
-			}
-		};
-	}	
-	
-	/**
-	 * Convert a CommonsRDF Graph to a Jena Graph. If the Graph was from Jena
-	 * originally, return that original object else create a copy using Jena
-	 * objects.
-	 * 
-	 * @param graph Commons RDF {@link Graph} to convert
-	 * @return Converted Jena {@link org.apache.jena.graph.Graph}
-	 */
-	public org.apache.jena.graph.Graph toJena(Graph graph) {
-		if (graph instanceof JenaGraph)
-			return ((JenaGraph) graph).asJenaGraph();
-		org.apache.jena.graph.Graph g = GraphFactory.createGraphMem();
-		graph.stream().forEach(t -> g.add(toJena(t)));
-		return g;
-	}
-
-	/**
-	 * Convert a CommonsRDF RDFTerm to a Jena Node. If the RDFTerm was from Jena
-	 * originally, return that original object, else create a copy using Jena
-	 * objects.
-	 * 
-	 * @param term Commons RDF {@link RDFTerm} to convert
-	 * @return Converted Jena {@link Node}
-	 */
-	public Node toJena(RDFTerm term) {
-		if (term == null) {
-			return null;
-		}
-		if (term instanceof JenaRDFTerm)
-			// TODO: What if it's a JenaBlankNodeImpl with
-			// a different salt? Do we need to rewrite the
-			// jena blanknode identifier?
-			return ((JenaRDFTerm) term).asJenaNode();
-
-		if (term instanceof IRI)
-			return NodeFactory.createURI(((IRI) term).getIRIString());
-
-		if (term instanceof Literal) {
-			Literal lit = (Literal) term;
-			RDFDatatype dt = NodeFactory.getType(lit.getDatatype().getIRIString());
-			String lang = lit.getLanguageTag().orElse("");
-			return NodeFactory.createLiteral(lit.getLexicalForm(), lang, dt);
-		}
-
-		if (term instanceof BlankNode) {
-			String id = ((BlankNode) term).uniqueReference();
-			return NodeFactory.createBlankNode(id);
-		}
-		throw new ConversionException("Not a concrete RDF Term: " + term);
-	}
-
-	/**
-	 * Convert a CommonsRDF {@link Triple} to a Jena
-	 * {@link org.apache.jena.graph.Triple}.
-	 * <p>
-	 * If the triple was from Jena originally, return that original object, else
-	 * create a copy using Jena objects.
-	 * 
-	 * @param triple Commons RDF {@link Triple} to convert
-	 * @return Converted Jena {@link org.apache.jena.graph.Triple}
-	 */
-	public org.apache.jena.graph.Triple toJena(Triple triple) {
-		if (triple instanceof JenaTriple)
-			return ((JenaTriple) triple).asJenaTriple();
-		return org.apache.jena.graph.Triple.create(
-				toJena(triple.getSubject()), 
-				toJena(triple.getPredicate()),
-				toJena(triple.getObject()));
-	}
-
-
-	/**
-	 * Convert a CommonsRDF {@link Quad} to a Jena
-	 * {@link org.apache.jena.sparql.core.Quad}.
-	 * <p>
-	 * If the quad was from Jena originally, return that original object,
-	 * otherwise create a copy using Jena objects.
-	 *
-	 * @param quad Commons RDF {@link Quad} to convert
-	 * @return Converted Jena {@link org.apache.jena.sparql.core.Quad}
-	 */
-	public org.apache.jena.sparql.core.Quad toJena(Quad quad) {
-		if (quad instanceof JenaQuad) {
-			return ((JenaQuad) quad).asJenaQuad();
-		}
-		return org.apache.jena.sparql.core.Quad.create(
-				toJena(quad.getGraphName().orElse(null)),
-				toJena(quad.getSubject()), 
-				toJena(quad.getPredicate()), 
-				toJena(quad.getObject()));
-	}
-
-	// Some simple validations - full IRI parsing is not cheap.
-	private void validateIRI(String iri) {
-		if (iri.contains(" "))
-			throw new IllegalArgumentException();
-		if (iri.contains("<"))
-			throw new IllegalArgumentException();
-		if (iri.contains(">"))
-			throw new IllegalArgumentException();
-	}
-
-	private static void validateLang(String languageTag) {
-		if (languageTag.contains(" "))
-			throw new IllegalArgumentException("Invalid language tag: " + languageTag);
-	}
-
-	/**
-	 * Return the {@link UUID} salt used by this factory.
-	 * <p>
-	 * The salt is used for the purposes of {@link BlankNode} identity, see
-	 * {@link BlankNode#uniqueReference()} for details.
-	 * <p>
-	 * This salt can be used with the constructor 
-	 * {@link JenaRDFTermFactory#JenaRDFTermFactory(UUID)}
-	 * if consistent or reproducible {@link BlankNode}s are desirable. 
-	 * 
-	 * @return The {@link UUID} used as salt
-	 */
-	public UUID getSalt() {
-		return salt;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/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 89d2884..19a8a63 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
@@ -30,7 +30,7 @@ import org.apache.commons.rdf.api.RDFTermFactory;
 import org.apache.commons.rdf.api.TripleLike;
 import org.apache.commons.rdf.experimental.RDFParser;
 import org.apache.commons.rdf.jena.JenaGraph;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaFactory;
 import org.apache.commons.rdf.simple.experimental.AbstractRDFParser;
 import org.apache.jena.graph.Graph;
 import org.apache.jena.riot.Lang;
@@ -44,7 +44,7 @@ public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> implements R
 	private Consumer<QuadLike<RDFTerm>> generalizedConsumerQuad;
 
 	protected RDFTermFactory createRDFTermFactory() {
-		return new JenaRDFTermFactory();
+		return new JenaFactory();
 	}
 
 	public JenaRDFParser targetGeneralizedTriple(Consumer<TripleLike> consumer) {
@@ -71,7 +71,7 @@ public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> implements R
 	@Override
 	protected void parseSynchronusly() throws IOException {
 		StreamRDF dest;
-		JenaRDFTermFactory jenaFactory = getJenaFactory();
+		JenaFactory jenaFactory = getJenaFactory();
 		if (getTargetGraph().isPresent() && getTargetGraph().get() instanceof JenaGraph) {
 			Graph jenaGraph = ((JenaGraph) getTargetGraph().get()).asJenaGraph();
 			dest = StreamRDFLib.graph(jenaGraph);
@@ -81,7 +81,7 @@ public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> implements R
 			} else if (generalizedConsumerTriple != null) {				
 				dest = jenaFactory.streamJenaToGeneralizedTriple(generalizedConsumerTriple);			
 			} else {
-				dest = JenaRDFTermFactory.streamJenaToCommonsRDF(getRdfTermFactory().get(), getTarget());
+				dest = JenaFactory.streamJenaToCommonsRDF(getRdfTermFactory().get(), getTarget());
 			}
 		}
 
@@ -99,9 +99,9 @@ public class JenaRDFParser extends AbstractRDFParser<JenaRDFParser> implements R
 		}
 	}
 
-	private JenaRDFTermFactory getJenaFactory() {
-		return (JenaRDFTermFactory) getRdfTermFactory()
-				.filter(JenaRDFTermFactory.class::isInstance)
+	private JenaFactory getJenaFactory() {
+		return (JenaFactory) getRdfTermFactory()
+				.filter(JenaFactory.class::isInstance)
 				.orElseGet(this::createRDFTermFactory);		
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/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 1846fc0..c66a1da 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
@@ -26,7 +26,7 @@ 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.JenaFactory;
 import org.apache.commons.rdf.jena.JenaTriple;
 import org.apache.jena.graph.Triple;
 import org.apache.jena.sparql.core.Quad;
@@ -86,7 +86,7 @@ abstract class AbstractQuadLike<S extends RDFTerm, P extends RDFTerm, O extends
 
 	@Override
 	public org.apache.jena.sparql.core.Quad asJenaQuad() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory();
+		JenaFactory factory = new JenaFactory();
 		if (quad == null) {
 			quad = org.apache.jena.sparql.core.Quad.create(
 					factory.toJena(graphName.orElse(null)),
@@ -99,7 +99,7 @@ abstract class AbstractQuadLike<S extends RDFTerm, P extends RDFTerm, O extends
 
 	@Override
 	public org.apache.jena.graph.Triple asJenaTriple() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory();
+		JenaFactory factory = new JenaFactory();
 		if (triple == null) {
 			triple = org.apache.jena.graph.Triple.create(
 				factory.toJena(subject), 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java
----------------------------------------------------------------------
diff --git a/jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java b/jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java
index eb09d67..67fccb7 100644
--- a/jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java
+++ b/jena/src/main/java/org/apache/commons/rdf/jena/impl/InternalJenaFactory.java
@@ -35,7 +35,7 @@ import org.apache.commons.rdf.jena.JenaIRI;
 import org.apache.commons.rdf.jena.JenaLiteral;
 import org.apache.commons.rdf.jena.JenaQuad;
 import org.apache.commons.rdf.jena.JenaRDFTerm;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaFactory;
 import org.apache.commons.rdf.jena.JenaTriple;
 import org.apache.jena.graph.Node;
 import org.apache.jena.graph.NodeFactory;
@@ -49,7 +49,7 @@ import org.apache.jena.sparql.graph.GraphFactory;
  * <p>
  * 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}.
+ * instead use {@link JenaFactory}.
  * <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

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/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 5c410ee..67b2988 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
@@ -32,7 +32,7 @@ import org.apache.commons.rdf.api.Quad;
 import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.jena.JenaDataset;
 import org.apache.commons.rdf.jena.JenaGraph;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaFactory;
 import org.apache.jena.atlas.iterator.Iter;
 import org.apache.jena.graph.Node;
 import org.apache.jena.riot.Lang;
@@ -44,12 +44,12 @@ class JenaDatasetImpl implements JenaDataset {
 
 	private DatasetGraph graph;
 	private UUID salt;
-	private JenaRDFTermFactory factory;
+	private JenaFactory factory;
 
 	JenaDatasetImpl(DatasetGraph graph, UUID salt) {
 		this.graph = graph;
 		this.salt = salt;
-		this.factory = new JenaRDFTermFactory(salt);
+		this.factory = new JenaFactory(salt);
 	}
 
 	@Override
@@ -136,14 +136,14 @@ class JenaDatasetImpl implements JenaDataset {
 
 	@Override
 	public Stream<? extends Quad> stream() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.find(ANY, ANY, ANY, ANY), true)
 				.map(factory::fromJena);
 	}
 
 	@Override
 	public Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> g, BlankNodeOrIRI s, IRI p, RDFTerm o) {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.find(toJenaPattern(g), toJenaPattern(s), toJenaPattern(p), toJenaPattern(o)), true)
 				.map(factory::fromJena);
 	}
@@ -175,14 +175,14 @@ class JenaDatasetImpl implements JenaDataset {
 
 	@Override
 	public Stream<BlankNodeOrIRI> getGraphNames() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.listGraphNodes()).map(node -> 
 			(BlankNodeOrIRI) factory.fromJena(node));		
 	}
 
 	@Override
 	public Iterable<Quad> iterate() {
-		final JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		final JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.find(), false)
 				.map(q -> (Quad) factory.fromJena(q))
 				::iterator;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/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 09cc2ab..bad996a 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
@@ -27,7 +27,7 @@ import org.apache.commons.rdf.api.IRI;
 import org.apache.commons.rdf.api.RDFTerm;
 import org.apache.commons.rdf.api.Triple;
 import org.apache.commons.rdf.jena.JenaGraph;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaFactory;
 import org.apache.jena.atlas.iterator.Iter;
 import org.apache.jena.graph.Node;
 import org.apache.jena.rdf.model.Model;
@@ -39,20 +39,20 @@ class JenaGraphImpl implements JenaGraph {
 
 	private final org.apache.jena.graph.Graph graph;
 	private final UUID salt;
-	private final transient JenaRDFTermFactory factory;
+	private final transient JenaFactory factory;
 	private Model model;
 
 	JenaGraphImpl(org.apache.jena.graph.Graph graph, UUID salt) {
 		this.graph = graph;
 		this.salt = salt;
-		this.factory = new JenaRDFTermFactory(salt);
+		this.factory = new JenaFactory(salt);
 	}
 
 	JenaGraphImpl(Model model, UUID salt) {
 		this.model = model;
 		this.graph = model.getGraph();
 		this.salt = salt;
-		this.factory = new JenaRDFTermFactory(salt);
+		this.factory = new JenaFactory(salt);
 	}
 
 	@Override
@@ -116,13 +116,13 @@ class JenaGraphImpl implements JenaGraph {
 
 	@Override
 	public Stream<? extends Triple> stream() {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.find(null, null, null), true).map(factory::fromJena);
 	}
 
 	@Override
 	public Stream<? extends Triple> stream(BlankNodeOrIRI s, IRI p, RDFTerm o) {
-		JenaRDFTermFactory factory = new JenaRDFTermFactory(salt);
+		JenaFactory factory = new JenaFactory(salt);
 		return Iter.asStream(graph.find(toJenaAny(s), toJenaAny(p), toJenaAny(o)), true)
 				.map(factory::fromJena);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
index e2749bb..ebccc6e 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
@@ -25,7 +25,7 @@ public class TestGraphJena extends AbstractGraphTest {
 
     @Override
     public RDFTermFactory createFactory() {
-        return new JenaRDFTermFactory() ;
+        return new JenaFactory() ;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
index 2668343..1a7b4e0 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
@@ -56,10 +56,10 @@ public class TestJenaGraphToCommonsRDFGraph {
         RDFDataMgr.read(jGraph, turtleFile.toUri().toString()) ;
         
         // "graph" is a CommonsRDF graph 
-        Graph graph = new JenaRDFTermFactory().fromJena(jGraph) ;
+        Graph graph = new JenaFactory().fromJena(jGraph) ;
         
         // Add to CommonsRDF Graph
-        RDFTermFactory rft = new JenaRDFTermFactory() ;
+        RDFTermFactory rft = new JenaFactory() ;
         graph.add(rft.createIRI("http://example/s2"),
                   rft.createIRI("http://example/p2"),
                   rft.createLiteral("foo")) ;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
index cd57a0e..b5b3363 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
@@ -54,7 +54,7 @@ public class TestRDFParserBuilder {
 
 	@Test
 	public void parseTurtle() throws Exception {
-		Graph g = new JenaRDFTermFactory().createGraph();
+		Graph g = new JenaFactory().createGraph();
 		Future<ParseResult> gFuture = new JenaRDFParser().contentType(RDFSyntax.TURTLE).source(turtleFile)
 				.target(g).parse();
 		gFuture.get(5, TimeUnit.SECONDS);

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
index 4baec9c..ae423da 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
@@ -25,7 +25,7 @@ public class TestRDFTermFactoryJena extends AbstractRDFTermFactoryTest {
 	
     @Override
     public RDFTermFactory createFactory() {
-        return new JenaRDFTermFactory() ;
+        return new JenaFactory() ;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/ec8a4aca/src/site/markdown/implementations.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/implementations.md b/src/site/markdown/implementations.md
index 0e4ab9b..f518861 100644
--- a/src/site/markdown/implementations.md
+++ b/src/site/markdown/implementations.md
@@ -92,15 +92,15 @@ Graph graph = rdfTermFactory.createGraph();
 ```java
 import org.apache.commons.rdf.api.Graph;
 import org.apache.commons.rdf.api.RDFTermFactory;
-import org.apache.commons.rdf.jena.JenaRDFTermFactory;
+import org.apache.commons.rdf.jena.JenaFactory;
 
-RDFTermFactory rdfTermFactory = new JenaRDFTermFactory();
+RDFTermFactory rdfTermFactory = new JenaFactory();
 Graph graph = rdfTermFactory.createGraph();
 ```
 
-Objects created with  [JenaRDFTermFactory](apidocs/org/apache/commons/rdf/jena/JenaRDFTermFactory.html) implement interfaces like [JenaQuad](apidocs/org/apache/commons/rdf/jena/JenaQuad.html) and [JenaLiteral](apidocs/org/apache/commons/rdf/jena/JenaLiteral.html) which give access to the underlying Jena objects through methods like [asJenaNode()](apidocs/org/apache/commons/rdf/jena/JenaRDFTerm.html#asJenaNode--) and [asJenaGraph()](apidocs/org/apache/commons/rdf/jena/JenaGraph.html#asJenaGraph--).
+Objects created with  [JenaFactory](apidocs/org/apache/commons/rdf/jena/JenaFactory.html) implement interfaces like [JenaQuad](apidocs/org/apache/commons/rdf/jena/JenaQuad.html) and [JenaLiteral](apidocs/org/apache/commons/rdf/jena/JenaLiteral.html) which give access to the underlying Jena objects through methods like [asJenaNode()](apidocs/org/apache/commons/rdf/jena/JenaRDFTerm.html#asJenaNode--) and [asJenaGraph()](apidocs/org/apache/commons/rdf/jena/JenaGraph.html#asJenaGraph--).
 
-`JenaRDFTermFactory` includes additional methods for converting from/to Apache Jena and Commons RDF, like [fromJena(Node)](apidocs/org/apache/commons/rdf/jena/JenaRDFTermFactory.html#fromJena-org.apache.jena.graph.Node-) and [toJena(RDFTerm)](apidocs/org/apache/commons/rdf/jena/JenaRDFTermFactory.html#toJena-org.apache.commons.rdf.api.RDFTerm-).
+`JenaFactory` includes additional methods for converting from/to Apache Jena and Commons RDF, like [fromJena(Node)](apidocs/org/apache/commons/rdf/jena/JenaFactory.html#fromJena-org.apache.jena.graph.Node-) and [toJena(RDFTerm)](apidocs/org/apache/commons/rdf/jena/JenaFactory.html#toJena-org.apache.commons.rdf.api.RDFTerm-).
 
 #### Generalized RDF
 
@@ -108,7 +108,7 @@ Apache Jena can support [generalized RDF](https://www.w3.org/TR/rdf11-concepts/#
 
 > A generalized RDF triple is a triple having a subject, a predicate, and object, where each can be an IRI, a blank node or a literal.
 
-Within Commons RDF it is possible to create [generalized triples](apidocs/org/apache/commons/rdf/jena/JenaRDFTermFactory.html#createGeneralizedTriple-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) and [quads](apidocs/org/apache/commons/rdf/jena/JenaRDFTermFactory.html#createGeneralizedQuad-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) using `JenaRDFTermFactory` - however note that the returned [JenaGeneralizedTripleLike](apidocs/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.html) and
+Within Commons RDF it is possible to create [generalized triples](apidocs/org/apache/commons/rdf/jena/JenaFactory.html#createGeneralizedTriple-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) and [quads](apidocs/org/apache/commons/rdf/jena/JenaFactory.html#createGeneralizedQuad-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-org.apache.commons.rdf.api.RDFTerm-) using `JenaFactory` - however note that the returned [JenaGeneralizedTripleLike](apidocs/org/apache/commons/rdf/jena/JenaGeneralizedTripleLike.html) and
 [JenaGeneralizedQuadLike](apidocs/org/apache/commons/rdf/jena/JenaGeneralizedQuadLike.html)
  do not have the [equality semantics of Triple](apidocs/org/apache/commons/rdf/api/Triple.html#equals-java.lang.Object-) or [Quad](apidocs/org/apache/commons/rdf/api/Quad.html#equals-java.lang.Object-) and thus can't be used with the regular [Graph](apidocs/org/apache/commons/rdf/api/Graph.html) or [Dataset](apidocs/org/apache/commons/rdf/api/Dataset.html) methods.
 


Mime
View raw message