commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [15/50] incubator-commonsrdf git commit: JenaRDFTermFactory javadoc on constructors
Date Fri, 07 Oct 2016 14:22:28 GMT
JenaRDFTermFactory javadoc on constructors


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

Branch: refs/heads/master
Commit: 7fb1d8895c5947b54fec2f23d4e3d900414dade1
Parents: 361aaba
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Thu Sep 8 15:28:00 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Thu Sep 8 15:28:00 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/jena/JenaRDFTermFactory.java    | 58 +++++++++++++++-----
 1 file changed, 43 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/7fb1d889/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 a75b61e..f393cec 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
@@ -52,39 +52,56 @@ import org.apache.jena.sparql.graph.GraphFactory;
  * <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 UUID salt;
+	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.
+	 * 
+	 * @param salt {@link UUID} to use as salt
+	 */	
 	public JenaRDFTermFactory(UUID salt) {
 		this.salt = salt;
 	}
 
 	@Override
 	public JenaBlankNode createBlankNode() {
-		return JenaFactory.createBlankNode(salt);
+		return JenaFactory.createBlankNode(getSalt());
 	}
 
 	@Override
 	public JenaBlankNode createBlankNode(String name) {
-		return JenaFactory.createBlankNode(name, salt);
+		return JenaFactory.createBlankNode(name, getSalt());
 	}
 	
 	@Override
 	public Dataset createDataset() {
-		return JenaFactory.createDataset(salt);
+		return JenaFactory.createDataset(getSalt());
 	}
 
 	@Override
 	public JenaGraph createGraph() {
-		return JenaFactory.createGraph(salt);
+		return JenaFactory.createGraph(getSalt());
 	}
 
 	@Override
@@ -168,7 +185,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 *             if the node is not concrete.
 	 */
 	public JenaRDFTerm fromJena(Node node) throws ConversionException {
-		return JenaFactory.fromJena(node, salt);
+		return JenaFactory.fromJena(node, getSalt());
 	}
 
 	/**
@@ -259,7 +276,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, salt);
+		return JenaFactory.fromJena(triple, getSalt());
 	}
 
 
@@ -318,7 +335,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, salt);
+		return JenaFactory.fromJenaGeneralized(triple, getSalt());
 	}
 
 	/**
@@ -350,7 +367,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, salt);
+		return JenaFactory.fromJenaGeneralized(quad, getSalt());
 	}
 	
 	
@@ -428,7 +445,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted quad
 	 */	
 	public Quad fromJena(org.apache.jena.sparql.core.Quad quad) {
-		return JenaFactory.fromJena(quad, salt);
+		return JenaFactory.fromJena(quad, getSalt());
 	}
 	
 	/**
@@ -464,7 +481,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 
 	 */
 	public JenaGraph fromJena(org.apache.jena.graph.Graph graph) {
-		return JenaFactory.fromJena(graph, salt);
+		return JenaFactory.fromJena(graph, getSalt());
 	}
 
 	/**
@@ -481,7 +498,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 
 	 */
 	public JenaGraph fromJena(org.apache.jena.rdf.model.Model model) {
-		return JenaFactory.fromJena(model, salt);
+		return JenaFactory.fromJena(model, getSalt());
 	}	
 
 	/**
@@ -521,7 +538,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted dataset 
 	 */
 	public JenaDataset fromJena(DatasetGraph datasetGraph) {
-		return JenaFactory.fromJena(datasetGraph, salt);
+		return JenaFactory.fromJena(datasetGraph, getSalt());
 	}	
 	
 	/**
@@ -541,7 +558,7 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	 * @return Adapted dataset 
 	 */
 	public JenaDataset fromJena(org.apache.jena.query.Dataset datasetGraph) {
-		return JenaFactory.fromJena(datasetGraph.asDatasetGraph(), salt);
+		return JenaFactory.fromJena(datasetGraph.asDatasetGraph(), getSalt());
 	}		
 	
 	/**
@@ -582,7 +599,6 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 		return g;
 	}
 
-
 	public static Quad fromJena(RDFTermFactory factory, org.apache.jena.sparql.core.Quad quad)
{
 		if (factory instanceof JenaRDFTermFactory) {
 			// No need to convert, just wrap
@@ -737,4 +753,16 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 			throw new IllegalArgumentException("Invalid language tag: " + languageTag);
 	}
 
+	/**
+	 * Return the {@link UUID} salt.
+	 * <p>
+	 * The salt is used for the purposes of {@link BlankNode} identity, see
+	 * {@link BlankNode#uniqueReference()} for details.
+	 * 
+	 * @return The {@link UUID} used as salt
+	 */
+	public UUID getSalt() {
+		return salt;
+	}
+
 }


Mime
View raw message