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 80DDB200BAE for ; Fri, 28 Oct 2016 15:15:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7F781160ADD; Fri, 28 Oct 2016 13:15:19 +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 05FB4160AE3 for ; Fri, 28 Oct 2016 15:15:16 +0200 (CEST) Received: (qmail 423 invoked by uid 500); 28 Oct 2016 13:15:16 -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 414 invoked by uid 99); 28 Oct 2016 13:15:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 13:15:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9E893189B5F for ; Fri, 28 Oct 2016 13:15:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 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=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id h33GF5IixjEw for ; Fri, 28 Oct 2016 13:15:02 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 668D95FBCF for ; Fri, 28 Oct 2016 13:14:59 +0000 (UTC) Received: (qmail 99118 invoked by uid 99); 28 Oct 2016 13:14:25 -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; Fri, 28 Oct 2016 13:14:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0A253E97DD; Fri, 28 Oct 2016 13:14:25 +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: Fri, 28 Oct 2016 13:15:10 -0000 Message-Id: <8564b0ef15ed449e829d56bbeae46682@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [48/49] incubator-commonsrdf git commit: Reformat tab -> spaces archived-at: Fri, 28 Oct 2016 13:15:19 -0000 http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/RDF.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDF.java b/api/src/main/java/org/apache/commons/rdf/api/RDF.java index 32b7f66..b942b30 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDF.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDF.java @@ -23,21 +23,18 @@ import java.util.Locale; /** * A RDF implementation. *

- * A RDF implementation can create instances of - * the {@link RDFTerm} types - * {@link IRI}, {@link BlankNode} and {@link Literal}, as well as creating + * A RDF implementation can create instances of the {@link RDFTerm} + * types {@link IRI}, {@link BlankNode} and {@link Literal}, as well as creating * instances of the types {@link Triple}, {@link Quad}, {@link Graph} or * {@link Dataset}. *

- * A partial RDF implementation - * should be clearly documented as such, and may throw - * {@link UnsupportedOperationException} where applicable, e.g. if it - * does not support creating {@link Dataset}s or {@link Quad}s. + * A partial RDF implementation should be clearly documented as such, + * and may throw {@link UnsupportedOperationException} where applicable, e.g. if + * it does not support creating {@link Dataset}s or {@link Quad}s. *

- * Instances of RDF work like a factory for - * creating Commons RDF instances. - * spezializations of this interface may also provide methods - * for conversions from/to their underlying RDF framework. + * Instances of RDF work like a factory for creating Commons RDF + * instances. spezializations of this interface may also provide methods for + * conversions from/to their underlying RDF framework. *

* If a factory method of a particular implementation does not allow or support * a provided parameter, e.g. because an IRI is considered invalid, then it @@ -54,36 +51,37 @@ public interface RDF { * Create a new blank node. *

* The returned blank node MUST NOT be equal to any existing - * {@link BlankNode} instances according to {@link BlankNode#equals(Object)}. + * {@link BlankNode} instances according to + * {@link BlankNode#equals(Object)}. * * @return A new, unique {@link BlankNode} */ - public BlankNode createBlankNode(); + public BlankNode createBlankNode(); /** * Create a blank node based on the given name. *

- * All {@link BlankNode}s created with the given name - * on a particular instance of RDF MUST be - * equivalent according to {@link BlankNode#equals(Object)}, + * All {@link BlankNode}s created with the given name on a + * particular instance of RDF MUST be equivalent according + * to {@link BlankNode#equals(Object)}, *

* The returned BlankNode MUST NOT be equal to BlankNode * instances returned for any other name or those returned from * {@link #createBlankNode()}. *

* The returned BlankNode SHOULD NOT be equivalent to any BlankNodes created - * on a different RDF instance, e.g. - * different instances of RDF should produce - * different blank nodes for the same name unless they - * purposely are intending to create equivalent {@link BlankNode} - * instances (e.g. a reinstated {@link Serializable} factory). + * on a different RDF instance, e.g. different + * instances of RDF should produce different blank nodes for + * the same name unless they purposely are intending to create + * equivalent {@link BlankNode} instances (e.g. a reinstated + * {@link Serializable} factory). * * @param name * A non-empty, non-null, String that is unique to this blank * node in the context of this {@link RDF}. * @return A BlankNode for the given name */ - public BlankNode createBlankNode(String name); + public BlankNode createBlankNode(String name); /** * Create a new graph. @@ -93,31 +91,33 @@ public interface RDF { * * @return A new Graph */ - public Graph createGraph(); + public Graph createGraph(); /** * Create a new dataset. * - * It is undefined if the dataset will be persisted by any underlying storage - * mechanism. + * It is undefined if the dataset will be persisted by any underlying + * storage mechanism. * * @return A new Dataset */ - public Dataset createDataset(); + public Dataset createDataset(); /** * Create an IRI from a (possibly escaped) String. * - * The provided iri string MUST be valid according to the W3C RDF-1.1 IRI - * definition. + * The provided iri string MUST be valid according to the + * W3C RDF-1.1 + * IRI definition. * - * @param iri Internationalized Resource Identifier + * @param iri + * Internationalized Resource Identifier * @return A new IRI - * @throws IllegalArgumentException If the provided string is not acceptable, e.g. does not - * conform to the RFC3987 syntax. + * @throws IllegalArgumentException + * If the provided string is not acceptable, e.g. does not + * conform to the RFC3987 syntax. */ - public IRI createIRI(String iri) throws IllegalArgumentException; + public IRI createIRI(String iri) throws IllegalArgumentException; /** * Create a simple literal. @@ -131,13 +131,14 @@ public interface RDF { * {@link Literal#getDatatype()} that is equal to the IRI * http://www.w3.org/2001/XMLSchema#string. * - * @param lexicalForm The literal value in plain text + * @param lexicalForm + * The literal value in plain text * @return The created Literal - * @throws IllegalArgumentException If the provided lexicalForm is not acceptable, e.g. because - * it is too large for an underlying storage. + * @throws IllegalArgumentException + * If the provided lexicalForm is not acceptable, e.g. because + * it is too large for an underlying storage. */ - public Literal createLiteral(String lexicalForm) - throws IllegalArgumentException; + public Literal createLiteral(String lexicalForm) throws IllegalArgumentException; /** * Create a literal with the specified data type. @@ -145,12 +146,12 @@ public interface RDF { * The provided lexical form should not be escaped in any sense, e.g. should * not include "quotes" unless those are part of the literal value. * - * It is RECOMMENDED that the provided dataType is one of the RDF-compatible - * XSD types. + * It is RECOMMENDED that the provided dataType is one of the RDF-compatible XSD + * types. * - * The provided lexical form SHOULD be in the lexical + * The provided lexical form SHOULD be in the + * lexical * space of the provided dataType. * * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} that @@ -159,15 +160,17 @@ public interface RDF { * {@link Literal#getDatatype()} that is equivalent to the provided dataType * IRI. * - * @param lexicalForm The literal value - * @param dataType The data type IRI for the literal value, e.g. - * http://www.w3.org/2001/XMLSchema#integer + * @param lexicalForm + * The literal value + * @param dataType + * The data type IRI for the literal value, e.g. + * http://www.w3.org/2001/XMLSchema#integer * @return The created Literal - * @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g. - * because the provided dataType is not permitted. + * @throws IllegalArgumentException + * If any of the provided arguments are not acceptable, e.g. + * because the provided dataType is not permitted. */ - public Literal createLiteral(String lexicalForm, IRI dataType) - throws IllegalArgumentException; + public Literal createLiteral(String lexicalForm, IRI dataType) throws IllegalArgumentException; /** * Create a language-tagged literal. @@ -175,11 +178,12 @@ public interface RDF { * The provided lexical form should not be escaped in any sense, e.g. should * not include "quotes" unless those are part of the literal value. * - * The provided language tag MUST be valid according to BCP47, e.g. en. + * The provided language tag MUST be valid according to + * BCP47, e.g. + * en. * - * The provided language tag MAY be converted to lower case. * * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} which @@ -190,15 +194,17 @@ public interface RDF { * equal to the provided language tag (compared as * {@link String#toLowerCase(Locale)} using {@link Locale#ENGLISH}). * - * @param lexicalForm The literal value - * @param languageTag The non-empty language tag as defined by BCP47 + * @param lexicalForm + * The literal value + * @param languageTag + * The non-empty language tag as defined by + * BCP47 * @return The created Literal - * @throws IllegalArgumentException If the provided values are not acceptable, e.g. because the - * languageTag was syntactically invalid. + * @throws IllegalArgumentException + * If the provided values are not acceptable, e.g. because the + * languageTag was syntactically invalid. */ - public Literal createLiteral(String lexicalForm, String languageTag) - throws IllegalArgumentException; + public Literal createLiteral(String lexicalForm, String languageTag) throws IllegalArgumentException; /** * Create a triple. @@ -208,37 +214,45 @@ public interface RDF { * equal to the provided predicate, and a {@link Triple#getObject()} that is * equal to the provided object. * - * @param subject The IRI or BlankNode that is the subject of the triple - * @param predicate The IRI that is the predicate of the triple - * @param object The IRI, BlankNode or Literal that is the object of the triple + * @param subject + * The IRI or BlankNode that is the subject of the triple + * @param predicate + * The IRI that is the predicate of the triple + * @param object + * The IRI, BlankNode or Literal that is the object of the triple * @return The created Triple - * @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g. - * because a Literal has a lexicalForm that is too large for an - * underlying storage. + * @throws IllegalArgumentException + * If any of the provided arguments are not acceptable, e.g. + * because a Literal has a lexicalForm that is too large for an + * underlying storage. */ - public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, - RDFTerm object) throws IllegalArgumentException; + public Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) throws IllegalArgumentException; /** * Create a quad. *

- * The returned Quad SHOULD have a - * {@link Quad#getGraphName()} that is equal to the provided graphName, a - * {@link Quad#getSubject()} that is - * equal to the provided subject, a {@link Quad#getPredicate()} that is - * equal to the provided predicate, and a {@link Quad#getObject()} that is - * equal to the provided object. + * The returned Quad SHOULD have a {@link Quad#getGraphName()} that is equal + * to the provided graphName, a {@link Quad#getSubject()} that is equal to + * the provided subject, a {@link Quad#getPredicate()} that is equal to the + * provided predicate, and a {@link Quad#getObject()} that is equal to the + * provided object. * - * @param graphName The IRI or BlankNode that this quad belongs to, or null for the public graph - * @param subject The IRI or BlankNode that is the subject of the quad - * @param predicate The IRI that is the predicate of the quad - * @param object The IRI, BlankNode or Literal that is the object of the quad + * @param graphName + * The IRI or BlankNode that this quad belongs to, or + * null for the public graph + * @param subject + * The IRI or BlankNode that is the subject of the quad + * @param predicate + * The IRI that is the predicate of the quad + * @param object + * The IRI, BlankNode or Literal that is the object of the quad * @return The created Quad - * @throws IllegalArgumentException If any of the provided arguments are not acceptable, e.g. - * because a Literal has a lexicalForm that is too large for an - * underlying storage. + * @throws IllegalArgumentException + * If any of the provided arguments are not acceptable, e.g. + * because a Literal has a lexicalForm that is too large for an + * underlying storage. */ - public Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, - RDFTerm object) throws IllegalArgumentException; + public Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) + throws IllegalArgumentException; } http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java b/api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java index 541469f..2637a96 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDFSyntax.java @@ -21,163 +21,174 @@ import java.util.Arrays; import java.util.Locale; import java.util.Optional; -/** +/** * Enumeration of the RDF 1.1 serialization syntaxes. *

- * This enumeration lists the W3C standardized - * RDF 1.1 syntaxes like {@link #TURTLE} and {@link #JSONLD}. - * Note the existence of other RDF syntaxes that are not included here, - * e.g. N3 - * and TriX. + * This enumeration lists the W3C standardized RDF 1.1 syntaxes like + * {@link #TURTLE} and {@link #JSONLD}. Note the existence of other RDF syntaxes + * that are not included here, e.g. + * N3 and + * TriX. * - * @see RDF 1.1 Primer + * @see RDF + * 1.1 Primer * @see org.apache.commons.rdf.experimental.RDFParser */ public enum RDFSyntax { - - /** - * JSON-LD 1.0 - * - * @see https://www.w3.org/TR/json-ld/ - * - */ - JSONLD("JSON-LD 1.0", "application/ld+json", ".jsonld", true), - - /** - * RDF 1.1 Turtle - * - * @see https://www.w3.org/TR/turtle/ - * - */ - TURTLE("RDF 1.1 Turtle", "text/turtle", ".ttl", false), - - /** - * RDF 1.1 N-Quads - * - * @see https://www.w3.org/TR/n-quads/ - */ - NQUADS("RDF 1.1 N-Quads", "application/n-quads", ".nq", true), - - /** - * RDF 1.1 N-Triples - * - * @see https://www.w3.org/TR/n-triples/ - */ - NTRIPLES("RDF 1.1 N-Triples", "application/n-triples", ".nt", false), - - /** - * HTML+RDFa 1.1 - * - * @see https://www.w3.org/TR/html-rdfa/ - */ - RDFA_HTML("HTML+RDFa 1.1", "text/html", ".html", false), - - /** - * XHTML+RDFa 1.1 - * - * @see https://www.w3.org/TR/xhtml-rdfa/ - */ - RDFA_XHTML("XHTML+RDFa 1.1", "application/xhtml+xml", ".xhtml", false), - - /** - * RDF 1.1 XML Syntax - * - * @see https://www.w3.org/TR/rdf-syntax-grammar/ - */ - RDFXML("RDF 1.1 XML Syntax", "application/rdf+xml", ".rdf", false), - - /** - * RDF 1.1 TriG - * - * @see https://www.w3.org/TR/trig/ - */ - TRIG("RDF 1.1 TriG", "application/trig", ".trig", true); - - /** - * The IANA media type for the RDF syntax. - *

- * The media type can be used as part of - * Content-Type - * and Accept for content negotiation in the - * HTTP protocol. - */ - public final String mediaType; - - /** - * The IANA-registered file extension. - *

- * The file extension includes the leading period, e.g. .jsonld - */ - public final String fileExtension; - - /** - * Indicate if this RDF syntax supports RDF Datasets. - */ - public final boolean supportsDataset; - - private final String name; - - /** - * A human-readable name for the RDF syntax. - *

- * The name is equivalent to the the title of the corresponding W3C Specification. - */ - @Override - public String toString() { - return name; - } - - private RDFSyntax(String name, String mediaType, String fileExtension, boolean supportsDataset) { - this.name = name; - this.mediaType = mediaType; - this.fileExtension = fileExtension; - this.supportsDataset = supportsDataset; - } - - /** - * Return the RDFSyntax with the specified media type. - *

- * The mediaType is compared in lower case, therefore it might - * not be equal to the {@link RDFSyntax#mediaType} of the returned - * RDFSyntax. - *

- * For convenience matching of media types used in a - * Content-Type header, if the mediaType contains - * the characters ;, , or white space, only the - * part of the string to the left of those characters are considered. - * - * @param mediaType - * The media type to match - * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has - * a matching {@link RDFSyntax#mediaType}, otherwise - * {@link Optional#empty()} indicating that - * no matching syntax was found. - */ - public static Optional byMediaType(String mediaType) { - final String type = mediaType.toLowerCase(Locale.ENGLISH). - split("\\s*[;,]", 2)[0]; - return Arrays.stream(RDFSyntax.values()).filter( - t -> t.mediaType.equals(type)).findAny(); - } - - /** - * Return the RDFSyntax with the specified file extension. - *

- * The fileExtension is compared in lower case, therefore it - * might not be equal to the {@link RDFSyntax#fileExtension} of the returned - * RDFSyntax. - * - * @param fileExtension - * The fileExtension to match, starting with . - * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has - * a matching {@link RDFSyntax#fileExtension}, otherwise - * {@link Optional#empty()} indicating that no matching file - * extension was found. - */ - public static Optional byFileExtension(String fileExtension) { - final String ext = fileExtension.toLowerCase(Locale.ENGLISH); - return Arrays.stream(RDFSyntax.values()).filter( - t -> t.fileExtension.equals(ext)).findAny(); - } + + /** + * JSON-LD 1.0 + * + * @see https://www.w3.org/TR/json-ld/ + * + */ + JSONLD("JSON-LD 1.0", "application/ld+json", ".jsonld", true), + + /** + * RDF 1.1 Turtle + * + * @see https://www.w3.org/TR/turtle/ + * + */ + TURTLE("RDF 1.1 Turtle", "text/turtle", ".ttl", false), + + /** + * RDF 1.1 N-Quads + * + * @see https://www.w3.org/TR/n-quads/ + */ + NQUADS("RDF 1.1 N-Quads", "application/n-quads", ".nq", true), + + /** + * RDF 1.1 N-Triples + * + * @see https://www.w3.org/TR/n-triples/ + */ + NTRIPLES("RDF 1.1 N-Triples", "application/n-triples", ".nt", false), + + /** + * HTML+RDFa 1.1 + * + * @see https://www.w3.org/TR/html-rdfa/ + */ + RDFA_HTML("HTML+RDFa 1.1", "text/html", ".html", false), + + /** + * XHTML+RDFa 1.1 + * + * @see https://www.w3.org/TR/xhtml-rdfa/ + */ + RDFA_XHTML("XHTML+RDFa 1.1", "application/xhtml+xml", ".xhtml", false), + + /** + * RDF 1.1 XML Syntax + * + * @see https://www.w3.org/TR/rdf-syntax-grammar/ + */ + RDFXML("RDF 1.1 XML Syntax", "application/rdf+xml", ".rdf", false), + + /** + * RDF 1.1 TriG + * + * @see https://www.w3.org/TR/trig/ + */ + TRIG("RDF 1.1 TriG", "application/trig", ".trig", true); + + /** + * The IANA media type for + * the RDF syntax. + *

+ * The media type can be used as part of Content-Type and + * Accept for content negotiation in the + * HTTP + * protocol. + */ + public final String mediaType; + + /** + * The IANA-registered + * file extension. + *

+ * The file extension includes the leading period, e.g. .jsonld + */ + public final String fileExtension; + + /** + * Indicate if this RDF syntax supports + * RDF + * Datasets. + */ + public final boolean supportsDataset; + + private final String name; + + /** + * A human-readable name for the RDF syntax. + *

+ * The name is equivalent to the the title of the corresponding W3C + * Specification. + */ + @Override + public String toString() { + return name; + } + + private RDFSyntax(String name, String mediaType, String fileExtension, boolean supportsDataset) { + this.name = name; + this.mediaType = mediaType; + this.fileExtension = fileExtension; + this.supportsDataset = supportsDataset; + } + + /** + * Return the RDFSyntax with the specified media type. + *

+ * The mediaType is compared in lower case, therefore it might + * not be equal to the {@link RDFSyntax#mediaType} of the returned + * RDFSyntax. + *

+ * For convenience matching of media types used in a + * Content-Type header, if the mediaType contains + * the characters ;, , or white space, only the + * part of the string to the left of those characters are considered. + * + * @param mediaType + * The media type to match + * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has + * a matching {@link RDFSyntax#mediaType}, otherwise + * {@link Optional#empty()} indicating that no matching syntax was + * found. + */ + public static Optional byMediaType(String mediaType) { + final String type = mediaType.toLowerCase(Locale.ENGLISH).split("\\s*[;,]", 2)[0]; + return Arrays.stream(RDFSyntax.values()).filter(t -> t.mediaType.equals(type)).findAny(); + } + + /** + * Return the RDFSyntax with the specified file extension. + *

+ * The fileExtension is compared in lower case, therefore it + * might not be equal to the {@link RDFSyntax#fileExtension} of the returned + * RDFSyntax. + * + * @param fileExtension + * The fileExtension to match, starting with . + * @return If {@link Optional#isPresent()}, the {@link RDFSyntax} which has + * a matching {@link RDFSyntax#fileExtension}, otherwise + * {@link Optional#empty()} indicating that no matching file + * extension was found. + */ + public static Optional byFileExtension(String fileExtension) { + final String ext = fileExtension.toLowerCase(Locale.ENGLISH); + return Arrays.stream(RDFSyntax.values()).filter(t -> t.fileExtension.equals(ext)).findAny(); + } } http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java b/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java index 59d8fa1..2b69b24 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java @@ -32,11 +32,12 @@ package org.apache.commons.rdf.api; public interface RDFTerm { /** - * Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form. + * Return the term serialised as specified by the RDF-1.1 N-Triples + * Canonical form. * * @return The term serialised as RDF-1.1 N-Triples. * @see - * RDF-1.1 N-Triples Canonical form + * RDF-1.1 N-Triples Canonical form */ String ntriplesString(); http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java b/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java index 37c4ead..f245cce 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java +++ b/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java @@ -20,8 +20,8 @@ package org.apache.commons.rdf.api; /** * Factory for creating RDFTerm instances.. *

- * This interface is deprecated in favour of - * the richer {@link RDF}. + * This interface is deprecated in favour of the richer + * {@link RDF}. * * @see RDF */ @@ -29,49 +29,38 @@ package org.apache.commons.rdf.api; public interface RDFTermFactory { default BlankNode createBlankNode() throws UnsupportedOperationException { - throw new UnsupportedOperationException( - "createBlankNode() not supported"); + throw new UnsupportedOperationException("createBlankNode() not supported"); } - default BlankNode createBlankNode(String name) - throws UnsupportedOperationException { - throw new UnsupportedOperationException( - "createBlankNode(String) not supported"); + default BlankNode createBlankNode(String name) throws UnsupportedOperationException { + throw new UnsupportedOperationException("createBlankNode(String) not supported"); } default Graph createGraph() throws UnsupportedOperationException { throw new UnsupportedOperationException("createGraph() not supported"); } - default IRI createIRI(String iri) throws IllegalArgumentException, - UnsupportedOperationException { - throw new UnsupportedOperationException( - "createIRI(String) not supported"); + default IRI createIRI(String iri) throws IllegalArgumentException, UnsupportedOperationException { + throw new UnsupportedOperationException("createIRI(String) not supported"); } - default Literal createLiteral(String lexicalForm) - throws IllegalArgumentException, UnsupportedOperationException { - throw new UnsupportedOperationException( - "createLiteral(String) not supported"); + default Literal createLiteral(String lexicalForm) throws IllegalArgumentException, UnsupportedOperationException { + throw new UnsupportedOperationException("createLiteral(String) not supported"); } default Literal createLiteral(String lexicalForm, IRI dataType) throws IllegalArgumentException, UnsupportedOperationException { - throw new UnsupportedOperationException( - "createLiteral(String) not supported"); + throw new UnsupportedOperationException("createLiteral(String) not supported"); } default Literal createLiteral(String lexicalForm, String languageTag) throws IllegalArgumentException, UnsupportedOperationException { - throw new UnsupportedOperationException( - "createLiteral(String,String) not supported"); + throw new UnsupportedOperationException("createLiteral(String,String) not supported"); } - default Triple createTriple(BlankNodeOrIRI subject, IRI predicate, - RDFTerm object) throws IllegalArgumentException, - UnsupportedOperationException { - throw new UnsupportedOperationException( - "createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported"); + default Triple createTriple(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) + throws IllegalArgumentException, UnsupportedOperationException { + throw new UnsupportedOperationException("createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported"); } } http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/Triple.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/Triple.java b/api/src/main/java/org/apache/commons/rdf/api/Triple.java index b0866bd..ef9bdaa 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/Triple.java +++ b/api/src/main/java/org/apache/commons/rdf/api/Triple.java @@ -21,14 +21,14 @@ import java.util.Objects; /** * An RDF-1.1 - * Triple, as defined by RDF-1.1 Concepts and Abstract Syntax, a W3C Recommendation published on - * 25 February 2014.
+ * Triple, as defined by + * RDF-1.1 Concepts and + * Abstract Syntax, a W3C Recommendation published on 25 February 2014.
* - * @see Quad + * @see Quad * @see RDF#createTriple(BlankNodeOrIRI,IRI,RDFTerm) * @see RDF-1.1 - * Triple + * Triple */ public interface Triple extends TripleLike { @@ -39,7 +39,7 @@ public interface Triple extends TripleLike { * * @return The subject {@link BlankNodeOrIRI} of this triple. * @see RDF-1.1 - * Triple subject + * Triple subject */ BlankNodeOrIRI getSubject(); @@ -48,7 +48,7 @@ public interface Triple extends TripleLike { * * @return The predicate {@link IRI} of this triple. * @see RDF-1.1 - * Triple predicate + * Triple predicate */ IRI getPredicate(); @@ -59,7 +59,7 @@ public interface Triple extends TripleLike { * * @return The object {@link RDFTerm} of this triple. * @see RDF-1.1 - * Triple object + * Triple object */ RDFTerm getObject(); @@ -74,7 +74,8 @@ public interface Triple extends TripleLike { * Triples produce the same hash code. *

* - * @param other Another object + * @param other + * Another object * @return true if other is a Triple and is equal to this * @see Object#equals(Object) */ @@ -84,13 +85,13 @@ public interface Triple extends TripleLike { /** * Calculate a hash code for this Triple. *

- * The returned hash code MUST be equal to the result - * of {@link Objects#hash(Object...)} with - * the arguments - * {@link #getSubject()}, {@link #getPredicate()}, {@link #getObject()}. + * The returned hash code MUST be equal to the result of + * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()}, + * {@link #getPredicate()}, {@link #getObject()}. *

- * This method MUST be implemented in conjunction with {@link #equals(Object)} - * so that two equal {@link Triple}s produce the same hash code. + * This method MUST be implemented in conjunction with + * {@link #equals(Object)} so that two equal {@link Triple}s produce the + * same hash code. * * @return a hash code value for this Triple. * @see Object#hashCode() http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java index 30e303a..b469aa4 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java +++ b/api/src/main/java/org/apache/commons/rdf/api/TripleLike.java @@ -23,10 +23,9 @@ package org.apache.commons.rdf.api; *

* A TripleLike statement has at least a {@link #getSubject()}, * {@link #getPredicate()} and {@link #getObject()}, but unlike a {@link Triple} - * does not have a formalised - * {@link Triple#equals(Object)} or - * {@link Triple#hashCode()} semantics. This interfaced can also be - * used for generalised triples (e.g. a {@link BlankNode} as predicate). + * does not have a formalised {@link Triple#equals(Object)} or + * {@link Triple#hashCode()} semantics. This interfaced can also be used for + * generalised triples (e.g. a {@link BlankNode} as predicate). *

* Implementations should specialise which specific {@link RDFTerm} types they * return by overriding {@link #getSubject()}, {@link #getPredicate()} and @@ -40,25 +39,25 @@ package org.apache.commons.rdf.api; */ public interface TripleLike { - /** - * The subject of this statement. - * - * @return The subject, typically an {@link IRI} or {@link BlankNode}. - */ - RDFTerm getSubject(); + /** + * The subject of this statement. + * + * @return The subject, typically an {@link IRI} or {@link BlankNode}. + */ + RDFTerm getSubject(); - /** - * The predicate of this statement. - * - * @return The predicate, typically an {@link IRI}. - */ - RDFTerm getPredicate(); + /** + * The predicate of this statement. + * + * @return The predicate, typically an {@link IRI}. + */ + RDFTerm getPredicate(); - /** - * The object of this statement. - * - * @return The object, typically an {@link IRI}, {@link BlankNode} or - * {@link Literal}. - */ - RDFTerm getObject(); + /** + * The object of this statement. + * + * @return The object, typically an {@link IRI}, {@link BlankNode} or + * {@link Literal}. + */ + RDFTerm getObject(); } http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/package-info.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/api/package-info.java b/api/src/main/java/org/apache/commons/rdf/api/package-info.java index 4cecc4f..5099cb0 100644 --- a/api/src/main/java/org/apache/commons/rdf/api/package-info.java +++ b/api/src/main/java/org/apache/commons/rdf/api/package-info.java @@ -22,30 +22,26 @@ * are represented by corresponding interfaces: *

* A {@link org.apache.commons.rdf.api.Graph} is a collection of - * {@link org.apache.commons.rdf.api.Triple}s, - * which have a subject, predicate and object of - * {@link org.apache.commons.rdf.api.RDFTerm}s. - * The three types of RDF terms are {@link org.apache.commons.rdf.api.IRI}, + * {@link org.apache.commons.rdf.api.Triple}s, which have a subject, + * predicate and object of + * {@link org.apache.commons.rdf.api.RDFTerm}s. The three types of RDF terms are + * {@link org.apache.commons.rdf.api.IRI}, * {@link org.apache.commons.rdf.api.Literal} and * {@link org.apache.commons.rdf.api.BlankNode}. *

* Implementations of this API should provide an - * {@link org.apache.commons.rdf.api.RDF} to facilitate - * creation of these objects. + * {@link org.apache.commons.rdf.api.RDF} to facilitate creation of these + * objects. *

* All the {@link org.apache.commons.rdf.api.RDFTerm} objects are immutable, - * while a {@link org.apache.commons.rdf.api.Graph} - * MAY be mutable (e.g. support methods like - * {@link org.apache.commons.rdf.api.Graph#add(Triple)}). + * while a {@link org.apache.commons.rdf.api.Graph} MAY be mutable (e.g. support + * methods like {@link org.apache.commons.rdf.api.Graph#add(Triple)}). *

- * {@link org.apache.commons.rdf.api.RDFSyntax} enumerates the - * W3C standard RDF 1.1 syntaxes and their media types. + * {@link org.apache.commons.rdf.api.RDFSyntax} enumerates the W3C standard RDF + * 1.1 syntaxes and their media types. *

* For further documentation and contact details, see the - * Commons RDF - * web site. + * Commons RDF web site. * */ package org.apache.commons.rdf.api; - - http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java index d5684e4..6c93998 100644 --- a/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java +++ b/api/src/main/java/org/apache/commons/rdf/experimental/RDFParser.java @@ -37,11 +37,10 @@ import org.apache.commons.rdf.api.Triple; /** * Parse an RDF source into a target (e.g. a Graph/Dataset). - *

Experimental

- * This interface (and its implementations) should be considered at - * risk; they might change or be removed in the next minor update of - * Commons RDF. It may move to the the {@link org.apache.commons.rdf.api} - * package when it has stabilized. + *

Experimental

This interface (and its implementations) should be + * considered at risk; they might change or be removed in the + * next minor update of Commons RDF. It may move to the the + * {@link org.apache.commons.rdf.api} package when it has stabilized. *

Description

*

* This interface follows the @@ -62,436 +61,425 @@ import org.apache.commons.rdf.api.Triple; * Setting a method that has already been set will override any existing value * in the returned builder - regardless of the parameter type (e.g. * {@link #source(IRI)} will override a previous {@link #source(Path)}. Settings - * can be unset by passing null - note that this may - * require casting, e.g. contentType( (RDFSyntax) null ) - * to undo a previous call to {@link #contentType(RDFSyntax)}. + * can be unset by passing null - note that this may require + * casting, e.g. contentType( (RDFSyntax) null ) to undo a previous + * call to {@link #contentType(RDFSyntax)}. *

- * It is undefined if a RDFParser is mutable or thread-safe, so callers - * should always use the returned modified RDFParser from the builder - * methods. The builder may return itself after modification, - * or a cloned builder with the modified settings applied. - * Implementations are however encouraged to be immutable, - * thread-safe and document this. As an example starting point, see + * It is undefined if a RDFParser is mutable or thread-safe, so callers should + * always use the returned modified RDFParser from the builder methods. The + * builder may return itself after modification, or a cloned builder with the + * modified settings applied. Implementations are however encouraged to be + * immutable, thread-safe and document this. As an example starting point, see * org.apache.commons.rdf.simple.AbstractRDFParser. *

* Example usage: *

* *
- *   Graph g1 = rDFTermFactory.createGraph();
- *   new ExampleRDFParserBuilder()
- *    	.source(Paths.get("/tmp/graph.ttl"))
- *    	.contentType(RDFSyntax.TURTLE)
- *   	.target(g1)
- *   	.parse().get(30, TimeUnit.Seconds);
+ * Graph g1 = rDFTermFactory.createGraph();
+ * new ExampleRDFParserBuilder().source(Paths.get("/tmp/graph.ttl")).contentType(RDFSyntax.TURTLE).target(g1).parse()
+ *         .get(30, TimeUnit.Seconds);
  * 
* */ public interface RDFParser { - /** - * The result of {@link RDFParser#parse()} indicating - * parsing completed. - *

- * This is a marker interface that may be subclassed to include - * parser details, e.g. warning messages or triple counts. - */ - public interface ParseResult { - } + /** + * The result of {@link RDFParser#parse()} indicating parsing completed. + *

+ * This is a marker interface that may be subclassed to include parser + * details, e.g. warning messages or triple counts. + */ + public interface ParseResult { + } - /** - * Specify which {@link RDF} to use for generating - * {@link RDFTerm}s. - *

- * This option may be used together with {@link #target(Graph)} to - * override the implementation's default factory and graph. - *

- * Warning: Using the same {@link RDF} for - * multiple {@link #parse()} calls may accidentally merge - * {@link BlankNode}s having the same label, as the parser may - * use the {@link RDF#createBlankNode(String)} method - * from the parsed blank node labels. - * - * @see #target(Graph) - * @param rdfTermFactory - * {@link RDF} to use for generating RDFTerms. - * @return An {@link RDFParser} that will use the specified - * rdfTermFactory - */ - RDFParser rdfTermFactory(RDF rdfTermFactory); + /** + * Specify which {@link RDF} to use for generating {@link RDFTerm}s. + *

+ * This option may be used together with {@link #target(Graph)} to override + * the implementation's default factory and graph. + *

+ * Warning: Using the same {@link RDF} for multiple + * {@link #parse()} calls may accidentally merge {@link BlankNode}s having + * the same label, as the parser may use the + * {@link RDF#createBlankNode(String)} method from the parsed blank node + * labels. + * + * @see #target(Graph) + * @param rdfTermFactory + * {@link RDF} to use for generating RDFTerms. + * @return An {@link RDFParser} that will use the specified rdfTermFactory + */ + RDFParser rdfTermFactory(RDF rdfTermFactory); - /** - * Specify the content type of the RDF syntax to parse. - *

- * This option can be used to select the RDFSyntax of the source, overriding - * any Content-Type headers or equivalent. - *

- * The character set of the RDFSyntax is assumed to be - * {@link StandardCharsets#UTF_8} unless overridden within the document - * (e.g. {@code } in - * {@link RDFSyntax#RDFXML}). - *

- * This method will override any contentType set with - * {@link #contentType(String)}. - * - * @see #contentType(String) - * @param rdfSyntax - * An {@link RDFSyntax} to parse the source according to, e.g. - * {@link RDFSyntax#TURTLE}. - * @throws IllegalArgumentException - * If this RDFParser does not support the specified - * RDFSyntax. - * @return An {@link RDFParser} that will use the specified content - * type. - */ - RDFParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException; + /** + * Specify the content type of the RDF syntax to parse. + *

+ * This option can be used to select the RDFSyntax of the source, overriding + * any Content-Type headers or equivalent. + *

+ * The character set of the RDFSyntax is assumed to be + * {@link StandardCharsets#UTF_8} unless overridden within the document + * (e.g. {@code } in + * {@link RDFSyntax#RDFXML}). + *

+ * This method will override any contentType set with + * {@link #contentType(String)}. + * + * @see #contentType(String) + * @param rdfSyntax + * An {@link RDFSyntax} to parse the source according to, e.g. + * {@link RDFSyntax#TURTLE}. + * @throws IllegalArgumentException + * If this RDFParser does not support the specified RDFSyntax. + * @return An {@link RDFParser} that will use the specified content type. + */ + RDFParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException; - /** - * Specify the content type of the RDF syntax to parse. - *

- * This option can be used to select the RDFSyntax of the source, overriding - * any Content-Type headers or equivalent. - *

- * The content type MAY include a charset parameter if the RDF - * media types permit it; the default charset is - * {@link StandardCharsets#UTF_8} unless overridden within the document. - *

- * This method will override any contentType set with - * {@link #contentType(RDFSyntax)}. - * - * @see #contentType(RDFSyntax) - * @param contentType - * A content-type string, e.g. application/ld+json - * or text/turtle;charset="UTF-8" as specified by - * - * RFC7231. - * @return An {@link RDFParser} that will use the specified content - * type. - * @throws IllegalArgumentException - * If the contentType has an invalid syntax, or this - * RDFParser does not support the specified contentType. - */ - RDFParser contentType(String contentType) throws IllegalArgumentException; + /** + * Specify the content type of the RDF syntax to parse. + *

+ * This option can be used to select the RDFSyntax of the source, overriding + * any Content-Type headers or equivalent. + *

+ * The content type MAY include a charset parameter if the RDF + * media types permit it; the default charset is + * {@link StandardCharsets#UTF_8} unless overridden within the document. + *

+ * This method will override any contentType set with + * {@link #contentType(RDFSyntax)}. + * + * @see #contentType(RDFSyntax) + * @param contentType + * A content-type string, e.g. application/ld+json + * or text/turtle;charset="UTF-8" as specified by + * + * RFC7231. + * @return An {@link RDFParser} that will use the specified content type. + * @throws IllegalArgumentException + * If the contentType has an invalid syntax, or this RDFParser + * does not support the specified contentType. + */ + RDFParser contentType(String contentType) throws IllegalArgumentException; - /** - * Specify a {@link Graph} to add parsed triples to. - *

- * If the source supports datasets (e.g. the {@link #contentType(RDFSyntax)} - * set has {@link RDFSyntax#supportsDataset} is true)), then only quads in - * the default graph will be added to the Graph as {@link Triple}s. - *

- * It is undefined if any triples are added to the specified {@link Graph} - * if {@link #parse()} throws any exceptions. (However implementations are - * free to prevent this using transaction mechanisms or similar). If - * {@link Future#get()} does not indicate an exception, the parser - * implementation SHOULD have inserted all parsed triples to the specified - * graph. - *

- * Calling this method will override any earlier targets set with - * {@link #target(Graph)}, {@link #target(Consumer)} or - * {@link #target(Dataset)}. - *

- * The default implementation of this method calls {@link #target(Consumer)} - * with a {@link Consumer} that does {@link Graph#add(Triple)} with - * {@link Quad#asTriple()} if the quad is in the default graph. - * - * @param graph - * The {@link Graph} to add triples to. - * @return An {@link RDFParser} that will insert triples into the - * specified graph. - */ - default RDFParser target(Graph graph) { - return target(q -> { - if (! q.getGraphName().isPresent()) { - graph.add(q.asTriple()); - } - }); - } + /** + * Specify a {@link Graph} to add parsed triples to. + *

+ * If the source supports datasets (e.g. the {@link #contentType(RDFSyntax)} + * set has {@link RDFSyntax#supportsDataset} is true)), then only quads in + * the default graph will be added to the Graph as {@link Triple}s. + *

+ * It is undefined if any triples are added to the specified {@link Graph} + * if {@link #parse()} throws any exceptions. (However implementations are + * free to prevent this using transaction mechanisms or similar). If + * {@link Future#get()} does not indicate an exception, the parser + * implementation SHOULD have inserted all parsed triples to the specified + * graph. + *

+ * Calling this method will override any earlier targets set with + * {@link #target(Graph)}, {@link #target(Consumer)} or + * {@link #target(Dataset)}. + *

+ * The default implementation of this method calls {@link #target(Consumer)} + * with a {@link Consumer} that does {@link Graph#add(Triple)} with + * {@link Quad#asTriple()} if the quad is in the default graph. + * + * @param graph + * The {@link Graph} to add triples to. + * @return An {@link RDFParser} that will insert triples into the specified + * graph. + */ + default RDFParser target(Graph graph) { + return target(q -> { + if (!q.getGraphName().isPresent()) { + graph.add(q.asTriple()); + } + }); + } - /** - * Specify a {@link Dataset} to add parsed quads to. - *

- * It is undefined if any quads are added to the specified - * {@link Dataset} if {@link #parse()} throws any exceptions. - * (However implementations are free to prevent this using transaction - * mechanisms or similar). On the other hand, if {@link #parse()} - * does not indicate an exception, the - * implementation SHOULD have inserted all parsed quads - * to the specified dataset. - *

- * Calling this method will override any earlier targets set with - * {@link #target(Graph)}, {@link #target(Consumer)} or {@link #target(Dataset)}. - *

- * The default implementation of this method calls {@link #target(Consumer)} - * with a {@link Consumer} that does {@link Dataset#add(Quad)}. - * - * @param dataset - * The {@link Dataset} to add quads to. - * @return An {@link RDFParser} that will insert triples into the - * specified dataset. - */ - default RDFParser target(Dataset dataset) { - return target(dataset::add); - } + /** + * Specify a {@link Dataset} to add parsed quads to. + *

+ * It is undefined if any quads are added to the specified {@link Dataset} + * if {@link #parse()} throws any exceptions. (However implementations are + * free to prevent this using transaction mechanisms or similar). On the + * other hand, if {@link #parse()} does not indicate an exception, the + * implementation SHOULD have inserted all parsed quads to the specified + * dataset. + *

+ * Calling this method will override any earlier targets set with + * {@link #target(Graph)}, {@link #target(Consumer)} or + * {@link #target(Dataset)}. + *

+ * The default implementation of this method calls {@link #target(Consumer)} + * with a {@link Consumer} that does {@link Dataset#add(Quad)}. + * + * @param dataset + * The {@link Dataset} to add quads to. + * @return An {@link RDFParser} that will insert triples into the specified + * dataset. + */ + default RDFParser target(Dataset dataset) { + return target(dataset::add); + } - /** - * Specify a consumer for parsed quads. - *

- * The quads will include triples in all named graphs of the parsed - * source, including any triples in the default graph. - * When parsing a source format which do not support datasets, all quads - * delivered to the consumer will be in the default graph - * (e.g. their {@link Quad#getGraphName()} will be - * as {@link Optional#empty()}), while for a source - *

- * It is undefined if any quads are consumed if {@link #parse()} throws any - * exceptions. On the other hand, if {@link #parse()} does not indicate an - * exception, the implementation SHOULD have produced all parsed quads to - * the specified consumer. - *

- * Calling this method will override any earlier targets set with - * {@link #target(Graph)}, {@link #target(Consumer)} or - * {@link #target(Dataset)}. - *

- * The consumer is not assumed to be thread safe - only one - * {@link Consumer#accept(Object)} is delivered at a time for a given - * {@link RDFParser#parse()} call. - *

- * This method is typically called with a functional consumer, for example: - *

-	 * {@code
-	 * List quads = new ArrayList;
-	 * parserBuilder.target(quads::add).parse();
-	 * }
-	 * 
- * - * @param consumer - * A {@link Consumer} of {@link Quad}s - * @return An {@link RDFParser} that will call the consumer for into - * the specified dataset. - */ - RDFParser target(Consumer consumer); - - /** - * Specify a base IRI to use for parsing any relative IRI references. - *

- * Setting this option will override any protocol-specific base IRI (e.g. - * Content-Location header) or the {@link #source(IRI)} IRI, - * but does not override any base IRIs set within the source document (e.g. - * @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. - *

- * 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 RDFParser} that will use the specified base IRI. - */ - RDFParser base(IRI base); + /** + * Specify a consumer for parsed quads. + *

+ * The quads will include triples in all named graphs of the parsed source, + * including any triples in the default graph. When parsing a source format + * which do not support datasets, all quads delivered to the consumer will + * be in the default graph (e.g. their {@link Quad#getGraphName()} will be + * as {@link Optional#empty()}), while for a source + *

+ * It is undefined if any quads are consumed if {@link #parse()} throws any + * exceptions. On the other hand, if {@link #parse()} does not indicate an + * exception, the implementation SHOULD have produced all parsed quads to + * the specified consumer. + *

+ * Calling this method will override any earlier targets set with + * {@link #target(Graph)}, {@link #target(Consumer)} or + * {@link #target(Dataset)}. + *

+ * The consumer is not assumed to be thread safe - only one + * {@link Consumer#accept(Object)} is delivered at a time for a given + * {@link RDFParser#parse()} call. + *

+ * This method is typically called with a functional consumer, for example: + * + *

+     * {@code
+     * List quads = new ArrayList;
+     * parserBuilder.target(quads::add).parse();
+     * }
+     * 
+ * + * @param consumer + * A {@link Consumer} of {@link Quad}s + * @return An {@link RDFParser} that will call the consumer for into the + * specified dataset. + */ + RDFParser target(Consumer consumer); - /** - * Specify a base IRI to use for parsing any relative IRI references. - *

- * Setting this option will override any protocol-specific base IRI (e.g. - * Content-Location header) or the {@link #source(IRI)} IRI, - * but does not override any base IRIs set within the source document (e.g. - * @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. - *

- * 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 RDFParser} that will use the specified base IRI. - * @throws IllegalArgumentException - * If the base is not a valid absolute IRI string - */ - RDFParser base(String base) throws IllegalArgumentException; + /** + * Specify a base IRI to use for parsing any relative IRI references. + *

+ * Setting this option will override any protocol-specific base IRI (e.g. + * Content-Location header) or the {@link #source(IRI)} IRI, + * but does not override any base IRIs set within the source document (e.g. + * @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. + *

+ * 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 RDFParser} that will use the specified base IRI. + */ + RDFParser base(IRI base); - /** - * 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. 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 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 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)}. - * - * @param inputStream - * An InputStream to consume - * @return An {@link RDFParser} that will use the specified source. - */ - RDFParser source(InputStream inputStream); + /** + * Specify a base IRI to use for parsing any relative IRI references. + *

+ * Setting this option will override any protocol-specific base IRI (e.g. + * Content-Location header) or the {@link #source(IRI)} IRI, + * but does not override any base IRIs set within the source document (e.g. + * @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. + *

+ * 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 RDFParser} that will use the specified base IRI. + * @throws IllegalArgumentException + * If the base is not a valid absolute IRI string + */ + RDFParser base(String base) throws IllegalArgumentException; - /** - * 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 RDFParser} that will use the specified source. - */ - RDFParser source(Path file); + /** + * 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. 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 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 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)}. + * + * @param inputStream + * An InputStream to consume + * @return An {@link RDFParser} that will use the specified source. + */ + RDFParser source(InputStream inputStream); - /** - * 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 protocol (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 RDFParser} that will use the specified source. - */ - RDFParser source(IRI iri); + /** + * 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 RDFParser} that will use the specified source. + */ + RDFParser source(Path file); - /** - * 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 RDFParser} that will use the specified source. - * @throws IllegalArgumentException - * If the base is not a valid absolute IRI string - * - */ - RDFParser source(String iri) throws IllegalArgumentException; + /** + * 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 protocol (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 RDFParser} that will use the specified source. + */ + RDFParser source(IRI iri); - /** - * Parse the specified source. - *

- * A source method (e.g. {@link #source(InputStream)}, {@link #source(IRI)}, - * {@link #source(Path)}, {@link #source(String)} or an equivalent subclass - * method) MUST have been called before calling this method, otherwise an - * {@link IllegalStateException} will be thrown. - *

- * A target method (e.g. {@link #target(Consumer)}, {@link #target(Dataset)}, - * {@link #target(Graph)} or an equivalent subclass method) MUST have been - * called before calling parse(), otherwise an - * {@link IllegalStateException} will be thrown. - *

- * It is undefined if this method is thread-safe, however the - * {@link RDFParser} may be reused (e.g. setting a different source) - * as soon as the {@link Future} has been returned from this method. - *

- * The RDFParser SHOULD perform the parsing as an asynchronous - * operation, and return the {@link Future} as soon as preliminary checks - * (such as validity of the {@link #source(IRI)} and - * {@link #contentType(RDFSyntax)} settings) have finished. The future - * SHOULD not mark {@link Future#isDone()} before parsing is complete. A - * synchronous implementation MAY be blocking on the parse() - * call and return a Future that is already {@link Future#isDone()}. - *

- * The returned {@link Future} contains a {@link ParseResult}. - * Implementations may subclass this interface to provide any - * parser details, e.g. list of warnings. null is a - * possible return value if no details are available, but - * parsing succeeded. - *

- * If an exception occurs during parsing, (e.g. {@link IOException} or - * org.apache.commons.rdf.simple.experimental.RDFParseException), - * it should be indicated as the - * {@link java.util.concurrent.ExecutionException#getCause()} in the - * {@link java.util.concurrent.ExecutionException} thrown on - * {@link Future#get()}. - * - * @return A Future that will return the populated {@link Graph} when the - * parsing has finished. - * @throws IOException - * If an error occurred while starting to read the source (e.g. - * file not found, unsupported IRI protocol). Note that IO - * errors during parsing would instead be the - * {@link java.util.concurrent.ExecutionException#getCause()} of - * the {@link java.util.concurrent.ExecutionException} thrown on - * {@link Future#get()}. - * @throws IllegalStateException - * If the builder is in an invalid state, e.g. a - * source has not been set. - */ - Future parse() throws IOException, IllegalStateException; + /** + * 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 RDFParser} that will use the specified source. + * @throws IllegalArgumentException + * If the base is not a valid absolute IRI string + * + */ + RDFParser source(String iri) throws IllegalArgumentException; + + /** + * Parse the specified source. + *

+ * A source method (e.g. {@link #source(InputStream)}, {@link #source(IRI)}, + * {@link #source(Path)}, {@link #source(String)} or an equivalent subclass + * method) MUST have been called before calling this method, otherwise an + * {@link IllegalStateException} will be thrown. + *

+ * A target method (e.g. {@link #target(Consumer)}, + * {@link #target(Dataset)}, {@link #target(Graph)} or an equivalent + * subclass method) MUST have been called before calling parse(), otherwise + * an {@link IllegalStateException} will be thrown. + *

+ * It is undefined if this method is thread-safe, however the + * {@link RDFParser} may be reused (e.g. setting a different source) as soon + * as the {@link Future} has been returned from this method. + *

+ * The RDFParser SHOULD perform the parsing as an asynchronous operation, + * and return the {@link Future} as soon as preliminary checks (such as + * validity of the {@link #source(IRI)} and {@link #contentType(RDFSyntax)} + * settings) have finished. The future SHOULD not mark + * {@link Future#isDone()} before parsing is complete. A synchronous + * implementation MAY be blocking on the parse() call and + * return a Future that is already {@link Future#isDone()}. + *

+ * The returned {@link Future} contains a {@link ParseResult}. + * Implementations may subclass this interface to provide any parser + * details, e.g. list of warnings. null is a possible return + * value if no details are available, but parsing succeeded. + *

+ * If an exception occurs during parsing, (e.g. {@link IOException} or + * org.apache.commons.rdf.simple.experimental.RDFParseException), + * it should be indicated as the + * {@link java.util.concurrent.ExecutionException#getCause()} in the + * {@link java.util.concurrent.ExecutionException} thrown on + * {@link Future#get()}. + * + * @return A Future that will return the populated {@link Graph} when the + * parsing has finished. + * @throws IOException + * If an error occurred while starting to read the source (e.g. + * file not found, unsupported IRI protocol). Note that IO + * errors during parsing would instead be the + * {@link java.util.concurrent.ExecutionException#getCause()} of + * the {@link java.util.concurrent.ExecutionException} thrown on + * {@link Future#get()}. + * @throws IllegalStateException + * If the builder is in an invalid state, e.g. a + * source has not been set. + */ + Future parse() throws IOException, IllegalStateException; } http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java ---------------------------------------------------------------------- diff --git a/api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java b/api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java index b61c64a..31593c5 100644 --- a/api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java +++ b/api/src/test/java/org/apache/commons/rdf/api/AbstractBlankNodeTest.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertNotEquals; public abstract class AbstractBlankNodeTest { /** - * This method must be overridden by the implementing test to - * create a {@link BlankNode} to be tested. + * This method must be overridden by the implementing test to create a + * {@link BlankNode} to be tested. *

* Each call to this method must provide a new, unique BlankNode. * @@ -46,15 +46,15 @@ public abstract class AbstractBlankNodeTest { * test may be the same object, or they may be different objects. *

* - * @param identifier The identifier to use as the reference for creating the blank - * node that is returned. + * @param identifier + * The identifier to use as the reference for creating the blank + * node that is returned. * @return A new blank node based on the */ protected abstract BlankNode getBlankNode(String identifier); /** - * Test method for - * {@link BlankNode#uniqueReference()}. + * Test method for {@link BlankNode#uniqueReference()}. */ @Test public final void testInternalIdentifier() { @@ -76,35 +76,23 @@ public abstract class AbstractBlankNodeTest { BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub - assertNotEquals(testNull.uniqueReference(), - testAutomatic1.uniqueReference()); - assertNotEquals(testAutomatic1.uniqueReference(), - testNull.uniqueReference()); - assertNotEquals(testNull.uniqueReference(), - testManual3a.uniqueReference()); - assertNotEquals(testManual3a.uniqueReference(), - testNull.uniqueReference()); + assertNotEquals(testNull.uniqueReference(), testAutomatic1.uniqueReference()); + assertNotEquals(testAutomatic1.uniqueReference(), testNull.uniqueReference()); + assertNotEquals(testNull.uniqueReference(), testManual3a.uniqueReference()); + assertNotEquals(testManual3a.uniqueReference(), testNull.uniqueReference()); // Test the two imported instances against each other - assertEquals(testAutomatic1.uniqueReference(), - testAutomatic1.uniqueReference()); - assertEquals(testAutomatic2.uniqueReference(), - testAutomatic2.uniqueReference()); - assertNotEquals(testAutomatic1.uniqueReference(), - testAutomatic2.uniqueReference()); - assertNotEquals(testAutomatic2.uniqueReference(), - testAutomatic1.uniqueReference()); - assertNotEquals(testAutomatic1.uniqueReference(), - testManual3a.uniqueReference()); - assertEquals(testManual3b.uniqueReference(), - testManual3a.uniqueReference()); - assertNotEquals(testManual3a.uniqueReference(), - testManual4.uniqueReference()); + assertEquals(testAutomatic1.uniqueReference(), testAutomatic1.uniqueReference()); + assertEquals(testAutomatic2.uniqueReference(), testAutomatic2.uniqueReference()); + assertNotEquals(testAutomatic1.uniqueReference(), testAutomatic2.uniqueReference()); + assertNotEquals(testAutomatic2.uniqueReference(), testAutomatic1.uniqueReference()); + assertNotEquals(testAutomatic1.uniqueReference(), testManual3a.uniqueReference()); + assertEquals(testManual3b.uniqueReference(), testManual3a.uniqueReference()); + assertNotEquals(testManual3a.uniqueReference(), testManual4.uniqueReference()); } /** - * Test method for - * {@link BlankNode#equals(java.lang.Object)}. + * Test method for {@link BlankNode#equals(java.lang.Object)}. */ @Test public final void testEquals() { @@ -180,8 +168,7 @@ public abstract class AbstractBlankNodeTest { } /** - * Test method for - * {@link RDFTerm#ntriplesString()}. + * Test method for {@link RDFTerm#ntriplesString()}. */ @Test public final void testNtriplesString() { @@ -203,30 +190,19 @@ public abstract class AbstractBlankNodeTest { BlankNode testManual4 = getBlankNode("4"); // Test against our fake stub - assertNotEquals(testNull.ntriplesString(), - testAutomatic1.ntriplesString()); - assertNotEquals(testAutomatic1.ntriplesString(), - testNull.ntriplesString()); - assertNotEquals(testNull.ntriplesString(), - testManual3a.ntriplesString()); - assertNotEquals(testManual3a.ntriplesString(), - testNull.ntriplesString()); + assertNotEquals(testNull.ntriplesString(), testAutomatic1.ntriplesString()); + assertNotEquals(testAutomatic1.ntriplesString(), testNull.ntriplesString()); + assertNotEquals(testNull.ntriplesString(), testManual3a.ntriplesString()); + assertNotEquals(testManual3a.ntriplesString(), testNull.ntriplesString()); // Test the two imported instances against each other - assertEquals(testAutomatic1.ntriplesString(), - testAutomatic1.ntriplesString()); - assertEquals(testAutomatic2.ntriplesString(), - testAutomatic2.ntriplesString()); - assertNotEquals(testAutomatic1.ntriplesString(), - testAutomatic2.ntriplesString()); - assertNotEquals(testAutomatic2.ntriplesString(), - testAutomatic1.ntriplesString()); - assertNotEquals(testAutomatic1.ntriplesString(), - testManual3a.ntriplesString()); - assertEquals(testManual3b.ntriplesString(), - testManual3a.ntriplesString()); - assertNotEquals(testManual3a.ntriplesString(), - testManual4.ntriplesString()); + assertEquals(testAutomatic1.ntriplesString(), testAutomatic1.ntriplesString()); + assertEquals(testAutomatic2.ntriplesString(), testAutomatic2.ntriplesString()); + assertNotEquals(testAutomatic1.ntriplesString(), testAutomatic2.ntriplesString()); + assertNotEquals(testAutomatic2.ntriplesString(), testAutomatic1.ntriplesString()); + assertNotEquals(testAutomatic1.ntriplesString(), testManual3a.ntriplesString()); + assertEquals(testManual3b.ntriplesString(), testManual3a.ntriplesString()); + assertNotEquals(testManual3a.ntriplesString(), testManual4.ntriplesString()); } }