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 90B86200B47 for ; Sat, 2 Jul 2016 18:14:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8F7AB160A75; Sat, 2 Jul 2016 16:14:25 +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 91D8D160A5D for ; Sat, 2 Jul 2016 18:14:24 +0200 (CEST) Received: (qmail 74343 invoked by uid 500); 2 Jul 2016 16:14:23 -0000 Mailing-List: contact commits-help@commonsrdf.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commonsrdf.incubator.apache.org Delivered-To: mailing list commits@commonsrdf.incubator.apache.org Received: (qmail 74325 invoked by uid 99); 2 Jul 2016 16:14:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Jul 2016 16:14:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 584DC1A0605 for ; Sat, 2 Jul 2016 16:14:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id cvPcI5Z6XQgf for ; Sat, 2 Jul 2016 16:14:22 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id DA7865FE66 for ; Sat, 2 Jul 2016 16:14:19 +0000 (UTC) Received: (qmail 73383 invoked by uid 99); 2 Jul 2016 16:14:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Jul 2016 16:14:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CF37CE9444; Sat, 2 Jul 2016 16:14:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stain@apache.org To: commits@commonsrdf.incubator.apache.org Date: Sat, 02 Jul 2016 16:14:31 -0000 Message-Id: <778edd21594740938de52b0837bec5ed@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [14/50] [abbrv] incubator-commonsrdf git commit: More source() docs archived-at: Sat, 02 Jul 2016 16:14:25 -0000 More source() docs Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/60f06d93 Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/60f06d93 Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/60f06d93 Branch: refs/heads/jena Commit: 60f06d93990fd7155cc0d8d83c6031e1b6b4a77c Parents: f626bab Author: Stian Soiland-Reyes Authored: Sun Mar 27 21:47:26 2016 +0100 Committer: Stian Soiland-Reyes Committed: Sun Mar 27 21:47:26 2016 +0100 ---------------------------------------------------------------------- .../commons/rdf/api/RDFParserBuilder.java | 120 ++++++++++++++++--- 1 file changed, 105 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/60f06d93/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java b/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java index 2cc60bb..3bf536d 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDFParserBuilder.java @@ -145,15 +145,15 @@ public interface RDFParserBuilder { * @base in Turtle documents). *

