Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E5235200C24 for ; Thu, 9 Feb 2017 01:35:36 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E3EDD160B49; Thu, 9 Feb 2017 00:35:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB1B1160B79 for ; Thu, 9 Feb 2017 01:35:33 +0100 (CET) Received: (qmail 60403 invoked by uid 500); 9 Feb 2017 00:35:33 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 60354 invoked by uid 99); 9 Feb 2017 00:35:33 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2017 00:35:33 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 5FE823A3C9F for ; Thu, 9 Feb 2017 00:35:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1006435 [14/18] - in /websites/production/commons/content/proper/commons-rdf-parent: ./ apidocs/ apidocs/org/apache/commons/rdf/api/ apidocs/org/apache/commons/rdf/api/class-use/ apidocs/org/apache/commons/rdf/jena/ apidocs/org/apache/comm... Date: Thu, 09 Feb 2017 00:35:29 -0000 To: notifications@commons.apache.org From: stain@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170209003531.5FE823A3C9F@svn01-us-west.apache.org> archived-at: Thu, 09 Feb 2017 00:35:37 -0000 Modified: websites/production/commons/content/proper/commons-rdf-parent/xref/org/apache/commons/rdf/jena/JenaRDF.html ============================================================================== --- websites/production/commons/content/proper/commons-rdf-parent/xref/org/apache/commons/rdf/jena/JenaRDF.html (original) +++ websites/production/commons/content/proper/commons-rdf-parent/xref/org/apache/commons/rdf/jena/JenaRDF.html Thu Feb 9 00:35:28 2017 @@ -159,620 +159,652 @@ 151 return internalJenaFactory.createTriple(subject, predicate, object); 152 } 153 -154 @Override -155 public JenaQuad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) -156 throws IllegalArgumentException, UnsupportedOperationException { -157 return internalJenaFactory.createQuad(subject, predicate, object, graphName); -158 } -159 -160 /** -161 * Create a generalized Jena triple. -162 * <p> -163 * The <em>generalized triple</em> supports any {@link RDFTerm} as its -164 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or -165 * {@link TripleLike#getObject()}. -166 * -167 * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm) -168 * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm) -169 * -170 * @param subject -171 * The subject of the statement -172 * @param predicate -173 * The predicate of the statement -174 * @param object -175 * The object of the statement -176 * @return Generalized {@link TripleLike}. Note that the generalized triple -177 * does <strong>not</strong> implement {@link Triple#equals(Object)} -178 * or {@link Triple#hashCode()}. -179 */ -180 public JenaGeneralizedTripleLike createGeneralizedTriple(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object) { -181 return internalJenaFactory.createGeneralizedTriple(subject, predicate, object); -182 } -183 -184 /** -185 * Create a generalized Jena quad. -186 * <p> -187 * The <em>generalized quad</em> supports any {@link RDFTerm} as its -188 * {@link QuadLike#getSubject()} {@link QuadLike#getPredicate()}, -189 * {@link QuadLike#getObject()} or {@link QuadLike#getObject()}. -190 * -191 * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm) -192 * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm) -193 * -194 * @param subject -195 * The subject of the statement -196 * @param predicate -197 * The predicate of the statement -198 * @param object -199 * The object of the statement -200 * @param graphName -201 * The graph name of the statement -202 * @return Generalized {@link QuadLike}. Note that the generalized quad does -203 * <strong>not</strong> implement {@link Quad#equals(Object)} or -204 * {@link Quad#hashCode()}. -205 */ -206 public JenaGeneralizedQuadLike createGeneralizedQuad(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object, -207 final RDFTerm graphName) { -208 return internalJenaFactory.createGeneralizedQuad(subject, predicate, object, graphName); -209 } -210 -211 /** -212 * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}. -213 * <p> -214 * If {@link Node#isLiteral()}, then the returned value is a -215 * {@link Literal}. If {@link Node#isURI()}, the returned value is a IRI. If -216 * {$@link Node#isBlank()}, the returned value is a {@link BlankNode}, which -217 * will use a {@link UUID} salt from this {@link JenaRDF} instance in -218 * combination with {@link Node#getBlankNodeId()} for the purpose of its -219 * {@link BlankNode#uniqueReference()}. -220 * -221 * @see #asRDFTerm(RDF, Node) -222 * -223 * @param node -224 * The Jena Node to adapt. It's {@link Node#isConcrete()} must be -225 * <code>true</code>. -226 * @return Adapted {@link JenaRDFTerm} -227 * @throws ConversionException -228 * If the {@link Node} can't be represented as an -229 * {@link RDFTerm}, e.g. if the node is not concrete or -230 * represents a variable in Jena. -231 */ -232 public JenaRDFTerm asRDFTerm(final Node node) throws ConversionException { -233 return internalJenaFactory.createRDFTerm(node, salt()); -234 } -235 -236 /** -237 * Convert from Jena {@link Node} to any Commons RDF implementation. -238 * <p> -239 * Note that if the {@link Node#isBlank()}, then the factory's -240 * {@link RDF#createBlankNode(String)} will be used, meaning that care -241 * should be taken if reusing an {@link RDF} instance for multiple -242 * conversion sessions. -243 * -244 * @see #asRDFTerm(Node) -245 * -246 * @param factory -247 * {@link RDF} to use for creating {@link RDFTerm}. -248 * @param node -249 * The Jena Node to adapt. It's {@link Node#isConcrete()} must be -250 * <code>true</code>. -251 * @return Adapted {@link RDFTerm} -252 * @throws ConversionException -253 * If the {@link Node} can't be represented as an -254 * {@link RDFTerm}, e.g. if the node is not concrete or -255 * represents a variable in Jena. -256 */ -257 public static RDFTerm asRDFTerm(final RDF factory, final Node node) { -258 if (node == null) { -259 return null; -260 } -261 if (factory instanceof JenaRDF) { -262 // No need to convert, just wrap -263 return ((JenaRDF) factory).asRDFTerm(node); -264 } -265 if (node.isURI()) { -266 return factory.createIRI(node.getURI()); -267 } -268 if (node.isLiteral()) { -269 final String lang = node.getLiteralLanguage(); -270 if (lang != null && !lang.isEmpty()) { -271 return factory.createLiteral(node.getLiteralLexicalForm(), lang); -272 } -273 if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring)) { -274 return factory.createLiteral(node.getLiteralLexicalForm()); -275 } -276 final IRI dt = factory.createIRI(node.getLiteralDatatype().getURI()); -277 return factory.createLiteral(node.getLiteralLexicalForm(), dt); -278 } -279 if (node.isBlank()) { -280 // The factory -281 return factory.createBlankNode(node.getBlankNodeLabel()); -282 } -283 throw new ConversionException("Node is not a concrete RDF Term: " + node); -284 } -285 -286 /** -287 * Adapt an existing Jena Triple to CommonsRDF {@link Triple}. -288 * <p> -289 * If the triple contains any {@link Node#isBlank()}, then any corresponding -290 * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} -291 * instance in combination with {@link Node#getBlankNodeId()} for the -292 * purpose of its {@link BlankNode#uniqueReference()}. -293 * -294 * @see #asTriple(RDF, org.apache.jena.graph.Triple) -295 * -296 * @param triple -297 * Jena {@link org.apache.jena.graph.Triple} to adapt -298 * @return Adapted {@link JenaTriple} -299 * @throws ConversionException -300 * if any of the triple's nodes are not concrete or the triple -301 * is a generalized triple -302 */ -303 public JenaTriple asTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { -304 return internalJenaFactory.createTriple(triple, salt()); -305 } -306 -307 /** -308 * Adapt a generalized Jena {@link org.apache.jena.graph.Triple} to a -309 * CommonsRDF {@link TripleLike}. -310 * <p> -311 * The generalized triple supports any {@link RDFTerm} as its -312 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or -313 * {@link TripleLike#getObject()}. -314 * <p> -315 * If the Jena triple contains any {@link Node#isBlank()}, then any -316 * corresponding {@link BlankNode} will use a {@link UUID} salt from this -317 * {@link JenaRDF} instance in combination with -318 * {@link Node#getBlankNodeId()} for the purpose of its -319 * {@link BlankNode#uniqueReference()}. -320 * -321 * @see #asTriple(RDF, org.apache.jena.graph.Triple) -322 * -323 * @param triple -324 * Jena triple -325 * @return Adapted {@link TripleLike}. Note that the generalized triple does -326 * <strong>not</strong> implement {@link Triple#equals(Object)} or -327 * {@link Triple#hashCode()}. -328 * @throws ConversionException -329 * if any of the triple's nodes are not concrete -330 */ -331 public JenaTripleLike asGeneralizedTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { -332 return internalJenaFactory.createGeneralizedTriple(triple, salt()); -333 } -334 -335 /** -336 * Adapt a generalized Jena {@link org.apache.jena.sparql.core.Quad} to a -337 * CommonsRDF {@link QuadLike}. -338 * <p> -339 * The generalized quad supports any {@link RDFTerm} as its -340 * {@link QuadLike#getGraphName()}, {@link QuadLike#getSubject()} -341 * {@link QuadLike#getPredicate()} or {@link QuadLike#getObject()}. -342 * <p> -343 * If the Jena quad contains any {@link Node#isBlank()}, then any -344 * corresponding {@link BlankNode} will use a {@link UUID} salt from this -345 * {@link JenaRDF} instance in combination with -346 * {@link Node#getBlankNodeId()} for the purpose of its -347 * {@link BlankNode#uniqueReference()}. -348 * -349 * @see #asQuad(org.apache.jena.sparql.core.Quad) -350 * @see #asGeneralizedTriple(org.apache.jena.graph.Triple) -351 * -352 * @param quad -353 * Jena quad -354 * @return Adapted {@link QuadLike}. Note that the generalized quad does -355 * <strong>not</strong> implement {@link Quad#equals(Object)} or -356 * {@link Quad#hashCode()}. -357 * @throws ConversionException -358 * if any of the quad nodes are not concrete -359 */ -360 public JenaQuadLike<RDFTerm> asGeneralizedQuad(final org.apache.jena.sparql.core.Quad quad) throws ConversionException { -361 return internalJenaFactory.createGeneralizedQuad(quad, salt()); -362 } -363 -364 /** -365 * Convert from Jena {@link org.apache.jena.graph.Triple} to a Commons RDF -366 * {@link Triple}. -367 * <p> -368 * Note that if any of the triple's nodes {@link Node#isBlank()}, then the -369 * factory's {@link RDF#createBlankNode(String)} will be used, meaning that -370 * care should be taken if reusing an {@link RDF} instance for multiple -371 * conversion sessions. -372 * -373 * @see #asTriple(org.apache.jena.graph.Triple) -374 * -375 * @param factory -376 * {@link RDF} to use for creating the {@link Triple} and its -377 * {@link RDFTerm}s. -378 * @param triple -379 * Jena triple -380 * @return Converted triple +154 /** +155 * {@inheritDoc} +156 * <p> +157 * In addition to supporting a <code>graphName</code> of <code>null</code> +158 * for representing a triple in the <em>default graph</em>, this method also +159 * recognize a {@link JenaIRI} which {@link JenaRDFTerm#asJenaNode()} +160 * represent the default graph according to +161 * {@link org.apache.jena.sparql.core.Quad#isDefaultGraph(Node)}, in which +162 * case the returned JenaQuad will have a {@link Quad#getGraphName()} of +163 * {@link Optional#empty()} rather than the provided IRI. +164 * +165 */ +166 @Override +167 public JenaQuad createQuad(final BlankNodeOrIRI graphName, final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) +168 throws IllegalArgumentException, UnsupportedOperationException { +169 return internalJenaFactory.createQuad(subject, predicate, object, graphName); +170 } +171 +172 /** +173 * Create a generalized Jena triple. +174 * <p> +175 * The <em>generalized triple</em> supports any {@link RDFTerm} as its +176 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or +177 * {@link TripleLike#getObject()}. +178 * +179 * @see #createTriple(BlankNodeOrIRI, IRI, RDFTerm) +180 * @see #createGeneralizedQuad(RDFTerm, RDFTerm, RDFTerm, RDFTerm) +181 * +182 * @param subject +183 * The subject of the statement +184 * @param predicate +185 * The predicate of the statement +186 * @param object +187 * The object of the statement +188 * @return Generalized {@link TripleLike}. Note that the generalized triple +189 * does <strong>not</strong> implement {@link Triple#equals(Object)} +190 * or {@link Triple#hashCode()}. +191 */ +192 public JenaGeneralizedTripleLike createGeneralizedTriple(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object) { +193 return internalJenaFactory.createGeneralizedTriple(subject, predicate, object); +194 } +195 +196 /** +197 * Create a generalized Jena quad. +198 * <p> +199 * The <em>generalized quad</em> supports any {@link RDFTerm} as its +200 * {@link QuadLike#getSubject()} {@link QuadLike#getPredicate()}, +201 * {@link QuadLike#getObject()} or {@link QuadLike#getObject()}. +202 * <p> +203 * In addition to supporting a <code>graphName</code> of <code>null</code> +204 * for representing a triple in the <em>default graph</em>, this method also +205 * recognize a {@link JenaIRI} which {@link JenaRDFTerm#asJenaNode()} +206 * represent the default graph according to +207 * {@link org.apache.jena.sparql.core.Quad#isDefaultGraph(Node)}, in which +208 * case the returned JenaQuad will have a {@link Quad#getGraphName()} of +209 * {@link Optional#empty()} rather than the provided IRI. +210 * +211 * @see #createQuad(BlankNodeOrIRI, BlankNodeOrIRI, IRI, RDFTerm) +212 * @see #createGeneralizedTriple(RDFTerm, RDFTerm, RDFTerm) +213 * +214 * @param subject +215 * The subject of the statement +216 * @param predicate +217 * The predicate of the statement +218 * @param object +219 * The object of the statement +220 * @param graphName +221 * The graph name of the statement +222 * @return Generalized {@link QuadLike}. Note that the generalized quad does +223 * <strong>not</strong> implement {@link Quad#equals(Object)} or +224 * {@link Quad#hashCode()}. +225 */ +226 public JenaGeneralizedQuadLike createGeneralizedQuad(final RDFTerm subject, final RDFTerm predicate, final RDFTerm object, +227 final RDFTerm graphName) { +228 return internalJenaFactory.createGeneralizedQuad(subject, predicate, object, graphName); +229 } +230 +231 /** +232 * Adapt an existing Jena Node to CommonsRDF {@link RDFTerm}. +233 * <p> +234 * If {@link Node#isLiteral()}, then the returned value is a +235 * {@link Literal}. If {@link Node#isURI()}, the returned value is a IRI. If +236 * {$@link Node#isBlank()}, the returned value is a {@link BlankNode}, which +237 * will use a {@link UUID} salt from this {@link JenaRDF} instance in +238 * combination with {@link Node#getBlankNodeId()} for the purpose of its +239 * {@link BlankNode#uniqueReference()}. +240 * +241 * @see #asRDFTerm(RDF, Node) +242 * +243 * @param node +244 * The Jena Node to adapt. It's {@link Node#isConcrete()} must be +245 * <code>true</code>. +246 * @return Adapted {@link JenaRDFTerm} +247 * @throws ConversionException +248 * If the {@link Node} can't be represented as an +249 * {@link RDFTerm}, e.g. if the node is not concrete or +250 * represents a variable in Jena. +251 */ +252 public JenaRDFTerm asRDFTerm(final Node node) throws ConversionException { +253 return internalJenaFactory.createRDFTerm(node, salt()); +254 } +255 +256 /** +257 * Convert from Jena {@link Node} to any Commons RDF implementation. +258 * <p> +259 * Note that if the {@link Node#isBlank()}, then the factory's +260 * {@link RDF#createBlankNode(String)} will be used, meaning that care +261 * should be taken if reusing an {@link RDF} instance for multiple +262 * conversion sessions. +263 * +264 * @see #asRDFTerm(Node) +265 * +266 * @param factory +267 * {@link RDF} to use for creating {@link RDFTerm}. +268 * @param node +269 * The Jena Node to adapt. It's {@link Node#isConcrete()} must be +270 * <code>true</code>. +271 * @return Adapted {@link RDFTerm} +272 * @throws ConversionException +273 * If the {@link Node} can't be represented as an +274 * {@link RDFTerm}, e.g. if the node is not concrete or +275 * represents a variable in Jena. +276 */ +277 public static RDFTerm asRDFTerm(final RDF factory, final Node node) { +278 if (node == null) { +279 return null; +280 } +281 if (factory instanceof JenaRDF) { +282 // No need to convert, just wrap +283 return ((JenaRDF) factory).asRDFTerm(node); +284 } +285 if (node.isURI()) { +286 return factory.createIRI(node.getURI()); +287 } +288 if (node.isLiteral()) { +289 final String lang = node.getLiteralLanguage(); +290 if (lang != null && !lang.isEmpty()) { +291 return factory.createLiteral(node.getLiteralLexicalForm(), lang); +292 } +293 if (node.getLiteralDatatype().equals(XSDDatatype.XSDstring)) { +294 return factory.createLiteral(node.getLiteralLexicalForm()); +295 } +296 final IRI dt = factory.createIRI(node.getLiteralDatatype().getURI()); +297 return factory.createLiteral(node.getLiteralLexicalForm(), dt); +298 } +299 if (node.isBlank()) { +300 // The factory +301 return factory.createBlankNode(node.getBlankNodeLabel()); +302 } +303 throw new ConversionException("Node is not a concrete RDF Term: " + node); +304 } +305 +306 /** +307 * Adapt an existing Jena Triple to CommonsRDF {@link Triple}. +308 * <p> +309 * If the triple contains any {@link Node#isBlank()}, then any corresponding +310 * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} +311 * instance in combination with {@link Node#getBlankNodeId()} for the +312 * purpose of its {@link BlankNode#uniqueReference()}. +313 * +314 * @see #asTriple(RDF, org.apache.jena.graph.Triple) +315 * +316 * @param triple +317 * Jena {@link org.apache.jena.graph.Triple} to adapt +318 * @return Adapted {@link JenaTriple} +319 * @throws ConversionException +320 * if any of the triple's nodes are not concrete or the triple +321 * is a generalized triple +322 */ +323 public JenaTriple asTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { +324 return internalJenaFactory.createTriple(triple, salt()); +325 } +326 +327 /** +328 * Adapt a generalized Jena {@link org.apache.jena.graph.Triple} to a +329 * CommonsRDF {@link TripleLike}. +330 * <p> +331 * The generalized triple supports any {@link RDFTerm} as its +332 * {@link TripleLike#getSubject()} {@link TripleLike#getPredicate()} or +333 * {@link TripleLike#getObject()}. +334 * <p> +335 * If the Jena triple contains any {@link Node#isBlank()}, then any +336 * corresponding {@link BlankNode} will use a {@link UUID} salt from this +337 * {@link JenaRDF} instance in combination with +338 * {@link Node#getBlankNodeId()} for the purpose of its +339 * {@link BlankNode#uniqueReference()}. +340 * +341 * @see #asTriple(RDF, org.apache.jena.graph.Triple) +342 * +343 * @param triple +344 * Jena triple +345 * @return Adapted {@link TripleLike}. Note that the generalized triple does +346 * <strong>not</strong> implement {@link Triple#equals(Object)} or +347 * {@link Triple#hashCode()}. +348 * @throws ConversionException +349 * if any of the triple's nodes are not concrete +350 */ +351 public JenaTripleLike asGeneralizedTriple(final org.apache.jena.graph.Triple triple) throws ConversionException { +352 return internalJenaFactory.createGeneralizedTriple(triple, salt()); +353 } +354 +355 /** +356 * Adapt a generalized Jena {@link org.apache.jena.sparql.core.Quad} to a +357 * CommonsRDF {@link QuadLike}. +358 * <p> +359 * The generalized quad supports any {@link RDFTerm} as its +360 * {@link QuadLike#getGraphName()}, {@link QuadLike#getSubject()} +361 * {@link QuadLike#getPredicate()} or {@link QuadLike#getObject()}. +362 * <p> +363 * If the Jena quad contains any {@link Node#isBlank()}, then any +364 * corresponding {@link BlankNode} will use a {@link UUID} salt from this +365 * {@link JenaRDF} instance in combination with +366 * {@link Node#getBlankNodeId()} for the purpose of its +367 * {@link BlankNode#uniqueReference()}. +368 * <p> +369 * If the provided quad {@link org.apache.jena.sparql.core.Quad#isDefaultGraph()}, +370 * the returned {@link JenaQuadLike} has a {@link JenaQuadLike#getGraphName()} +371 * of {@link Optional#empty()}. +372 * +373 * @see #asQuad(org.apache.jena.sparql.core.Quad) +374 * @see #asGeneralizedTriple(org.apache.jena.graph.Triple) +375 * +376 * @param quad +377 * Jena quad +378 * @return Adapted {@link QuadLike}. Note that the generalized quad does +379 * <strong>not</strong> implement {@link Quad#equals(Object)} or +380 * {@link Quad#hashCode()}. 381 * @throws ConversionException -382 * if any of the triple's nodes are not concrete or the triple -383 * is a generalized triple -384 */ -385 public static Triple asTriple(final RDF factory, final org.apache.jena.graph.Triple triple) throws ConversionException { -386 if (factory instanceof JenaRDF) { -387 // No need to convert, just wrap -388 return ((JenaRDF) factory).asTriple(triple); -389 } -390 final BlankNodeOrIRI subject; -391 final IRI predicate; -392 try { -393 subject = (BlankNodeOrIRI) asRDFTerm(factory, triple.getSubject()); -394 predicate = (IRI) asRDFTerm(factory, triple.getPredicate()); -395 } catch (final ClassCastException ex) { -396 throw new ConversionException("Can't convert generalized triple: " + triple, ex); -397 } -398 final RDFTerm object = asRDFTerm(factory, triple.getObject()); -399 return factory.createTriple(subject, predicate, object); -400 } -401 -402 /** -403 * Adapt an existing Jena {@link org.apache.jena.sparql.core.Quad} to -404 * CommonsRDF {@link Quad}. -405 * <p> -406 * If the quad contains any {@link Node#isBlank()}, then any corresponding -407 * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} -408 * instance in combination with {@link Node#getBlankNodeId()} for the -409 * purpose of its {@link BlankNode#uniqueReference()}. -410 * -411 * @param quad -412 * Jena quad -413 * @return Adapted quad -414 */ -415 public JenaQuad asQuad(final org.apache.jena.sparql.core.Quad quad) { -416 return internalJenaFactory.createQuad(quad, salt()); -417 } -418 -419 /** -420 * Adapt an existing Jena {@link org.apache.jena.graph.Graph} to CommonsRDF -421 * {@link Graph}. -422 * <p> -423 * This does not take a copy, changes to the CommonsRDF Graph are reflected -424 * in the jena graph, which is accessible from -425 * {@link JenaGraph#asJenaGraph()}. -426 * <p> -427 * If the graph contains any {@link Node#isBlank()}, then any corresponding -428 * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} -429 * instance in combination with {@link Node#getBlankNodeId()} for the -430 * purpose of its {@link BlankNode#uniqueReference()}. -431 * -432 * @param graph -433 * Jena {@link org.apache.jena.graph.Graph} to adapt -434 * @return Adapted {@link JenaGraph} -435 */ -436 public JenaGraph asGraph(final org.apache.jena.graph.Graph graph) { -437 return internalJenaFactory.createGraph(graph, salt()); -438 } -439 -440 /** -441 * Adapt an existing Jena {@link org.apache.jena.rdf.model.Model} to -442 * CommonsRDF {@link Graph}. -443 * <p> -444 * This does not ake a copy, changes to the CommonsRDF Graph are reflected -445 * in the jena graph, which is accessible from -446 * {@link JenaGraph#asJenaGraph()}. -447 * <p> -448 * If the graph contains any {@link Node#isBlank()}, then any corresponding -449 * {@link BlankNode} will use a {@link UUID} salt from this {@link JenaRDF} -450 * instance in combination with {@link Node#getBlankNodeId()} for the -451 * purpose of its {@link BlankNode#uniqueReference()}. -452 * -453 * @param model -454 * Jena {@link org.apache.jena.rdf.model.Model} to adapt -455 * @return Adapted {@link JenaGraph} -456 */ -457 public JenaGraph asGraph(final org.apache.jena.rdf.model.Model model) { -458 return internalJenaFactory.createGraph(model, salt()); -459 } -460 -461 /** -462 * Adapt an existing Jena {@link DatasetGraph} to CommonsRDF -463 * {@link Dataset}. -464 * <p> -465 * This does not take a copy, changes to the CommonsRDF Dataset are -466 * reflected in the jena dataset graph, which is accessible from -467 * {@link JenaDataset#asJenaDatasetGraph()}. -468 * <p> -469 * If the dataset contains any {@link Node#isBlank()}, then any -470 * corresponding {@link BlankNode} will use a {@link UUID} salt from this -471 * {@link JenaRDF} instance in combination with -472 * {@link Node#getBlankNodeId()} for the purpose of its -473 * {@link BlankNode#uniqueReference()}. -474 * -475 * @param datasetGraph -476 * Jena {@link DatasetGraph} to adapt -477 * @return Adapted {@link JenaDataset} -478 */ -479 public JenaDataset asDataset(final DatasetGraph datasetGraph) { -480 return internalJenaFactory.createDataset(datasetGraph, salt()); -481 } -482 -483 /** -484 * Adapt an existing Jena {@link org.apache.jena.query.Dataset} to -485 * CommonsRDF {@link Dataset}. -486 * <p> -487 * This does not take a copy, changes to the CommonsRDF Dataset are -488 * reflected in the jena dataset graph, which is accessible from -489 * {@link JenaDataset#asJenaDatasetGraph()}. -490 * <p> -491 * If the dataset contains any {@link Node#isBlank()}, then any -492 * corresponding {@link BlankNode} will use a {@link UUID} salt from this -493 * {@link JenaRDF} instance in combination with -494 * {@link Node#getBlankNodeId()} for the purpose of its -495 * {@link BlankNode#uniqueReference()}. -496 * -497 * @param datasetGraph -498 * Jena {@link org.apache.jena.query.Dataset} to adapt -499 * @return Adapted {@link JenaDataset} -500 */ -501 public JenaDataset asDataset(final org.apache.jena.query.Dataset datasetGraph) { -502 return internalJenaFactory.createDataset(datasetGraph.asDatasetGraph(), salt()); -503 } -504 -505 /** -506 * Convert from Jena {@link org.apache.jena.sparql.core.Quad} to a Commons -507 * RDF {@link Quad}. -508 * <p> -509 * Note that if any of the quad's nodes {@link Node#isBlank()}, then the -510 * factory's {@link RDF#createBlankNode(String)} will be used, meaning that -511 * care should be taken if reusing an {@link RDF} instance for multiple -512 * conversion sessions. -513 * -514 * @see #asQuad(org.apache.jena.sparql.core.Quad) -515 * @see #asGeneralizedQuad(org.apache.jena.sparql.core.Quad) -516 * -517 * @param factory -518 * {@link RDF} to use for creating the {@link Triple} and its -519 * {@link RDFTerm}s. -520 * @param quad -521 * Jena {@link org.apache.jena.sparql.core.Quad} to adapt -522 * @return Converted {@link Quad} -523 * @throws ConversionException -524 * if any of the quad's nodes are not concrete or the quad is a -525 * generalized quad -526 */ -527 public static Quad asQuad(final RDF factory, final org.apache.jena.sparql.core.Quad quad) { -528 if (factory instanceof JenaRDF) { -529 // No need to convert, just wrap -530 return ((JenaRDF) factory).asQuad(quad); [... 658 lines stripped ...]