You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2016/10/28 13:15:11 UTC
[49/49] incubator-commonsrdf git commit: Reformat tab -> spaces
Reformat tab -> spaces
Using Eclipse Neon profile customized to 4 spaces indent
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/413dd09a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/413dd09a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/413dd09a
Branch: refs/heads/master
Commit: 413dd09a6746a4d6acde9e293b399c735cf7b935
Parents: f1ea9cd
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Oct 28 11:41:50 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Oct 28 11:41:50 2016 +0100
----------------------------------------------------------------------
.../org/apache/commons/rdf/api/BlankNode.java | 50 +-
.../org/apache/commons/rdf/api/Dataset.java | 585 ++++----
.../java/org/apache/commons/rdf/api/Graph.java | 141 +-
.../org/apache/commons/rdf/api/GraphLike.java | 100 +-
.../java/org/apache/commons/rdf/api/IRI.java | 20 +-
.../org/apache/commons/rdf/api/Literal.java | 80 +-
.../java/org/apache/commons/rdf/api/Quad.java | 322 ++---
.../org/apache/commons/rdf/api/QuadLike.java | 34 +-
.../java/org/apache/commons/rdf/api/RDF.java | 182 +--
.../org/apache/commons/rdf/api/RDFSyntax.java | 315 ++--
.../org/apache/commons/rdf/api/RDFTerm.java | 5 +-
.../apache/commons/rdf/api/RDFTermFactory.java | 39 +-
.../java/org/apache/commons/rdf/api/Triple.java | 31 +-
.../org/apache/commons/rdf/api/TripleLike.java | 45 +-
.../apache/commons/rdf/api/package-info.java | 26 +-
.../commons/rdf/experimental/RDFParser.java | 814 ++++++-----
.../commons/rdf/api/AbstractBlankNodeTest.java | 84 +-
.../commons/rdf/api/AbstractGraphTest.java | 245 ++--
.../apache/commons/rdf/api/AbstractRDFTest.java | 95 +-
.../apache/commons/rdf/api/RDFSyntaxTest.java | 172 +--
examples/src/example/UserGuideTest.java | 403 +++---
.../rdf/integrationtests/AllToAllTest.java | 253 ++--
.../commons/rdf/jena/ConversionException.java | 26 +-
.../apache/commons/rdf/jena/JenaDataset.java | 45 +-
.../rdf/jena/JenaGeneralizedTripleLike.java | 3 +-
.../org/apache/commons/rdf/jena/JenaGraph.java | 45 +-
.../org/apache/commons/rdf/jena/JenaIRI.java | 2 +-
.../org/apache/commons/rdf/jena/JenaQuad.java | 9 +-
.../apache/commons/rdf/jena/JenaQuadLike.java | 15 +-
.../org/apache/commons/rdf/jena/JenaRDF.java | 1353 +++++++++---------
.../apache/commons/rdf/jena/JenaRDFTerm.java | 2 +-
.../org/apache/commons/rdf/jena/JenaTriple.java | 6 +-
.../apache/commons/rdf/jena/JenaTripleLike.java | 15 +-
.../rdf/jena/experimental/JenaRDFParser.java | 114 +-
.../rdf/jena/experimental/package-info.java | 8 +-
.../rdf/jena/impl/AbstractJenaRDFTerm.java | 32 +-
.../commons/rdf/jena/impl/AbstractQuadLike.java | 191 ++-
.../rdf/jena/impl/InternalJenaFactory.java | 202 +--
.../rdf/jena/impl/JenaBlankNodeImpl.java | 62 +-
.../commons/rdf/jena/impl/JenaDatasetImpl.java | 275 ++--
.../jena/impl/JenaGeneralizedQuadLikeImpl.java | 15 +-
.../impl/JenaGeneralizedTripleLikeImpl.java | 14 +-
.../commons/rdf/jena/impl/JenaGraphImpl.java | 225 ++-
.../commons/rdf/jena/impl/JenaIRIImpl.java | 66 +-
.../commons/rdf/jena/impl/JenaLiteralImpl.java | 79 +-
.../commons/rdf/jena/impl/JenaQuadImpl.java | 58 +-
.../commons/rdf/jena/impl/JenaTripleImpl.java | 66 +-
.../apache/commons/rdf/jena/JenaRDFTest.java | 3 +-
.../commons/rdf/jena/JenaServiceLoaderTest.java | 8 +-
.../commons/rdf/jena/TestBlankNodeJena.java | 16 +-
.../apache/commons/rdf/jena/TestGraphJena.java | 1 -
.../jena/TestJenaGraphToCommonsRDFGraph.java | 105 +-
.../commons/rdf/jena/TestRDFParserBuilder.java | 48 +-
.../commons/rdf/jsonldjava/JsonLdBlankNode.java | 75 +-
.../commons/rdf/jsonldjava/JsonLdDataset.java | 143 +-
.../commons/rdf/jsonldjava/JsonLdGraph.java | 150 +-
.../commons/rdf/jsonldjava/JsonLdGraphLike.java | 341 +++--
.../commons/rdf/jsonldjava/JsonLdIRI.java | 74 +-
.../commons/rdf/jsonldjava/JsonLdLiteral.java | 139 +-
.../commons/rdf/jsonldjava/JsonLdQuad.java | 53 +-
.../commons/rdf/jsonldjava/JsonLdQuadLike.java | 90 +-
.../commons/rdf/jsonldjava/JsonLdRDF.java | 494 +++----
.../commons/rdf/jsonldjava/JsonLdTerm.java | 36 +-
.../commons/rdf/jsonldjava/JsonLdTriple.java | 45 +-
.../rdf/jsonldjava/JsonLdTripleLike.java | 13 +-
.../rdf/jsonldjava/JsonLdUnionGraph.java | 147 +-
.../jsonldjava/experimental/JsonLdParser.java | 218 +--
.../jsonldjava/experimental/package-info.java | 11 +-
jsonld-java/src/main/resources/test.jsonld | 8 +-
.../rdf/jsonldjava/JsonLdBlankNodeTest.java | 22 +-
.../commons/rdf/jsonldjava/JsonLdGraphTest.java | 9 +-
.../rdf/jsonldjava/JsonLdParserBuilderTest.java | 150 +-
.../commons/rdf/jsonldjava/JsonLdRDFTest.java | 54 +-
.../rdf/jsonldjava/JsonLdServiceLoaderTest.java | 10 +-
.../commons/rdf/rdf4j/ClosableIterable.java | 9 +-
.../org/apache/commons/rdf/rdf4j/RDF4J.java | 995 +++++++------
.../commons/rdf/rdf4j/RDF4JBlankNode.java | 18 +-
.../commons/rdf/rdf4j/RDF4JBlankNodeOrIRI.java | 6 +-
.../apache/commons/rdf/rdf4j/RDF4JDataset.java | 190 +--
.../apache/commons/rdf/rdf4j/RDF4JGraph.java | 209 +--
.../commons/rdf/rdf4j/RDF4JGraphLike.java | 47 +-
.../org/apache/commons/rdf/rdf4j/RDF4JIRI.java | 19 +-
.../org/apache/commons/rdf/rdf4j/RDF4JQuad.java | 6 +-
.../org/apache/commons/rdf/rdf4j/RDF4JTerm.java | 17 +-
.../apache/commons/rdf/rdf4j/RDF4JTriple.java | 5 +-
.../commons/rdf/rdf4j/RDF4JTripleLike.java | 19 +-
.../rdf/rdf4j/experimental/RDF4JParser.java | 342 ++---
.../rdf/rdf4j/experimental/package-info.java | 8 +-
.../commons/rdf/rdf4j/impl/AbstractRDFTerm.java | 16 +-
.../rdf4j/impl/AbstractRepositoryGraphLike.java | 75 +-
.../commons/rdf/rdf4j/impl/BlankNodeImpl.java | 121 +-
.../rdf/rdf4j/impl/ConvertedStatements.java | 66 +-
.../apache/commons/rdf/rdf4j/impl/IRIImpl.java | 81 +-
.../rdf/rdf4j/impl/InternalRDF4JFactory.java | 236 +--
.../commons/rdf/rdf4j/impl/LiteralImpl.java | 102 +-
.../commons/rdf/rdf4j/impl/ModelGraphImpl.java | 228 ++-
.../apache/commons/rdf/rdf4j/impl/QuadImpl.java | 129 +-
.../rdf/rdf4j/impl/RepositoryDatasetImpl.java | 361 ++---
.../rdf/rdf4j/impl/RepositoryGraphImpl.java | 297 ++--
.../commons/rdf/rdf4j/impl/TripleImpl.java | 95 +-
.../apache/commons/rdf/rdf4j/package-info.java | 36 +-
.../apache/commons/rdf/rdf4j/BlankNodeTest.java | 20 +-
.../org/apache/commons/rdf/rdf4j/GraphTest.java | 10 +-
.../commons/rdf/rdf4j/MemoryGraphTest.java | 104 +-
.../commons/rdf/rdf4j/MemoryStoreRDFTest.java | 22 +-
.../commons/rdf/rdf4j/NativeStoreGraphTest.java | 236 +--
.../rdf/rdf4j/RDF4JServiceLoaderTest.java | 8 +-
.../org/apache/commons/rdf/rdf4j/RDF4JTest.java | 22 +-
.../commons/rdf/simple/BlankNodeImpl.java | 4 +-
.../commons/rdf/simple/DatasetGraphView.java | 175 +--
.../apache/commons/rdf/simple/DatasetImpl.java | 127 +-
.../apache/commons/rdf/simple/GraphImpl.java | 47 +-
.../apache/commons/rdf/simple/LiteralImpl.java | 15 +-
.../org/apache/commons/rdf/simple/QuadImpl.java | 41 +-
.../apache/commons/rdf/simple/SimpleRDF.java | 46 +-
.../rdf/simple/SimpleRDFTermFactory.java | 50 +-
.../apache/commons/rdf/simple/TripleImpl.java | 15 +-
.../org/apache/commons/rdf/simple/Types.java | 128 +-
.../simple/experimental/AbstractRDFParser.java | 1007 ++++++-------
.../simple/experimental/RDFParseException.java | 52 +-
.../apache/commons/rdf/simple/package-info.java | 16 +-
.../rdf/simple/DummyRDFParserBuilder.java | 101 +-
.../commons/rdf/simple/SimpleGraphTest.java | 11 +-
.../rdf/simple/SimpleNoRelativeIRIRDTest.java | 7 +-
.../rdf/simple/SimpleServiceLoaderTest.java | 8 +-
.../commons/rdf/simple/TestWritingGraph.java | 31 +-
.../apache/commons/rdf/simple/TypesTest.java | 25 +-
.../experimental/AbstractRDFParserTest.java | 402 +++---
128 files changed, 7835 insertions(+), 8060 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java b/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java
index f8e6e05..73f8afe 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java
@@ -21,25 +21,26 @@ import java.util.UUID;
/**
* A <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node" >RDF-1.1
- * Blank Node</a>, as defined by <a href=
- * "http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes" >RDF-1.1 Concepts
- * and Abstract Syntax</a>, a W3C Recommendation published on 25 February 2014.<br>
+ * Blank Node</a>, as defined by
+ * <a href= "http://www.w3.org/TR/rdf11-concepts/#section-blank-nodes" >RDF-1.1
+ * Concepts and Abstract Syntax</a>, a W3C Recommendation published on 25
+ * February 2014.<br>
*
- * Note: <blockquote> <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">Blank nodes</a>
+ * Note: <blockquote>
+ * <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">Blank nodes</a>
* are disjoint from IRIs and literals. Otherwise, the set of possible blank
* nodes is arbitrary. RDF makes no reference to any internal structure of blank
* nodes. </blockquote>
*
- * Also note that: <blockquote> <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier">Blank
- * node identifiers</a> are local identifiers that are used in some concrete RDF
- * syntaxes or RDF store implementations. They are always
- * <em>locally scoped</em> to the file or RDF store, and are <em>not</em>
- * persistent or portable identifiers for blank nodes. Blank node identifiers
- * are <em>not</em> part of the RDF abstract syntax, but are entirely dependent
- * on the concrete syntax or implementation. The syntactic restrictions on blank
- * node identifiers, if any, therefore also depend on the concrete RDF syntax or
+ * Also note that: <blockquote> <a href=
+ * "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier">Blank node
+ * identifiers</a> are local identifiers that are used in some concrete RDF
+ * syntaxes or RDF store implementations. They are always <em>locally
+ * scoped</em> to the file or RDF store, and are <em>not</em> persistent or
+ * portable identifiers for blank nodes. Blank node identifiers are <em>not</em>
+ * part of the RDF abstract syntax, but are entirely dependent on the concrete
+ * syntax or implementation. The syntactic restrictions on blank node
+ * identifiers, if any, therefore also depend on the concrete RDF syntax or
* implementation.
*
* Implementations that handle blank node identifiers in concrete syntaxes need
@@ -53,7 +54,7 @@ import java.util.UUID;
* @see RDF#createBlankNode()
* @see RDF#createBlankNode(String)
* @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
- * Blank Node</a>
+ * Blank Node</a>
*/
public interface BlankNode extends BlankNodeOrIRI {
@@ -62,8 +63,8 @@ public interface BlankNode extends BlankNodeOrIRI {
* <p>
* The reference string MUST universally and uniquely identify this blank
* node. That is, different blank nodes created separately in different JVMs
- * or from different {@link RDF} instances MUST NOT have the same
- * reference string.
+ * or from different {@link RDF} instances MUST NOT have the same reference
+ * string.
* <p>
* The {@link #uniqueReference()} of two <code>BlankNode</code> instances
* MUST be equal if and only if the two blank nodes are equal according to
@@ -73,8 +74,8 @@ public interface BlankNode extends BlankNodeOrIRI {
* string, however it is recommended that the reference string contain a
* UUID-derived string, e.g. as returned from {@link UUID#toString()}.
* <p>
- * <strong>IMPORTANT:</strong> This is not a <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier">
+ * <strong>IMPORTANT:</strong> This is not a
+ * <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier">
* blank node identifier</a> nor a serialization/syntax label, and there are
* no guarantees that it is a valid identifier in any concrete RDF syntax.
* For an N-Triples compatible identifier, use {@link #ntriplesString()}.
@@ -91,8 +92,10 @@ public interface BlankNode extends BlankNodeOrIRI {
* Implementations MUST also override {@link #hashCode()} so that two equal
* Literals produce the same hash code.
*
- * @param other Another object
- * @return true if other is a BlankNode instance that represent the same blank node
+ * @param other
+ * Another object
+ * @return true if other is a BlankNode instance that represent the same
+ * blank node
* @see Object#equals(Object)
*/
@Override
@@ -101,9 +104,8 @@ public interface BlankNode extends BlankNodeOrIRI {
/**
* Calculate a hash code for this BlankNode.
* <p>
- * The returned hash code MUST be equal to the
- * {@link String#hashCode()} of the
- * {@link #uniqueReference()}.
+ * The returned hash code MUST be equal to the {@link String#hashCode()} of
+ * the {@link #uniqueReference()}.
* <p>
* This method MUST be implemented in conjunction with
* {@link #equals(Object)} so that two equal BlankNodes produce the same
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Dataset.java b/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
index 03aff91..54721fd 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Dataset.java
@@ -33,309 +33,308 @@ import java.util.stream.Stream;
*/
public interface Dataset extends AutoCloseable, GraphLike<Quad> {
- /**
- * Add a quad to the dataset, possibly mapping any of the components of the
- * Quad to those supported by this dataset.
- *
- * @param quad
- * The quad to add
- */
- void add(Quad quad);
+ /**
+ * Add a quad to the dataset, possibly mapping any of the components of the
+ * Quad to those supported by this dataset.
+ *
+ * @param quad
+ * The quad to add
+ */
+ void add(Quad quad);
- /**
- * Add a quad to the dataset, possibly mapping any of the components to
- * those supported by this dataset.
- *
- * @param graphName
- * The graph the quad belongs to, or <code>null</code> for the
- * default graph
- * @param subject
- * The quad subject
- * @param predicate
- * The quad predicate
- * @param object
- * The quad object
- */
- void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+ /**
+ * Add a quad to the dataset, possibly mapping any of the components to
+ * those supported by this dataset.
+ *
+ * @param graphName
+ * The graph the quad belongs to, or <code>null</code> for the
+ * default graph
+ * @param subject
+ * The quad subject
+ * @param predicate
+ * The quad predicate
+ * @param object
+ * The quad object
+ */
+ void add(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
- /**
- * Check if dataset contains quad.
- *
- * @param quad
- * The quad to check.
- * @return True if the dataset contains the given Quad.
- */
- boolean contains(Quad quad);
+ /**
+ * Check if dataset contains quad.
+ *
+ * @param quad
+ * The quad to check.
+ * @return True if the dataset contains the given Quad.
+ */
+ boolean contains(Quad quad);
- /**
- * Check if dataset contains a pattern of quads.
- *
- * @param graphName
- * The graph the quad belongs to, wrapped as an {@link Optional}
- * (<code>null</code> is a wildcard, {@link Optional#empty()} is
- * the default graph)
- * @param subject
- * The quad subject (<code>null</code> is a wildcard)
- * @param predicate
- * The quad predicate (<code>null</code> is a wildcard)
- * @param object
- * The quad object (<code>null</code> is a wildcard)
- * @return True if the dataset contains any quads that match the given
- * pattern.
- */
- boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+ /**
+ * Check if dataset contains a pattern of quads.
+ *
+ * @param graphName
+ * The graph the quad belongs to, wrapped as an {@link Optional}
+ * (<code>null</code> is a wildcard, {@link Optional#empty()} is
+ * the default graph)
+ * @param subject
+ * The quad subject (<code>null</code> is a wildcard)
+ * @param predicate
+ * The quad predicate (<code>null</code> is a wildcard)
+ * @param object
+ * The quad object (<code>null</code> is a wildcard)
+ * @return True if the dataset contains any quads that match the given
+ * pattern.
+ */
+ boolean contains(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
- /**
- * Close the dataset, relinquishing any underlying resources.
- * <p>
- * For example, this would close any open file and network streams and free
- * database locks held by the dataset implementation.
- * <p>
- * The behaviour of the other dataset methods are undefined after closing
- * the dataset.
- * <p>
- * Implementations might not need {@link #close()}, hence the default
- * implementation does nothing.
- */
- @Override
- default void close() throws Exception {
- }
+ /**
+ * Close the dataset, relinquishing any underlying resources.
+ * <p>
+ * For example, this would close any open file and network streams and free
+ * database locks held by the dataset implementation.
+ * <p>
+ * The behaviour of the other dataset methods are undefined after closing
+ * the dataset.
+ * <p>
+ * Implementations might not need {@link #close()}, hence the default
+ * implementation does nothing.
+ */
+ @Override
+ default void close() throws Exception {
+ }
- /**
- * Get the default graph of this dataset.
- * <p>
- * The {@link Triple}s of the default graph are equivalent to the
- * {@link Quad}s in this Dataset which has the {@link Quad#getGraphName()}
- * set to {@link Optional#empty()}.
- * <p>
- * It is unspecified if modifications to the returned Graph are reflected in
- * this Dataset.
- * <p>
- * The returned graph MAY be empty.
- *
- * @see #getGraph(BlankNodeOrIRI)
- * @return The default graph of this Dataset
- */
- Graph getGraph();
-
- /**
- * Get a named graph in this dataset.
- * <p>
- * The {@link Triple}s of the named graph are equivalent to the
- * the Quads of this Dataset which has the
- * {@link Quad#getGraphName()} equal to the provided <code>graphName</code>, or
- * equal to {@link Optional#empty()} if the provided <code>graphName</code> is
- * <code>null</code>.
- * <p>
- * It is unspecified if modifications to the returned Graph are reflected in
- * this Dataset.
- * <p>
- * It is unspecified if requesting an unknown or empty graph will return
- * {@link Optional#empty()} or create a new empty {@link Graph}.
- *
- * @see #getGraph()
- * @see #getGraphNames()
- * @param graphName
- * The name of the graph, or <code>null</code> for the default
- * graph.
- * @return The named Graph, or {@link Optional#empty()} if the dataset do
- * not contain the named graph.
- */
- Optional<Graph> getGraph(BlankNodeOrIRI graphName);
-
- /**
- * Get the graph names in this Dataset.
- * <p>
- * The set of returned graph names is equivalent to the set of unique
- * {@link Quad#getGraphName()} of all the {@link #stream()} of this
- * dataset (excluding the default graph).
- * <p>
- * The returned {@link Stream} SHOULD NOT contain duplicate graph names.
- * <p>
- * The graph names can be used with {@link #getGraph(BlankNodeOrIRI)} to
- * retrieve the corresponding {@link Graph}, however callers should be aware
- * of any concurrent modifications to the Dataset may cause such calls to
- * return {@link Optional#empty()}.
- * <p>
- * Note that a Dataset always contains a <strong>default graph</strong>
- * which is not named, and thus is not represented in the returned Stream.
- * The default graph is accessible via {@link #getGraph()} or by using
- * {@link Optional#empty()} in the Quad access methods).
- *
- * @return A {@link Stream} of the graph names of this Dataset.
- */
- Stream<BlankNodeOrIRI> getGraphNames();
-
- /**
- * Remove a concrete quad from the dataset.
- *
- * @param quad
- * quad to remove
- */
- void remove(Quad quad);
+ /**
+ * Get the default graph of this dataset.
+ * <p>
+ * The {@link Triple}s of the default graph are equivalent to the
+ * {@link Quad}s in this Dataset which has the {@link Quad#getGraphName()}
+ * set to {@link Optional#empty()}.
+ * <p>
+ * It is unspecified if modifications to the returned Graph are reflected in
+ * this Dataset.
+ * <p>
+ * The returned graph MAY be empty.
+ *
+ * @see #getGraph(BlankNodeOrIRI)
+ * @return The default graph of this Dataset
+ */
+ Graph getGraph();
- /**
- * Remove a concrete pattern of quads from the default graph of the dataset.
- *
- * @param graphName
- * The graph the quad belongs to, wrapped as an {@link Optional}
- * (<code>null</code> is a wildcard, {@link Optional#empty()} is
- * the default graph)
- * @param subject
- * The quad subject (<code>null</code> is a wildcard)
- * @param predicate
- * The quad predicate (<code>null</code> is a wildcard)
- * @param object
- * The quad object (<code>null</code> is a wildcard)
- */
- void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+ /**
+ * Get a named graph in this dataset.
+ * <p>
+ * The {@link Triple}s of the named graph are equivalent to the the Quads of
+ * this Dataset which has the {@link Quad#getGraphName()} equal to the
+ * provided <code>graphName</code>, or equal to {@link Optional#empty()} if
+ * the provided <code>graphName</code> is <code>null</code>.
+ * <p>
+ * It is unspecified if modifications to the returned Graph are reflected in
+ * this Dataset.
+ * <p>
+ * It is unspecified if requesting an unknown or empty graph will return
+ * {@link Optional#empty()} or create a new empty {@link Graph}.
+ *
+ * @see #getGraph()
+ * @see #getGraphNames()
+ * @param graphName
+ * The name of the graph, or <code>null</code> for the default
+ * graph.
+ * @return The named Graph, or {@link Optional#empty()} if the dataset do
+ * not contain the named graph.
+ */
+ Optional<Graph> getGraph(BlankNodeOrIRI graphName);
- /**
- * Clear the dataset, removing all quads.
- */
- void clear();
+ /**
+ * Get the graph names in this Dataset.
+ * <p>
+ * The set of returned graph names is equivalent to the set of unique
+ * {@link Quad#getGraphName()} of all the {@link #stream()} of this dataset
+ * (excluding the default graph).
+ * <p>
+ * The returned {@link Stream} SHOULD NOT contain duplicate graph names.
+ * <p>
+ * The graph names can be used with {@link #getGraph(BlankNodeOrIRI)} to
+ * retrieve the corresponding {@link Graph}, however callers should be aware
+ * of any concurrent modifications to the Dataset may cause such calls to
+ * return {@link Optional#empty()}.
+ * <p>
+ * Note that a Dataset always contains a <strong>default graph</strong>
+ * which is not named, and thus is not represented in the returned Stream.
+ * The default graph is accessible via {@link #getGraph()} or by using
+ * {@link Optional#empty()} in the Quad access methods).
+ *
+ * @return A {@link Stream} of the graph names of this Dataset.
+ */
+ Stream<BlankNodeOrIRI> getGraphNames();
- /**
- * Number of quads contained by the dataset.
- * <p>
- * The count of a set does not include duplicates, consistent with the
- * {@link Quad#equals(Object)} equals method for each {@link Quad}.
- *
- * @return The number of quads in the dataset
- */
- long size();
+ /**
+ * Remove a concrete quad from the dataset.
+ *
+ * @param quad
+ * quad to remove
+ */
+ void remove(Quad quad);
- /**
- * Get all quads contained by the dataset.<br>
- * <p>
- * The iteration does not contain any duplicate quads, as determined by the
- * {@link Quad#equals(Object)} method for each {@link Quad}.
- * <p>
- * The behaviour of the {@link Stream} is not specified if
- * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called
- * on the {@link Dataset} before it terminates.
- * <p>
- * Implementations may throw {@link ConcurrentModificationException} from
- * Stream methods if they detect a conflict while the Stream is active.
- *
- * @return A {@link Stream} over all of the quads in the dataset
- */
- Stream<? extends Quad> stream();
+ /**
+ * Remove a concrete pattern of quads from the default graph of the dataset.
+ *
+ * @param graphName
+ * The graph the quad belongs to, wrapped as an {@link Optional}
+ * (<code>null</code> is a wildcard, {@link Optional#empty()} is
+ * the default graph)
+ * @param subject
+ * The quad subject (<code>null</code> is a wildcard)
+ * @param predicate
+ * The quad predicate (<code>null</code> is a wildcard)
+ * @param object
+ * The quad object (<code>null</code> is a wildcard)
+ */
+ void remove(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
- /**
- * Get all quads contained by the dataset matched with the pattern.
- * <p>
- * The iteration does not contain any duplicate quads, as determined by the
- * {@link Quad#equals(Object)} method for each {@link Quad}.
- * <p>
- * The behaviour of the {@link Stream} is not specified if
- * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called
- * on the {@link Dataset} before it terminates.
- * <p>
- * Implementations may throw {@link ConcurrentModificationException} from
- * Stream methods if they detect a conflict while the Stream is active.
- *
- * @param graphName
- * The graph the quad belongs to, wrapped as an {@link Optional}
- * (<code>null</code> is a wildcard, {@link Optional#empty()} is
- * the default graph)
- * @param subject
- * The quad subject (<code>null</code> is a wildcard)
- * @param predicate
- * The quad predicate (<code>null</code> is a wildcard)
- * @param object
- * The quad object (<code>null</code> is a wildcard)
- * @return A {@link Stream} over the matched quads.
- */
- Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object);
+ /**
+ * Clear the dataset, removing all quads.
+ */
+ void clear();
- /**
- * Get an Iterable for iterating over all quads in the dataset.
- * <p>
- * This method is meant to be used with a Java for-each loop, e.g.:
- *
- * <pre>
- * for (Quad t : dataset.iterate()) {
- * System.out.println(t);
- * }
- * </pre>
- *
- * The behaviour of the iterator is not specified if {@link #add(Quad)},
- * {@link #remove(Quad)} or {@link #clear()}, are called on the
- * {@link Dataset} before it terminates. It is undefined if the returned
- * {@link Iterator} supports the {@link Iterator#remove()} method.
- * <p>
- * Implementations may throw {@link ConcurrentModificationException} from
- * Iterator methods if they detect a concurrency conflict while the Iterator
- * is active.
- * <p>
- * The {@link Iterable#iterator()} must only be called once, that is the
- * Iterable must only be iterated over once. A {@link IllegalStateException}
- * may be thrown on attempt to reuse the Iterable.
- *
- * @return A {@link Iterable} that returns {@link Iterator} over all of the
- * quads in the dataset
- * @throws IllegalStateException
- * if the {@link Iterable} has been reused
- * @throws ConcurrentModificationException
- * if a concurrency conflict occurs while the Iterator is
- * active.
- */
- @SuppressWarnings("unchecked")
- default Iterable<Quad> iterate() throws ConcurrentModificationException, IllegalStateException {
- return ((Stream<Quad>) stream())::iterator;
- }
+ /**
+ * Number of quads contained by the dataset.
+ * <p>
+ * The count of a set does not include duplicates, consistent with the
+ * {@link Quad#equals(Object)} equals method for each {@link Quad}.
+ *
+ * @return The number of quads in the dataset
+ */
+ long size();
- /**
- * Get an Iterable for iterating over the quads in the dataset that match
- * the pattern.
- * <p>
- * This method is meant to be used with a Java for-each loop, e.g.:
- *
- * <pre>
- * IRI alice = factory.createIRI("http://example.com/alice");
- * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
- * for (Quad t : dataset.iterate(null, alice, knows, null)) {
- * System.out.println(t.getGraphName());
- * System.out.println(t.getObject());
- * }
- * </pre>
- * <p>
- * The behaviour of the iterator is not specified if {@link #add(Quad)},
- * {@link #remove(Quad)} or {@link #clear()}, are called on the
- * {@link Dataset} before it terminates. It is undefined if the returned
- * {@link Iterator} supports the {@link Iterator#remove()} method.
- * <p>
- * Implementations may throw {@link ConcurrentModificationException} from
- * Iterator methods if they detect a concurrency conflict while the Iterator
- * is active.
- * <p>
- * The {@link Iterable#iterator()} must only be called once, that is the
- * Iterable must only be iterated over once. A {@link IllegalStateException}
- * may be thrown on attempt to reuse the Iterable.
- *
- * @param graphName
- * The graph the quad belongs to, wrapped as an {@link Optional}
- * (<code>null</code> is a wildcard, {@link Optional#empty()} is
- * the default graph)
- * @param subject
- * The quad subject (<code>null</code> is a wildcard)
- * @param predicate
- * The quad predicate (<code>null</code> is a wildcard)
- * @param object
- * The quad object (<code>null</code> is a wildcard)
- * @return A {@link Iterable} that returns {@link Iterator} over the
- * matching quads in the dataset
- * @throws IllegalStateException
- * if the {@link Iterable} has been reused
- * @throws ConcurrentModificationException
- * if a concurrency conflict occurs while the Iterator is
- * active.
- */
- @SuppressWarnings("unchecked")
- default Iterable<Quad> iterate(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object) throws ConcurrentModificationException, IllegalStateException {
- return ((Stream<Quad>) stream(graphName, subject, predicate, object))::iterator;
- }
+ /**
+ * Get all quads contained by the dataset.<br>
+ * <p>
+ * The iteration does not contain any duplicate quads, as determined by the
+ * {@link Quad#equals(Object)} method for each {@link Quad}.
+ * <p>
+ * The behaviour of the {@link Stream} is not specified if
+ * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called
+ * on the {@link Dataset} before it terminates.
+ * <p>
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Stream methods if they detect a conflict while the Stream is active.
+ *
+ * @return A {@link Stream} over all of the quads in the dataset
+ */
+ Stream<? extends Quad> stream();
+
+ /**
+ * Get all quads contained by the dataset matched with the pattern.
+ * <p>
+ * The iteration does not contain any duplicate quads, as determined by the
+ * {@link Quad#equals(Object)} method for each {@link Quad}.
+ * <p>
+ * The behaviour of the {@link Stream} is not specified if
+ * {@link #add(Quad)}, {@link #remove(Quad)} or {@link #clear()} are called
+ * on the {@link Dataset} before it terminates.
+ * <p>
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Stream methods if they detect a conflict while the Stream is active.
+ *
+ * @param graphName
+ * The graph the quad belongs to, wrapped as an {@link Optional}
+ * (<code>null</code> is a wildcard, {@link Optional#empty()} is
+ * the default graph)
+ * @param subject
+ * The quad subject (<code>null</code> is a wildcard)
+ * @param predicate
+ * The quad predicate (<code>null</code> is a wildcard)
+ * @param object
+ * The quad object (<code>null</code> is a wildcard)
+ * @return A {@link Stream} over the matched quads.
+ */
+ Stream<? extends Quad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,
+ RDFTerm object);
+
+ /**
+ * Get an Iterable for iterating over all quads in the dataset.
+ * <p>
+ * This method is meant to be used with a Java for-each loop, e.g.:
+ *
+ * <pre>
+ * for (Quad t : dataset.iterate()) {
+ * System.out.println(t);
+ * }
+ * </pre>
+ *
+ * The behaviour of the iterator is not specified if {@link #add(Quad)},
+ * {@link #remove(Quad)} or {@link #clear()}, are called on the
+ * {@link Dataset} before it terminates. It is undefined if the returned
+ * {@link Iterator} supports the {@link Iterator#remove()} method.
+ * <p>
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Iterator methods if they detect a concurrency conflict while the Iterator
+ * is active.
+ * <p>
+ * The {@link Iterable#iterator()} must only be called once, that is the
+ * Iterable must only be iterated over once. A {@link IllegalStateException}
+ * may be thrown on attempt to reuse the Iterable.
+ *
+ * @return A {@link Iterable} that returns {@link Iterator} over all of the
+ * quads in the dataset
+ * @throws IllegalStateException
+ * if the {@link Iterable} has been reused
+ * @throws ConcurrentModificationException
+ * if a concurrency conflict occurs while the Iterator is
+ * active.
+ */
+ @SuppressWarnings("unchecked")
+ default Iterable<Quad> iterate() throws ConcurrentModificationException, IllegalStateException {
+ return ((Stream<Quad>) stream())::iterator;
+ }
+
+ /**
+ * Get an Iterable for iterating over the quads in the dataset that match
+ * the pattern.
+ * <p>
+ * This method is meant to be used with a Java for-each loop, e.g.:
+ *
+ * <pre>
+ * IRI alice = factory.createIRI("http://example.com/alice");
+ * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
+ * for (Quad t : dataset.iterate(null, alice, knows, null)) {
+ * System.out.println(t.getGraphName());
+ * System.out.println(t.getObject());
+ * }
+ * </pre>
+ * <p>
+ * The behaviour of the iterator is not specified if {@link #add(Quad)},
+ * {@link #remove(Quad)} or {@link #clear()}, are called on the
+ * {@link Dataset} before it terminates. It is undefined if the returned
+ * {@link Iterator} supports the {@link Iterator#remove()} method.
+ * <p>
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Iterator methods if they detect a concurrency conflict while the Iterator
+ * is active.
+ * <p>
+ * The {@link Iterable#iterator()} must only be called once, that is the
+ * Iterable must only be iterated over once. A {@link IllegalStateException}
+ * may be thrown on attempt to reuse the Iterable.
+ *
+ * @param graphName
+ * The graph the quad belongs to, wrapped as an {@link Optional}
+ * (<code>null</code> is a wildcard, {@link Optional#empty()} is
+ * the default graph)
+ * @param subject
+ * The quad subject (<code>null</code> is a wildcard)
+ * @param predicate
+ * The quad predicate (<code>null</code> is a wildcard)
+ * @param object
+ * The quad object (<code>null</code> is a wildcard)
+ * @return A {@link Iterable} that returns {@link Iterator} over the
+ * matching quads in the dataset
+ * @throws IllegalStateException
+ * if the {@link Iterable} has been reused
+ * @throws ConcurrentModificationException
+ * if a concurrency conflict occurs while the Iterator is
+ * active.
+ */
+ @SuppressWarnings("unchecked")
+ default Iterable<Quad> iterate(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate,
+ RDFTerm object) throws ConcurrentModificationException, IllegalStateException {
+ return ((Stream<Quad>) stream(graphName, subject, predicate, object))::iterator;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Graph.java b/api/src/main/java/org/apache/commons/rdf/api/Graph.java
index 4e0ed4c..bd6d175 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Graph.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Graph.java
@@ -23,19 +23,20 @@ import java.util.stream.Stream;
/**
* An <a href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph"> RDF 1.1
- * Graph</a>, a set of RDF triples, as defined by <a
- * href="http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1 Concepts and Abstract
+ * Graph</a>, a set of RDF triples, as defined by
+ * <a href="http://www.w3.org/TR/rdf11-concepts/" >RDF-1.1 Concepts and Abstract
* Syntax</a>, a W3C Recommendation published on 25 February 2014.
*
* @see RDF#createGraph()
*/
-public interface Graph extends AutoCloseable,GraphLike<Triple> {
+public interface Graph extends AutoCloseable, GraphLike<Triple> {
/**
* Add a triple to the graph, possibly mapping any of the components of the
* Triple to those supported by this Graph.
*
- * @param triple The triple to add
+ * @param triple
+ * The triple to add
*/
void add(Triple triple);
@@ -43,16 +44,20 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
* Add a triple to the graph, possibly mapping any of the components to
* those supported by this Graph.
*
- * @param subject The triple subject
- * @param predicate The triple predicate
- * @param object The triple object
+ * @param subject
+ * The triple subject
+ * @param predicate
+ * The triple predicate
+ * @param object
+ * The triple object
*/
void add(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
/**
* Check if graph contains triple.
*
- * @param triple The triple to check.
+ * @param triple
+ * The triple to check.
* @return True if the Graph contains the given Triple.
*/
boolean contains(Triple triple);
@@ -60,11 +65,14 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
/**
* Check if graph contains a pattern of triples.
*
- * @param subject The triple subject (null is a wildcard)
- * @param predicate The triple predicate (null is a wildcard)
- * @param object The triple object (null is a wildcard)
+ * @param subject
+ * The triple subject (null is a wildcard)
+ * @param predicate
+ * The triple predicate (null is a wildcard)
+ * @param object
+ * The triple object (null is a wildcard)
* @return True if the Graph contains any Triples that match the given
- * pattern.
+ * pattern.
*/
boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
@@ -87,16 +95,20 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
/**
* Remove a concrete triple from the graph.
*
- * @param triple triple to remove
+ * @param triple
+ * triple to remove
*/
void remove(Triple triple);
/**
* Remove a concrete pattern of triples from the graph.
*
- * @param subject The triple subject (null is a wildcard)
- * @param predicate The triple predicate (null is a wildcard)
- * @param object The triple object (null is a wildcard)
+ * @param subject
+ * The triple subject (null is a wildcard)
+ * @param predicate
+ * The triple predicate (null is a wildcard)
+ * @param object
+ * The triple object (null is a wildcard)
*/
void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
@@ -121,76 +133,82 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
* The iteration does not contain any duplicate triples, as determined by
* the {@link Triple#equals(Object)} method for each {@link Triple}.
* <p>
- * The behaviour of the {@link Stream} is not specified if {@link #add(Triple)},
- * {@link #remove(Triple)} or {@link #clear()} are called on the
- * {@link Graph} before it terminates.
+ * The behaviour of the {@link Stream} is not specified if
+ * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()} are
+ * called on the {@link Graph} before it terminates.
* <p>
- * Implementations may throw {@link ConcurrentModificationException} from Stream
- * methods if they detect a conflict while the Stream is active.
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Stream methods if they detect a conflict while the Stream is active.
*
* @since 0.3.0-incubating
* @return A {@link Stream} over all of the triples in the graph
*/
Stream<? extends Triple> stream();
-
+
/**
* Get all triples contained by the graph matched with the pattern.
* <p>
* The iteration does not contain any duplicate triples, as determined by
* the {@link Triple#equals(Object)} method for each {@link Triple}.
* <p>
- * The behaviour of the {@link Stream} is not specified if {@link #add(Triple)},
- * {@link #remove(Triple)} or {@link #clear()} are called on the
- * {@link Graph} before it terminates.
+ * The behaviour of the {@link Stream} is not specified if
+ * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()} are
+ * called on the {@link Graph} before it terminates.
* <p>
- * Implementations may throw {@link ConcurrentModificationException} from Stream
- * methods if they detect a conflict while the Stream is active.
+ * Implementations may throw {@link ConcurrentModificationException} from
+ * Stream methods if they detect a conflict while the Stream is active.
* <p>
*
* @since 0.3.0-incubating
- * @param subject The triple subject (null is a wildcard)
- * @param predicate The triple predicate (null is a wildcard)
- * @param object The triple object (null is a wildcard)
+ * @param subject
+ * The triple subject (null is a wildcard)
+ * @param predicate
+ * The triple predicate (null is a wildcard)
+ * @param object
+ * The triple object (null is a wildcard)
* @return A {@link Stream} over the matched triples.
*/
- Stream<? extends Triple> stream(BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object);
+ Stream<? extends Triple> stream(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
/**
- * This method is deprecated, use the equivalent method
- * {@link #stream()} instead.
+ * This method is deprecated, use the equivalent method {@link #stream()}
+ * instead.
*
* @return A {@link Stream} over all triples.
*/
@Deprecated
default Stream<? extends Triple> getTriples() {
- return stream();
+ return stream();
}
/**
- * This method is deprecated, use the equivalent method
+ * This method is deprecated, use the equivalent method
* {@link #stream(BlankNodeOrIRI, IRI, RDFTerm)} instead.
*
- * @param subject The triple subject (null is a wildcard)
- * @param predicate The triple predicate (null is a wildcard)
- * @param object The triple object (null is a wildcard)
+ * @param subject
+ * The triple subject (null is a wildcard)
+ * @param predicate
+ * The triple predicate (null is a wildcard)
+ * @param object
+ * The triple object (null is a wildcard)
* @return A {@link Stream} over the matched triples.
*/
- @Deprecated
- default Stream<? extends Triple> getTriples(BlankNodeOrIRI subject, IRI predicate,
- RDFTerm object) {
- return stream(subject, predicate, object);
+ @Deprecated
+ default Stream<? extends Triple> getTriples(BlankNodeOrIRI subject, IRI predicate, RDFTerm object) {
+ return stream(subject, predicate, object);
}
-
+
/**
* Get an Iterable for iterating over all triples in the graph.
* <p>
* This method is meant to be used with a Java for-each loop, e.g.:
+ *
* <pre>
- * for (Triple t : graph.iterate()) {
- * System.out.println(t);
- * }
+ * for (Triple t : graph.iterate()) {
+ * System.out.println(t);
+ * }
* </pre>
+ *
* The behaviour of the iterator is not specified if {@link #add(Triple)},
* {@link #remove(Triple)} or {@link #clear()}, are called on the
* {@link Graph} before it terminates. It is undefined if the returned
@@ -213,9 +231,8 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
* active.
*/
@SuppressWarnings("unchecked")
- default Iterable<Triple> iterate()
- throws ConcurrentModificationException, IllegalStateException {
- return ((Stream<Triple>)stream())::iterator;
+ default Iterable<Triple> iterate() throws ConcurrentModificationException, IllegalStateException {
+ return ((Stream<Triple>) stream())::iterator;
}
/**
@@ -223,18 +240,19 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
* the pattern.
* <p>
* This method is meant to be used with a Java for-each loop, e.g.:
+ *
* <pre>
- * IRI alice = factory.createIRI("http://example.com/alice");
- * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
- * for (Triple t : graph.iterate(alice, knows, null)) {
- * System.out.println(t.getObject());
- * }
+ * IRI alice = factory.createIRI("http://example.com/alice");
+ * IRI knows = factory.createIRI("http://xmlns.com/foaf/0.1/");
+ * for (Triple t : graph.iterate(alice, knows, null)) {
+ * System.out.println(t.getObject());
+ * }
* </pre>
* <p>
- * The behaviour of the iterator is not specified if
- * {@link #add(Triple)}, {@link #remove(Triple)} or {@link #clear()}, are
- * called on the {@link Graph} before it terminates. It is undefined if the
- * returned {@link Iterator} supports the {@link Iterator#remove()} method.
+ * The behaviour of the iterator is not specified if {@link #add(Triple)},
+ * {@link #remove(Triple)} or {@link #clear()}, are called on the
+ * {@link Graph} before it terminates. It is undefined if the returned
+ * {@link Iterator} supports the {@link Iterator#remove()} method.
* <p>
* Implementations may throw {@link ConcurrentModificationException} from
* Iterator methods if they detect a concurrency conflict while the Iterator
@@ -259,9 +277,8 @@ public interface Graph extends AutoCloseable,GraphLike<Triple> {
* active.
*/
@SuppressWarnings("unchecked")
- default Iterable<Triple> iterate(
- BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
- throws ConcurrentModificationException, IllegalStateException {
+ default Iterable<Triple> iterate(BlankNodeOrIRI subject, IRI predicate, RDFTerm object)
+ throws ConcurrentModificationException, IllegalStateException {
return ((Stream<Triple>) stream(subject, predicate, object))::iterator;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java b/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
index 0f73c4e..e971801 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
@@ -39,7 +39,7 @@ import java.util.stream.Stream;
* @param <T>
* A {@link TripleLike} type used by the graph methods, typically
* {@link Triple} or {@link Quad}
- *
+ *
* @since 0.3.0-incubating
* @see Graph
* @see Dataset
@@ -47,60 +47,60 @@ import java.util.stream.Stream;
*/
public interface GraphLike<T extends TripleLike> {
- /**
- * Add a statement.
- *
- * @param statement
- * The TripleLike statement to add
- */
- void add(T statement);
+ /**
+ * Add a statement.
+ *
+ * @param statement
+ * The TripleLike statement to add
+ */
+ void add(T statement);
- /**
- * Check if statement is contained.
- *
- * @param statement
- * The {@link TripleLike} statement to check
- * @return True if the statement is contained
- */
- boolean contains(T statement);
+ /**
+ * Check if statement is contained.
+ *
+ * @param statement
+ * The {@link TripleLike} statement to check
+ * @return True if the statement is contained
+ */
+ boolean contains(T statement);
- /**
- * Add a statement.
- *
- * @param statement
- * The TripleLike statement to add
- */
- void remove(T statement);
+ /**
+ * Add a statement.
+ *
+ * @param statement
+ * The TripleLike statement to add
+ */
+ void remove(T statement);
- /**
- * Remove all statements.
- */
- void clear();
+ /**
+ * Remove all statements.
+ */
+ void clear();
- /**
- * Number of statements.
- *
- * @return Number of statements
- */
- long size();
+ /**
+ * Number of statements.
+ *
+ * @return Number of statements
+ */
+ long size();
- /**
- * Return a Stream of contained statements.
- *
- * @return A {@link Stream} of {@link TripleLike} statements.
- */
- Stream<? extends T> stream();
+ /**
+ * Return a Stream of contained statements.
+ *
+ * @return A {@link Stream} of {@link TripleLike} statements.
+ */
+ Stream<? extends T> stream();
- /**
- * Iterate over contained statements.
- *
- * @return An {@link Iterable} of {@link TripleLike} statements.
- * @throws IllegalStateException
- * if the {@link Iterable} has been reused
- * @throws ConcurrentModificationException
- * if a concurrency conflict occurs while the Iterator is
- * active.
- */
- Iterable<T> iterate() throws ConcurrentModificationException, IllegalStateException;
+ /**
+ * Iterate over contained statements.
+ *
+ * @return An {@link Iterable} of {@link TripleLike} statements.
+ * @throws IllegalStateException
+ * if the {@link Iterable} has been reused
+ * @throws ConcurrentModificationException
+ * if a concurrency conflict occurs while the Iterator is
+ * active.
+ */
+ Iterable<T> iterate() throws ConcurrentModificationException, IllegalStateException;
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/IRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/IRI.java b/api/src/main/java/org/apache/commons/rdf/api/IRI.java
index 152bffd..1398582 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/IRI.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/IRI.java
@@ -38,20 +38,21 @@ public interface IRI extends BlankNodeOrIRI {
String getIRIString();
/**
- * Check it this IRI is equal to another IRI. <blockquote> <a
- * href="http://www.w3.org/TR/rdf11-concepts/#section-IRIs">IRI
+ * Check it this IRI is equal to another IRI. <blockquote>
+ * <a href="http://www.w3.org/TR/rdf11-concepts/#section-IRIs">IRI
* equality</a>: Two IRIs are equal if and only if they are equivalent under
* Simple String Comparison according to section 5.1 of [RFC3987]. Further
* normalization MUST NOT be performed when comparing IRIs for equality.
* </blockquote>
*
- * Two IRI instances are equal if and only if their
- * {@link #getIRIString()} are equal.
+ * Two IRI instances are equal if and only if their {@link #getIRIString()}
+ * are equal.
*
* Implementations MUST also override {@link #hashCode()} so that two equal
* IRIs produce the same hash code.
*
- * @param other Another object
+ * @param other
+ * Another object
* @return true if other is an IRI and is equal to this
* @see Object#equals(Object)
*/
@@ -61,13 +62,12 @@ public interface IRI extends BlankNodeOrIRI {
/**
* Calculate a hash code for this IRI.
* <p>
- * The returned hash code MUST be equal to the
- * {@link String#hashCode()} of the
- * {@link #getIRIString()}.
+ * The returned hash code MUST be equal to the {@link String#hashCode()} of
+ * the {@link #getIRIString()}.
* <p>
* This method MUST be implemented in conjunction with
- * {@link #equals(Object)}
- * so that two equal IRIs produce the same hash code.
+ * {@link #equals(Object)} so that two equal IRIs produce the same hash
+ * code.
*
* @return a hash code value for this IRI.
* @see Object#hashCode()
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Literal.java b/api/src/main/java/org/apache/commons/rdf/api/Literal.java
index 4e3c003..a434a73 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Literal.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Literal.java
@@ -22,10 +22,10 @@ import java.util.Objects;
import java.util.Optional;
/**
- * A RDF-1.1 Literal, as defined by <a href=
- * "http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal" >RDF-1.1
- * Concepts and Abstract Syntax</a>, a W3C Recommendation published on 25
- * February 2014
+ * A RDF-1.1 Literal, as defined by
+ * <a href= "http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal"
+ * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation published on
+ * 25 February 2014
*
* @see RDF#createLiteral(String)
* @see RDF#createLiteral(String, IRI)
@@ -34,13 +34,13 @@ import java.util.Optional;
public interface Literal extends RDFTerm {
/**
- * The lexical form of this literal, represented by a <a
- * href="http://www.unicode.org/versions/latest/">Unicode string</a>.
+ * The lexical form of this literal, represented by a
+ * <a href="http://www.unicode.org/versions/latest/">Unicode string</a>.
*
* @return The lexical form of this literal.
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
- * Literal lexical form</a>
+ * @see <a href=
+ * "http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-form">RDF-1.1
+ * Literal lexical form</a>
*/
String getLexicalForm();
@@ -48,28 +48,28 @@ public interface Literal extends RDFTerm {
* The IRI identifying the datatype that determines how the lexical form
* maps to a literal value.
*
- * If the datatype IRI is <a
- * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+ * If the datatype IRI is
+ * <a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
* >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>,
* {@link #getLanguageTag()} must not return {@link Optional#empty()}, and
- * it must return a valid <a
- * href="http://tools.ietf.org/html/bcp47">BCP47</a> language tag.
+ * it must return a valid
+ * <a href="http://tools.ietf.org/html/bcp47">BCP47</a> language tag.
*
* @return The datatype IRI for this literal.
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
- * Literal datatype IRI</a>
+ * @see <a href=
+ * "http://www.w3.org/TR/rdf11-concepts/#dfn-datatype-iri">RDF-1.1
+ * Literal datatype IRI</a>
*/
IRI getDatatype();
/**
- * If and only if the datatype IRI is <a
- * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+ * If and only if the datatype IRI is
+ * <a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
* >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, the language
- * tag for this Literal is a non-empty language tag as defined by <a
- * href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
- * If the datatype IRI is not <a
- * href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
+ * tag for this Literal is a non-empty language tag as defined by
+ * <a href="http://tools.ietf.org/html/bcp47">BCP47</a>.<br>
+ * If the datatype IRI is not
+ * <a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"
* >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
* must return {@link Optional#empty()}.
*
@@ -79,20 +79,20 @@ public interface Literal extends RDFTerm {
* return value for this method.
*
* @return The {@link Optional} language tag for this literal. If
- * {@link Optional#isPresent()} returns true, the value returned by
- * {@link Optional#get()} must be a non-empty string conforming to
- * BCP47.
- * @see <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
- * Literal language tag</a>
+ * {@link Optional#isPresent()} returns true, the value returned by
+ * {@link Optional#get()} must be a non-empty string conforming to
+ * BCP47.
+ * @see <a href=
+ * "http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">RDF-1.1
+ * Literal language tag</a>
*/
Optional<String> getLanguageTag();
/**
- * Check it this Literal is equal to another Literal. <blockquote> <a
- * href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal-term">Literal term
- * equality</a>: Two literals are term-equal (the same RDF literal) if and
- * only if the two lexical forms, the two datatype IRIs, and the two
+ * Check it this Literal is equal to another Literal. <blockquote>
+ * <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-literal-term">Literal
+ * term equality</a>: Two literals are term-equal (the same RDF literal) if
+ * and only if the two lexical forms, the two datatype IRIs, and the two
* language tags (if any) compare equal, character by character. Thus, two
* literals can have the same value without being the same RDF term.
* </blockquote>
@@ -100,7 +100,8 @@ public interface Literal extends RDFTerm {
* Implementations MUST also override {@link #hashCode()} so that two equal
* Literals produce the same hash code.
*
- * @param other Another object
+ * @param other
+ * Another object
* @return true if other is a Literal and is equal to this
* @see Object#equals(Object)
*/
@@ -110,13 +111,14 @@ public interface Literal extends RDFTerm {
/**
* Calculate a hash code for this Literal.
* <p>
- * The returned hash code MUST be equal to the result
- * of {@link Objects#hash(Object...)} with
- * the arguments
- * {@link #getLexicalForm()}, {@link #getDatatype()}, {@link #getLanguageTag()}.
+ * The returned hash code MUST be equal to the result of
+ * {@link Objects#hash(Object...)} with the arguments
+ * {@link #getLexicalForm()}, {@link #getDatatype()},
+ * {@link #getLanguageTag()}.
* <p>
- * This method MUST be implemented in conjunction with {@link #equals(Object)}
- * so that two equal Literals produce the same hash code.
+ * This method MUST be implemented in conjunction with
+ * {@link #equals(Object)} so that two equal Literals produce the same hash
+ * code.
*
* @return a hash code value for this Literal.
* @see Object#hashCode()
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/Quad.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/Quad.java b/api/src/main/java/org/apache/commons/rdf/api/Quad.java
index ba89823..3b286cb 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/Quad.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/Quad.java
@@ -37,177 +37,177 @@ import java.util.Optional;
*/
public interface Quad extends QuadLike<BlankNodeOrIRI> {
- /**
- * The graph name (graph label) of this quad, if present.
- *
- * If {@link Optional#isPresent()}, then the {@link Optional#get()} is
- * either a {@link BlankNode} or an {@link IRI}, indicating the
- * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-named-graph">graph
- * name</a> of this Quad. If the graph name is not present, e.g. the value is
- * {@link Optional#empty()}, it indicates that this Quad is in the
- * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph">default
- * graph</a>.
- *
- * @return If {@link Optional#isPresent()}, the graph name
- * {@link BlankNodeOrIRI} of this quad, otherwise
- * {@link Optional#empty()}, indicating the default graph.
- *
- * @see <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset">RDF-
- * 1.1 Dataset</a>
- */
- Optional<BlankNodeOrIRI> getGraphName();
+ /**
+ * The graph name (graph label) of this quad, if present.
+ *
+ * If {@link Optional#isPresent()}, then the {@link Optional#get()} is
+ * either a {@link BlankNode} or an {@link IRI}, indicating the
+ * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-named-graph">graph
+ * name</a> of this Quad. If the graph name is not present, e.g. the value
+ * is {@link Optional#empty()}, it indicates that this Quad is in the
+ * <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-default-graph">default
+ * graph</a>.
+ *
+ * @return If {@link Optional#isPresent()}, the graph name
+ * {@link BlankNodeOrIRI} of this quad, otherwise
+ * {@link Optional#empty()}, indicating the default graph.
+ *
+ * @see <a href="https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset">RDF-
+ * 1.1 Dataset</a>
+ */
+ Optional<BlankNodeOrIRI> getGraphName();
- /**
- * The subject of this quad, which may be either a {@link BlankNode} or an
- * {@link IRI}, which are represented in Commons RDF by the interface
- * {@link BlankNodeOrIRI}.
- *
- * @return The subject {@link BlankNodeOrIRI} of this quad.
- * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-subject">RDF-1.1
- * Triple subject</a>
- */
- BlankNodeOrIRI getSubject();
+ /**
+ * The subject of this quad, which may be either a {@link BlankNode} or an
+ * {@link IRI}, which are represented in Commons RDF by the interface
+ * {@link BlankNodeOrIRI}.
+ *
+ * @return The subject {@link BlankNodeOrIRI} of this quad.
+ * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-subject">RDF-1.1
+ * Triple subject</a>
+ */
+ BlankNodeOrIRI getSubject();
- /**
- * The predicate {@link IRI} of this quad.
- *
- * @return The predicate {@link IRI} of this quad.
- * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">RDF-1.1
- * Triple predicate</a>
- */
- IRI getPredicate();
+ /**
+ * The predicate {@link IRI} of this quad.
+ *
+ * @return The predicate {@link IRI} of this quad.
+ * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">RDF-1.1
+ * Triple predicate</a>
+ */
+ IRI getPredicate();
- /**
- * The object of this quad, which may be either a {@link BlankNode}, an
- * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF
- * by the interface {@link RDFTerm}.
- *
- * @return The object {@link RDFTerm} of this quad.
- * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">RDF-1.1
- * Triple object</a>
- */
- RDFTerm getObject();
+ /**
+ * The object of this quad, which may be either a {@link BlankNode}, an
+ * {@link IRI}, or a {@link Literal}, which are represented in Commons RDF
+ * by the interface {@link RDFTerm}.
+ *
+ * @return The object {@link RDFTerm} of this quad.
+ * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">RDF-1.1
+ * Triple object</a>
+ */
+ RDFTerm getObject();
- /**
- * Adapt this Quad to a Triple.
- * <p>
- * The returned {@link Triple} will have equivalent values returned from the
- * methods {@link TripleLike#getSubject()},
- * {@link TripleLike#getPredicate()} and {@link TripleLike#getObject()}.
- * <p>
- * The returned {@link Triple} MUST NOT be {@link #equals(Object)} to this
- * {@link Quad}, even if this quad has a default graph
- * {@link #getGraphName()} value of {@link Optional#empty()}, but MUST
- * follow the {@link Triple#equals(Object)} semantics. This means that the
- * following MUST be true:
+ /**
+ * Adapt this Quad to a Triple.
+ * <p>
+ * The returned {@link Triple} will have equivalent values returned from the
+ * methods {@link TripleLike#getSubject()},
+ * {@link TripleLike#getPredicate()} and {@link TripleLike#getObject()}.
+ * <p>
+ * The returned {@link Triple} MUST NOT be {@link #equals(Object)} to this
+ * {@link Quad}, even if this quad has a default graph
+ * {@link #getGraphName()} value of {@link Optional#empty()}, but MUST
+ * follow the {@link Triple#equals(Object)} semantics. This means that the
+ * following MUST be true:
+ *
+ * <pre>
+ * Quad q1, q2;
+ * if (q1.equals(q2)) {
+ * assert (q1.asTriple().equals(q2.asTriple()));
+ * } else if (q1.asTriple().equals(q2.asTriple())) {
+ * assert (q1.getSubject().equals(q2.getSubject()));
+ * assert (q1.getPredicate().equals(q2.getPredicate()));
+ * assert (q1.getObject().equals(q2.getObject()));
+ * assert (!q1.getGraphName().equals(q2.getGraphName()));
+ * }
+ * </pre>
*
- * <pre>
- * Quad q1, q2;
- * if (q1.equals(q2)) {
- * assert(q1.asTriple().equals(q2.asTriple()));
- * } else if (q1.asTriple().equals(q2.asTriple())) {
- * assert(q1.getSubject().equals(q2.getSubject()));
- * assert(q1.getPredicate().equals(q2.getPredicate()));
- * assert(q1.getObject().equals(q2.getObject()));
- * assert(! q1.getGraphName().equals(q2.getGraphName()));
- * }
- * </pre>
- *
- * The <code>default</code> implementation of this method return a proxy
- * {@link Triple} instance that keeps a reference to this {@link Quad} to
- * call the underlying {@link TripleLike} methods, but supplies a
- * {@link Triple} compatible implementation of {@link Triple#equals(Object)}
- * and {@link Triple#hashCode()}. Implementations may override this method,
- * e.g. for a more efficient solution.
- *
- * @return A {@link Triple} that contains the same {@link TripleLike}
- * properties as this Quad.
- */
- default Triple asTriple() {
- return new Triple() {
- @Override
- public BlankNodeOrIRI getSubject() {
- return Quad.this.getSubject();
- }
+ * The <code>default</code> implementation of this method return a proxy
+ * {@link Triple} instance that keeps a reference to this {@link Quad} to
+ * call the underlying {@link TripleLike} methods, but supplies a
+ * {@link Triple} compatible implementation of {@link Triple#equals(Object)}
+ * and {@link Triple#hashCode()}. Implementations may override this method,
+ * e.g. for a more efficient solution.
+ *
+ * @return A {@link Triple} that contains the same {@link TripleLike}
+ * properties as this Quad.
+ */
+ default Triple asTriple() {
+ return new Triple() {
+ @Override
+ public BlankNodeOrIRI getSubject() {
+ return Quad.this.getSubject();
+ }
- @Override
- public IRI getPredicate() {
- return Quad.this.getPredicate();
- }
+ @Override
+ public IRI getPredicate() {
+ return Quad.this.getPredicate();
+ }
- @Override
- public RDFTerm getObject() {
- return Quad.this.getObject();
- }
+ @Override
+ public RDFTerm getObject() {
+ return Quad.this.getObject();
+ }
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof Triple)) {
- return false;
- }
- Triple other = (Triple) obj;
- return Objects.equals(getSubject(), other.getSubject())
- && Objects.equals(getPredicate(), other.getPredicate())
- && Objects.equals(getObject(), other.getObject());
- }
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof Triple)) {
+ return false;
+ }
+ Triple other = (Triple) obj;
+ return Objects.equals(getSubject(), other.getSubject())
+ && Objects.equals(getPredicate(), other.getPredicate())
+ && Objects.equals(getObject(), other.getObject());
+ }
- @Override
- public int hashCode() {
- return Objects.hash(getSubject(), getPredicate(), getObject());
- }
- };
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(getSubject(), getPredicate(), getObject());
+ }
+ };
+ }
- /**
- * Check it this Quad is equal to another Quad.
- * <p>
- * Two Quads are equal if and only if their {@link #getGraphName()},
- * {@link #getSubject()}, {@link #getPredicate()} and
- * {@link #getObject()} are equal.
- * </p>
- * <p>
- * Implementations MUST also override {@link #hashCode()} so that two equal
- * Quads produce the same hash code.
- * </p>
- * <p>
- * Note that a {@link Quad} MUST NOT be equal to a
- * {@link Triple}, even if this Quad's {@link #getGraphName()}
- * is {@link Optional#empty()}. To test triple-like equivalence,
- * callers can use:
- * </p>
- * <pre>
- * Quad q1;
- * Triple t2;
- * q1.asTriple().equals(t2));
- * </pre>
- *
- * @param other
- * Another object
- * @return true if other is a Quad and is equal to this
- * @see Object#equals(Object)
- */
- @Override
- public boolean equals(Object other);
+ /**
+ * Check it this Quad is equal to another Quad.
+ * <p>
+ * Two Quads are equal if and only if their {@link #getGraphName()},
+ * {@link #getSubject()}, {@link #getPredicate()} and {@link #getObject()}
+ * are equal.
+ * </p>
+ * <p>
+ * Implementations MUST also override {@link #hashCode()} so that two equal
+ * Quads produce the same hash code.
+ * </p>
+ * <p>
+ * Note that a {@link Quad} MUST NOT be equal to a {@link Triple}, even if
+ * this Quad's {@link #getGraphName()} is {@link Optional#empty()}. To test
+ * triple-like equivalence, callers can use:
+ * </p>
+ *
+ * <pre>
+ * Quad q1;
+ * Triple t2;
+ * q1.asTriple().equals(t2));
+ * </pre>
+ *
+ * @param other
+ * Another object
+ * @return true if other is a Quad and is equal to this
+ * @see Object#equals(Object)
+ */
+ @Override
+ public boolean equals(Object other);
- /**
- * Calculate a hash code for this Quad.
- * <p>
- * The returned hash code MUST be equal to the result of
- * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()},
- * {@link #getPredicate()}, {@link #getObject()}, {@link #getGraphName()}.
- * <p>
- * This method MUST be implemented in conjunction with
- * {@link #equals(Object)} so that two equal {@link Quad}s produce the same
- * hash code.
- *
- * @return a hash code value for this Quad.
- * @see Object#hashCode()
- * @see Objects#hash(Object...)
- */
- @Override
- public int hashCode();
+ /**
+ * Calculate a hash code for this Quad.
+ * <p>
+ * The returned hash code MUST be equal to the result of
+ * {@link Objects#hash(Object...)} with the arguments {@link #getSubject()},
+ * {@link #getPredicate()}, {@link #getObject()}, {@link #getGraphName()}.
+ * <p>
+ * This method MUST be implemented in conjunction with
+ * {@link #equals(Object)} so that two equal {@link Quad}s produce the same
+ * hash code.
+ *
+ * @return a hash code value for this Quad.
+ * @see Object#hashCode()
+ * @see Objects#hash(Object...)
+ */
+ @Override
+ public int hashCode();
}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/413dd09a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
index 9eaa5dc..cfe1733 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/QuadLike.java
@@ -25,10 +25,9 @@ import java.util.Optional;
* A QuadLike statement has at least a {@link #getSubject()},
* {@link #getPredicate()}, {@link #getObject()} and {@link #getGraphName()},
* but unlike a {@link Quad} does not have a formalised
- * {@link Quad#equals(Object)}
- * or {@link Quad#hashCode()}
- * semantics. This interface can also be used for <em>generalised quads</em>
- * (e.g. a {@link BlankNode} as predicate).
+ * {@link Quad#equals(Object)} or {@link Quad#hashCode()} semantics. This
+ * interface can also be used for <em>generalised quads</em> (e.g. a
+ * {@link BlankNode} as predicate).
* <p>
* Implementations should specialise which specific {@link RDFTerm} types they
* return by overriding {@link #getSubject()}, {@link #getPredicate()},
@@ -39,19 +38,18 @@ import java.util.Optional;
*/
public interface QuadLike<G extends RDFTerm> extends TripleLike {
- /**
- * The graph name (graph label) of this statement, if present.
- * <p>
- * If {@link Optional#isPresent()}, then the {@link Optional#get()} indicate
- * the graph name of this statement. If the graph name is not present,e.g.
- * the value is {@link Optional#empty()}, it indicates that this Quad is in
- * the default graph.
- *
- * @return If {@link Optional#isPresent()}, the graph name of this quad,
- * otherwise {@link Optional#empty()}, indicating the default
- * graph. The graph name is typically an {@link IRI} or
- * {@link BlankNode}.
- */
- Optional<G> getGraphName();
+ /**
+ * The graph name (graph label) of this statement, if present.
+ * <p>
+ * If {@link Optional#isPresent()}, then the {@link Optional#get()} indicate
+ * the graph name of this statement. If the graph name is not present,e.g.
+ * the value is {@link Optional#empty()}, it indicates that this Quad is in
+ * the default graph.
+ *
+ * @return If {@link Optional#isPresent()}, the graph name of this quad,
+ * otherwise {@link Optional#empty()}, indicating the default graph.
+ * The graph name is typically an {@link IRI} or {@link BlankNode}.
+ */
+ Optional<G> getGraphName();
}