* If the source is in a syntax that does not support relative IRI - * references, e.g. {@link RDFSyntax#NTRIPLES}, setting the base has no - * effect. + * references (e.g. {@link RDFSyntax#NTRIPLES}), setting the + * base has no effect. *

* This method will override any base IRI set with {@link #base(String)}. * * @see #base(String) * @param base - * An absolute IRI to use as a base - * @return An {@link RDFParserBuilder} that will use the specified base IRI + * An absolute IRI to use as a base. + * @return An {@link RDFParserBuilder} that will use the specified base IRI. */ RDFParserBuilder base(IRI base); @@ -166,37 +166,41 @@ public interface RDFParserBuilder { * @base in Turtle documents). *

* If the source is in a syntax that does not support relative IRI - * references, e.g. {@link RDFSyntax#NTRIPLES}, setting the base has no - * effect. + * references (e.g. {@link RDFSyntax#NTRIPLES}), setting the + * base has no effect. *

* This method will override any base IRI set with {@link #base(IRI)}. * * @see #base(IRI) * @param base - * An absolute IRI to use as a base - * @return An {@link RDFParserBuilder} that will use the specified base IRI + * An absolute IRI to use as a base. + * @return An {@link RDFParserBuilder} that will use the specified base IRI. */ RDFParserBuilder base(String base); /** - * Specify a source to parse. + * Specify a source {@link InputStream} to parse. *

* The source set will not be read before the call to {@link #parse()}. *

* The InputStream will not be closed after parsing. The InputStream does - * not need to support {@link InputStream#markSupported()}. The parser might - * not consume the complete stream (e.g. the parser may not read beyond the - * closing tag of </rdf:Description&;gt). + * not need to support {@link InputStream#markSupported()}. + *

+ * The parser might + * not consume the complete stream (e.g. an RDF/XML parser may not read beyond the + * closing tag of </rdf:Description>). *

* The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} * SHOULD be set before calling {@link #parse()}. *

* The character set is assumed to be {@link StandardCharsets#UTF_8} unless - * the {@link #contentType(String)} specifies otherwise. + * the {@link #contentType(String)} specifies otherwise or the document + * declares its own charset (e.g. RDF/XML with a + * <?xml encoding="iso-8859-1"> header). *

* The {@link #base(IRI)} or {@link #base(String)} MUST be set before - * calling {@link #parse()}, unless the syntax does not permit relative - * IRIs. + * calling {@link #parse()}, unless the RDF syntax does not permit relative + * IRIs (e.g. {@link RDFSyntax#NTRIPLES}). *

* This method will override any source set with {@link #source(IRI)}, * {@link #source(Path)} or {@link #source(String)}. @@ -207,10 +211,96 @@ public interface RDFParserBuilder { */ RDFParserBuilder source(InputStream inputStream); + /** + * Specify a source file {@link Path} to parse. + *

+ * The source set will not be read before the call to {@link #parse()}. + *

+ * The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} + * SHOULD be set before calling {@link #parse()}. + *

+ * The character set is assumed to be {@link StandardCharsets#UTF_8} unless + * the {@link #contentType(String)} specifies otherwise or the document + * declares its own charset (e.g. RDF/XML with a + * <?xml encoding="iso-8859-1"> header). + *

+ * The {@link #base(IRI)} or {@link #base(String)} MAY be set before + * calling {@link #parse()}, otherwise {@link Path#toUri()} will be used + * as the base IRI. + *

+ * This method will override any source set with {@link #source(IRI)}, + * {@link #source(InputStream)} or {@link #source(String)}. + * + * @param file + * A Path for a file to parse + * @return An {@link RDFParserBuilder} that will use the specified source. + */ RDFParserBuilder source(Path file); + /** + * Specify an absolute source {@link IRI} to retrieve and parse. + *

+ * The source set will not be read before the call to {@link #parse()}. + *

+ * If this builder does not support the given IRI + * (e.g. urn:uuid:ce667463-c5ab-4c23-9b64-701d055c4890), + * this method should succeed, while the {@link #parse()} should + * throw an {@link IOException}. + *

+ * The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} + * MAY be set before calling {@link #parse()}, in which case that + * type MAY be used for content negotiation (e.g. Accept header in HTTP), + * and SHOULD be used for selecting the RDFSyntax. + *

+ * The character set is assumed to be {@link StandardCharsets#UTF_8} unless + * the protocol's equivalent of Content-Type specifies otherwise or + * the document declares its own charset (e.g. RDF/XML with a + * <?xml encoding="iso-8859-1"> header). + *

+ * The {@link #base(IRI)} or {@link #base(String)} MAY be set before + * calling {@link #parse()}, otherwise the source IRI will be used + * as the base IRI. + *

+ * This method will override any source set with {@link #source(Path)}, + * {@link #source(InputStream)} or {@link #source(String)}. + * + * @param iri + * An IRI to retrieve and parse + * @return An {@link RDFParserBuilder} that will use the specified source. + */ RDFParserBuilder source(IRI iri); + /** + * Specify an absolute source IRI to retrieve and parse. + *

+ * The source set will not be read before the call to {@link #parse()}. + *

+ * If this builder does not support the given IRI + * (e.g. urn:uuid:ce667463-c5ab-4c23-9b64-701d055c4890), + * this method should succeed, while the {@link #parse()} should + * throw an {@link IOException}. + *

+ * The {@link #contentType(RDFSyntax)} or {@link #contentType(String)} + * MAY be set before calling {@link #parse()}, in which case that + * type MAY be used for content negotiation (e.g. Accept header in HTTP), + * and SHOULD be used for selecting the RDFSyntax. + *

+ * The character set is assumed to be {@link StandardCharsets#UTF_8} unless + * the protocol's equivalent of Content-Type specifies otherwise or + * the document declares its own charset (e.g. RDF/XML with a + * <?xml encoding="iso-8859-1"> header). + *

+ * The {@link #base(IRI)} or {@link #base(String)} MAY be set before + * calling {@link #parse()}, otherwise the source IRI will be used + * as the base IRI. + *

+ * This method will override any source set with {@link #source(Path)}, + * {@link #source(InputStream)} or {@link #source(IRI)}. + * + * @param iri + * An IRI to retrieve and parse + * @return An {@link RDFParserBuilder} that will use the specified source. + */ RDFParserBuilder source(String iri); /**