commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [3/4] incubator-commonsrdf git commit: Added createGeneralizedQuad()
Date Thu, 29 Sep 2016 14:58:01 GMT
Added createGeneralizedQuad()

See
https://github.com/apache/incubator-commonsrdf/pull/23#pullrequestreview-2147436


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

Branch: refs/heads/jena
Commit: fe8104a2940822646b2bf95a83bc6d4532bdcef8
Parents: 2462a95
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Thu Sep 29 15:50:47 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Thu Sep 29 15:50:47 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/jena/JenaRDFTermFactory.java    | 78 ++++++++++++++------
 1 file changed, 56 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fe8104a2/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 d8406b8..9a58ce7 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
@@ -137,32 +137,37 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 			throws IllegalArgumentException, UnsupportedOperationException {
 		return JenaFactory.createQuad(subject, predicate, object, graphName);
 	}
+
+	public JenaAny createAnyVariable() {
+		return JenaFactory.createAnyVariable();
+	}
+	
+	public JenaVariable createVariable(String variableName) {
+		return JenaFactory.createVariable(variableName);
+	}
 	
 	/**
-	 * Adapt a generalized Jena Triple to a CommonsRDF {@link TripleLike} statement.
+	 * Create a generalized Jena triple.
 	 * <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()}.
+	 * The <em>generalized triple</em> supports any {@link RDFTerm} as its
+	 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or
+	 * {@link TripleLike#getObject()}, including {@link JenaAny} or
+	 * {@link JenaVariable}.
 	 *
-	 * @see #fromJena(org.apache.jena.graph.Triple, UUID)
-	 * @see #fromJena(RDFTermFactory, org.apache.jena.graph.Triple)
-	 * 
-	 * @param subject The subject of the statement
-	 * @param predicate The predicate of the statement
-	 * @param object The object of the statement
-
-	 *            
-	 * @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
+	 * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm)
+	 * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm)
+	 * @see #createAnyVariable()
+	 * @see #createVariable(String)
+	 * 
+	 * @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 JenaTripleLike<RDFTerm, RDFTerm, RDFTerm> createGeneralizedTriple(
 			RDFTerm subject, RDFTerm predicate, RDFTerm object) {
@@ -170,6 +175,35 @@ public final class JenaRDFTermFactory implements RDFTermFactory {
 	}
 
 	/**
+	 * 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()} including
+	 * {@link JenaAny} or {@link JenaVariable}.
+	 * 
+	 * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm)
+	 * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm)
+	 * @see #createAnyVariable()
+	 * @see #createVariable(String)
+	 * 
+	 * @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 JenaQuadLike<RDFTerm, RDFTerm, RDFTerm, RDFTerm> createGeneralizedQuad(
+			RDFTerm subject, RDFTerm predicate, RDFTerm object, RDFTerm graphName) {
+		return JenaFactory.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}.


Mime
View raw message