commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wik...@apache.org
Subject [3/7] incubator-commonsrdf git commit: COMMONSRDF-2: refactorized api java packages
Date Fri, 27 Mar 2015 18:44:45 GMT
COMMONSRDF-2: refactorized api java packages


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

Branch: refs/heads/master
Commit: fa5321e4589e4e6a49ddf15d8d0bdf173d84d803
Parents: 4076688
Author: Sergio Fernández <wikier@apache.org>
Authored: Fri Mar 27 19:40:21 2015 +0100
Committer: Sergio Fernández <wikier@apache.org>
Committed: Fri Mar 27 19:40:21 2015 +0100

----------------------------------------------------------------------
 .../com/github/commonsrdf/api/BlankNode.java    | 148 -------
 .../github/commonsrdf/api/BlankNodeOrIRI.java   |  22 -
 .../java/com/github/commonsrdf/api/Graph.java   | 179 ---------
 .../java/com/github/commonsrdf/api/IRI.java     |  74 ----
 .../java/com/github/commonsrdf/api/Literal.java | 108 -----
 .../java/com/github/commonsrdf/api/RDFTerm.java |  36 --
 .../github/commonsrdf/api/RDFTermFactory.java   | 252 ------------
 .../java/com/github/commonsrdf/api/Triple.java  |  97 -----
 .../org/apache/commons/rdf/api/BlankNode.java   | 148 +++++++
 .../apache/commons/rdf/api/BlankNodeOrIRI.java  |  22 +
 .../java/org/apache/commons/rdf/api/Graph.java  | 179 +++++++++
 .../java/org/apache/commons/rdf/api/IRI.java    |  74 ++++
 .../org/apache/commons/rdf/api/Literal.java     | 108 +++++
 .../org/apache/commons/rdf/api/RDFTerm.java     |  36 ++
 .../apache/commons/rdf/api/RDFTermFactory.java  | 252 ++++++++++++
 .../java/org/apache/commons/rdf/api/Triple.java |  97 +++++
 .../commonsrdf/api/AbstractBlankNodeTest.java   | 222 ----------
 .../commonsrdf/api/AbstractGraphTest.java       | 275 -------------
 .../api/AbstractRDFTermFactoryTest.java         | 401 -------------------
 .../api/DefaultRDFTermFactoryTest.java          |  32 --
 .../commons/rdf/api/AbstractBlankNodeTest.java  | 222 ++++++++++
 .../commons/rdf/api/AbstractGraphTest.java      | 275 +++++++++++++
 .../rdf/api/AbstractRDFTermFactoryTest.java     | 401 +++++++++++++++++++
 .../rdf/api/DefaultRDFTermFactoryTest.java      |  30 ++
 24 files changed, 1844 insertions(+), 1846 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/BlankNode.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/BlankNode.java b/api/src/main/java/com/github/commonsrdf/api/BlankNode.java
deleted file mode 100644
index 6ab326e..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/BlankNode.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-/**
- * 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>
- * <p>
- * 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>
- * <p>
- * 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.
- * <p>
- * Implementations that handle blank node identifiers in concrete syntaxes need
- * to be careful not to create the same blank node from multiple occurrences of
- * the same blank node identifier except in situations where this is supported
- * by the syntax.
- * </blockquote>
- *
- * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
- *      Blank Node</a>
- */
-public interface BlankNode extends BlankNodeOrIRI {
-
-	/**
-	 * Return a <a href=
-	 * "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier"
-	 * >label</a> for the blank node. This is not a serialization/syntax label.
-	 * It should be uniquely identifying within the local scope it is created in
-	 * but has no uniqueness guarantees other than that.
-	 * <p>
-	 * In particular, the existence of two objects of type {@link BlankNode}
-	 * with the same value returned from {@link #internalIdentifier()} are not
-	 * equivalent unless they are known to have been created in the same local
-	 * scope (see {@link #equals(Object)})
-	 * <p>
-	 * An example of a local scope may be an instance of a Java Virtual Machine
-	 * (JVM). In the context of a JVM instance, an implementor may support
-	 * insertion and removal of {@link Triple} objects containing Blank Nodes
-	 * without modifying the blank node labels.
-	 * <p>
-	 * Another example of a local scope may be a <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph">Graph</a>
-	 * or <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#section-dataset">Dataset</a>
-	 * created from a single document. In this context, an implementor should
-	 * reasonably guarantee that the label returned by getLabel only maps to
-	 * equivalent blank nodes in the same Graph or Dataset, but they may not
-	 * guarantee that it is unique for the JVM instance. In this case, the
-	 * implementor may support a mechanism to provide a mapping for blank nodes
-	 * between Graph or Dataset instances to guarantee their uniqueness.
-	 * <p>
-	 * If implementors support <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#section-skolemization"
-	 * >Skolemisation</a>, they may map instances of {@link BlankNode} objects
-	 * to {@link IRI} objects to reduce scoping issues.
-	 * <p>
-	 * It is not a requirement for the internal identifier to be a part of the
-	 * {@link #ntriplesString()}, except that two BlankNode instances with the
-	 * same internalIdentifier() and same local scope should have the same
-	 * {@link #ntriplesString()}.
-	 *
-	 * @return An internal, system identifier for the {@link BlankNode}.
-	 */
-	String internalIdentifier();
-
-	/**
-	 * Check it this BlankNode is equal to another BlankNode. <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 locally scoped
-	 * 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. 
-	 * <p>Implementations that handle blank node identifiers in
-	 * concrete syntaxes need to be careful not to create the same blank node
-	 * from multiple occurrences of the same blank node identifier except in
-	 * situations where this is supported by the syntax. 
-	 * </blockquote>
-	 * <p>
-	 * Implementations MUST check the local scope, as two BlankNode in different
-	 * Graphs MUST differ. On the other hand, two BlankNodes found in triples of
-	 * the same Graph instance MUST equal if and only if they have the same
-	 * {@link #internalIdentifier()}.
-	 * </p>
-	 * <p>
-	 * Implementations MUST also override {@link #hashCode()} so that two equal
-	 * Literals produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#equals(Object)
-	 * 
-	 * @param other
-	 *            Another object
-	 * @return true if other is a BlankNode, is in the same local scope and is
-	 *         equal to this BlankNode
-	 */
-	@Override
-	public boolean equals(Object other);
-
-	/**
-	 * Calculate a hash code for this BlankNode.
-	 * <p>
-	 * This method MUST be implemented when implementing {@link #equals(Object)}
-	 * so that two equal BlankNodes produce the same hash code.
-	 * 
-	 * @see Object#hashCode()
-	 * 
-	 * @return a hash code value for this BlankNode.
-	 */
-	@Override
-	public int hashCode();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/BlankNodeOrIRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/BlankNodeOrIRI.java b/api/src/main/java/com/github/commonsrdf/api/BlankNodeOrIRI.java
deleted file mode 100644
index 38d5ef6..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/BlankNodeOrIRI.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-/**
- * This interface represents the {@link RDFTerm}s that may be used in the
- * subject position of an RDF-1.1 {@link Triple}, including {@link BlankNode}
- * and {@link IRI}.
- */
-public interface BlankNodeOrIRI extends RDFTerm {
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/Graph.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/Graph.java b/api/src/main/java/com/github/commonsrdf/api/Graph.java
deleted file mode 100644
index 40f4808..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/Graph.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-import java.util.function.Predicate;
-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
- * Syntax</a>, a W3C Recommendation published on 25 February 2014.
- */
-public interface Graph extends AutoCloseable {
-
-	/**
-	 * Add a triple to the graph.
-	 *
-	 * @param triple
-	 *            The triple to add
-	 */
-	void add(Triple triple);
-
-	/**
-	 * Add a triple to the graph.
-	 *
-	 * @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.
-	 * @return True if the Graph contains the given Triple.
-	 */
-	boolean contains(Triple 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)
-	 * @return True if the Graph contains any Triples that match the given
-	 *         pattern.
-	 */
-	boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
-
-	/**
-	 * Close the graph, relinquishing any underlying resources.
-	 * <p>
-	 * For example, this would close any open file and network streams and free
-	 * database locks held by the Graph implementation.
-	 * <p>
-	 * The behaviour of the other Graph methods are undefined after closing the
-	 * graph.
-	 * <p>
-	 * Implementations might not need {@link #close()}, hence the default
-	 * implementation does nothing.
-	 */
-	@Override
-	default void close() throws Exception {
-	}
-
-	/**
-	 * Remove a concrete triple from the graph.
-	 *
-	 * @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)
-	 */
-	void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
-
-	/**
-	 * Clear the graph, removing all triples.
-	 * 
-	 */
-	void clear();
-
-	/**
-	 * Number of triples contained by the graph.
-	 * <p>
-	 * The count of a set does not include duplicates, as determined by the
-	 * equals method for each {@link Triple}.
-	 * 
-	 * @return The number of triples in the graph
-	 */
-	long size();
-
-	/**
-	 * Get all triples contained by the graph.<br>
-	 * <p>
-	 * The iteration does not contain any duplicate triples, as determined by
-	 * the equals method for each {@link Triple}.
-	 * <p>
-	 * The behaviour of the Stream is not specified if add, remove, or clear,
-	 * are called on the Stream before it terminates.<br>
-	 * <p>
-	 * Implementations may throw ConcurrentModificationException from Stream
-	 * methods if they detect a conflict while the Stream is active.
-	 *
-	 * @return A {@link Stream} over all of the triples in the graph
-	 */
-	Stream<? extends Triple> getTriples();
-
-	/**
-	 * Get all triples contained by the graph matched with the pattern.
-	 * <p>
-	 * The iteration does not contain any duplicate triples, as determined by
-	 * the equals method for each {@link Triple}.
-	 * <p>
-	 * The behaviour of the Stream is not specified if add, remove, or clear,
-	 * are called on the Stream before it terminates.<br>
-	 * <p>
-	 * Implementations may throw ConcurrentModificationException from Stream
-	 * methods if they detect a conflict while the Stream is active.
-	 *
-	 * @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> getTriples(BlankNodeOrIRI subject, IRI predicate,
-			RDFTerm object);
-
-	/**
-	 * Get all triples contained by the graph matched with the pattern.
-	 * <p>
-	 * The iteration does not contain any duplicate triples, as determined by
-	 * the equals method for each {@link Triple}.
-	 * <p>
-	 * The behaviour of the Stream is not specified if add, remove, or clear,
-	 * are called on the Stream before it terminates.<br>
-	 * <p>
-	 * Implementations may throw ConcurrentModificationException from Stream
-	 * methods if they detect a conflict while the Stream is active.
-	 *
-	 * @param filter
-	 *            A filter to match against each triple in the graph.
-	 * @return A {@link Stream} over the matched triples.
-	 */
-	Stream<? extends Triple> getTriples(Predicate<Triple> filter);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/IRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/IRI.java b/api/src/main/java/com/github/commonsrdf/api/IRI.java
deleted file mode 100644
index 421d2a9..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/IRI.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-/**
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-iri" >RDF-1.1 IRI</a>,
- * 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.<br>
- */
-public interface IRI extends BlankNodeOrIRI {
-
-	/**
-	 * Return the IRI encoded as a native Unicode String.<br>
-	 * 
-	 * The returned string must not include URL-encoding to escape non-ASCII
-	 * characters.
-	 * 
-	 * @return The IRI encoded as a native Unicode String.
-	 */
-	String getIRIString();
-
-	/**
-	 * 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>
-	 * <p>
-	 * Two IRIs are equal are in the same local scope and their
-	 * {@link #getIRIString()} are equal.
-	 * </p>
-	 * <p>
-	 * Implementations MAY check the local scope for IRI comparison.
-	 * </p>
-	 * <p>
-	 * Implementations MUST also override {@link #hashCode()} so that two equal
-	 * IRIs produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#equals(Object)
-	 * 
-	 * @param other
-	 *            Another object
-	 * @return true if other is an IRI and is equal to this
-	 */
-	@Override
-	public boolean equals(Object other);
-
-	/**
-	 * Calculate a hash code for this IRI.
-	 * <p>
-	 * This method MUST be implemented when implementing {@link #equals(Object)}
-	 * so that two equal IRIs produce the same hash code.
-	 * 
-	 * @see Object#hashCode()
-	 * 
-	 * @return a hash code value for this IRI.
-	 */
-	@Override
-	public int hashCode();
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/Literal.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/Literal.java b/api/src/main/java/com/github/commonsrdf/api/Literal.java
deleted file mode 100644
index 4982327..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/Literal.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-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
- */
-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>.
-	 *
-	 * @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>
-	 */
-	String getLexicalForm();
-
-	/**
-	 * The IRI identifying the datatype that determines how the lexical form
-	 * maps to a literal value.
-	 *
-	 * @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>
-	 */
-	IRI getDatatype();
-
-	/**
-	 * 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"
-	 * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
-	 * must return {@link Optional#empty()}.
-	 *
-	 * @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>
-	 */
-	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
-	 * language tags (if any) compare equal, character by character. Thus, two
-	 * literals can have the same value without being the same RDF term.
-	 * </blockquote>
-	 * <p>
-	 * Implementations MAY check the local scope for Literal comparison.
-	 * </p>
-	 * <p>
-	 * Implementations MUST also override {@link #hashCode()} so that two equal
-	 * Literals produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#equals(Object)
-	 * 
-	 * @param other
-	 *            Another object
-	 * @return true if other is a Literal and is equal to this
-	 */
-	@Override
-	public boolean equals(Object other);
-
-	/**
-	 * Calculate a hash code for this Literal.
-	 * <p>
-	 * This method MUST be implemented when implementing {@link #equals(Object)}
-	 * so that two equal Literals produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#hashCode()
-	 * 
-	 * @return a hash code value for this Literal.
-	 */
-	@Override
-	public int hashCode();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/RDFTerm.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/RDFTerm.java b/api/src/main/java/com/github/commonsrdf/api/RDFTerm.java
deleted file mode 100644
index 5530e67..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/RDFTerm.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-/**
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>, 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.<br>
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
- * Term</a>
- */
-public interface RDFTerm {
-
-    /**
-     * 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 <a href="http://www.w3.org/TR/n-triples/#canonical-ntriples">
-     *         RDF-1.1 N-Triples Canonical form</a>
-     */
-    String ntriplesString();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/com/github/commonsrdf/api/RDFTermFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/RDFTermFactory.java b/api/src/main/java/com/github/commonsrdf/api/RDFTermFactory.java
deleted file mode 100644
index 90592c6..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/RDFTermFactory.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-import java.util.Locale;
-
-/**
- * Factory for creating RDFTerm and Graph instances.
- * <p>
- * It is not specified how an implementation should provide a RDFTermFactory.
- * <p>
- * If an implementation does not support a particular method (e.g. it requires
- * additional parameters or can't create graphs), then it MAY throw
- * UnsupportedOperationException, as provided by the default implementations
- * here.
- * <p>
- * If a factory method does not allow or support a provided parameter, e.g.
- * because an IRI is considered invalid, then it SHOULD throw
- * IllegalArgumentException.
- * 
- * 
- * @see RDFTerm
- * @see Graph
- * 
- */
-public interface RDFTermFactory {
-
-	/**
-	 * Create a new blank node.
-	 * <p>
-	 * Two BlankNodes created with this method MUST NOT be equal.
-	 * <p>
-	 * If supported, the {@link BlankNode#internalIdentifier()} of the returned
-	 * blank node MUST be an auto-generated value.
-	 * 
-	 * @return A new BlankNode
-	 * @throws UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default BlankNode createBlankNode() throws UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createBlankNode() not supported");
-	}
-
-	/**
-	 * Create a blank node for the given internal identifier.
-	 * <p>
-	 * Two BlankNodes created with the same identifier using this method MUST be
-	 * equal if they are in the same local scope (e.g. in the same Graph). See
-	 * the equals contract for {@link BlankNode} for more information.
-	 * <p>
-	 * If supported, the {@link BlankNode#internalIdentifier()} of the returned
-	 * blank node MAY be equal to the provided identifier.
-	 * 
-	 * @param identifier
-	 *            A non-empty String that is unique to this blank node in this
-	 *            scope, and which may be used as the internal identifier for
-	 *            the blank node.
-	 * @return A BlankNode for the given identifier
-	 * @throws IllegalArgumentException
-	 *             if the identifier is not acceptable, e.g. was empty or
-	 *             contained unsupported characters.
-	 * @throws UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default BlankNode createBlankNode(String identifier)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createBlankNode(String) not supported");
-	}
-
-	/**
-	 * Create a new graph.
-	 * <p>
-	 * It is undefined if the graph will be persisted by any underlying storage
-	 * mechanism.
-	 * 
-	 * @return A new Graph
-	 * @throws UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default Graph createGraph() throws UnsupportedOperationException {
-		throw new UnsupportedOperationException("createGraph() not supported");
-	}
-
-	/**
-	 * Create an IRI from a (possibly escaped) String.
-	 * <p>
-	 * The provided iri string MUST be valid according to the <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-iri">W3C RDF-1.1 IRI</a>
-	 * definition.
-	 * 
-	 * @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 UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default IRI createIRI(String iri) throws IllegalArgumentException,
-			UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createIRI(String) not supported");
-	}
-
-	/**
-	 * Create a simple literal.
-	 * <p>
-	 * 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.
-	 * <p>
-	 * The returned Literal MUST have a {@link Literal#getLexicalForm()} that is
-	 * equal to the provided lexical form, MUST NOT have a
-	 * {@link Literal#getLanguageTag()} present, and SHOULD return a
-	 * {@link Literal#getDatatype()} that is equal to the IRI
-	 * <code>http://www.w3.org/2001/XMLSchema#string</code>.
-	 * 
-	 * 
-	 * @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 UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default Literal createLiteral(String lexicalForm)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createLiteral(String) not supported");
-	}
-
-	/**
-	 * Create a literal with the specified data type.
-	 * <p>
-	 * 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.
-	 * <p>
-	 * It is RECOMMENDED that the provided dataType is one of the <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#xsd-datatypes">RDF-compatible
-	 * XSD types</a>.
-	 * <p>
-	 * The provided lexical form SHOULD be in the <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-space">lexical
-	 * space</a> of the provided dataType.
-	 * <p>
-	 * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} that
-	 * is equal to the provided lexicalForm, MUST NOT have a
-	 * {@link Literal#getLanguageTag()} present, and SHOULD return a
-	 * {@link Literal#getDatatype()} that is equal to the provided dataType IRI.
-	 * 
-	 * @param lexicalForm
-	 *            The literal value
-	 * @param dataType
-	 *            The data type IRI for the literal value, e.g.
-	 *            <code>http://www.w3.org/2001/XMLSchema#integer</code>
-	 * @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 UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default Literal createLiteral(String lexicalForm, IRI dataType)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createLiteral(String) not supported");
-	}
-
-	/**
-	 * Create a language-tagged literal.
-	 * <p>
-	 * 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.
-	 * <p>
-	 * The provided language tag MUST be valid according to <a
-	 * href="http://tools.ietf.org/html/bcp47">BCP47</a>, e.g. <code>en</code>.
-	 * <p>
-	 * The provided language tag <a
-	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string"
-	 * >MAY be converted to lower case</a>.
-	 * <p>
-	 * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} which
-	 * is equal to the provided lexicalForm, MUST return a
-	 * {@link Literal#getDatatype()} that is equal to the IRI
-	 * <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</code>, and
-	 * MUST have a {@link Literal#getLanguageTag()} present which SHOULD be
-	 * equal to the provided language tag (compared as
-	 * {@link String#toLowerCase(Locale)} in {@link Locale#ENGLISH}).
-	 * 
-	 * @param lexicalForm
-	 *            The literal value
-	 * @param languageTag
-	 *            The non-empty language tag as defined by <a
-	 *            href="http://tools.ietf.org/html/bcp47">BCP47</a>
-	 * @return The created Literal
-	 * @throws IllegalArgumentException
-	 *             If the provided values are not acceptable, e.g. because the
-	 *             languageTag was syntactically invalid.
-	 * @throws UnsupportedOperationException
-	 *             If the operation is not supported.
-	 */
-	default Literal createLiteral(String lexicalForm, String languageTag)
-			throws IllegalArgumentException, UnsupportedOperationException {
-		throw new UnsupportedOperationException(
-				"createLiteral(String,String) not supported");
-	}
-
-	/**
-	 * Create a triple.
-	 * <p>
-	 * The returned Triple SHOULD have a {@link Triple#getSubject()} that is
-	 * equal to the provided subject, a {@link Triple#getPredicate()} that is
-	 * 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
-	 * @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 UnsupportedOperationException
-	 *             If the operation is 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/fa5321e4/api/src/main/java/com/github/commonsrdf/api/Triple.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/com/github/commonsrdf/api/Triple.java b/api/src/main/java/com/github/commonsrdf/api/Triple.java
deleted file mode 100644
index 1cc8ec8..0000000
--- a/api/src/main/java/com/github/commonsrdf/api/Triple.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-/**
- * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" >RDF-1.1
- * Triple</a>, 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.<br>
- *
- * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" >RDF-1.1
- *      Triple</a>
- */
-public interface Triple {
-
-	/**
-	 * The subject of this triple, 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 triple.
-	 * @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 triple.
-	 *
-	 * @return The predicate {@link IRI} of this triple.
-	 * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">RDF-1.1
-	 *      Triple predicate</a>
-	 */
-	IRI getPredicate();
-
-	/**
-	 * The object of this triple, 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 triple.
-	 * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">RDF-1.1
-	 *      Triple object</a>
-	 */
-	RDFTerm getObject();
-
-	/**
-	 * Check it this Triple is equal to another Triple.
-	 * <p>
-	 * Two Triples are equal if and only if their {@link #getSubject()},
-	 * {@link #getPredicate()} and {@link #getObject()} are equal.
-	 * </p>
-	 * <p>
-	 * Implementations MUST check the local scope for Triple comparison if
-	 * either the subject or object is a BlankNode, and MAY check the local
-	 * scope in other cases.
-	 * </p>
-	 * <p>
-	 * Implementations MUST also override {@link #hashCode()} so that two equal
-	 * Triples produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#equals(Object)
-	 * 
-	 * @param other
-	 *            Another object
-	 * @return true if other is a Triple and is equal to this
-	 */
-	@Override
-	public boolean equals(Object other);
-
-	/**
-	 * Calculate a hash code for this Triple.
-	 * <p>
-	 * This method MUST be implemented when implementing {@link #equals(Object)}
-	 * so that two equal IRIs produce the same hash code.
-	 * </p>
-	 * 
-	 * @see Object#hashCode()
-	 * 
-	 * @return a hash code value for this Triple.
-	 */
-	@Override
-	public int hashCode();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..9a81002
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/BlankNode.java
@@ -0,0 +1,148 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+/**
+ * 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>
+ * <p>
+ * 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>
+ * <p>
+ * 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.
+ * <p>
+ * Implementations that handle blank node identifiers in concrete syntaxes need
+ * to be careful not to create the same blank node from multiple occurrences of
+ * the same blank node identifier except in situations where this is supported
+ * by the syntax.
+ * </blockquote>
+ *
+ * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node">RDF-1.1
+ *      Blank Node</a>
+ */
+public interface BlankNode extends BlankNodeOrIRI {
+
+	/**
+	 * Return a <a href=
+	 * "http://www.w3.org/TR/rdf11-concepts/#dfn-blank-node-identifier"
+	 * >label</a> for the blank node. This is not a serialization/syntax label.
+	 * It should be uniquely identifying within the local scope it is created in
+	 * but has no uniqueness guarantees other than that.
+	 * <p>
+	 * In particular, the existence of two objects of type {@link BlankNode}
+	 * with the same value returned from {@link #internalIdentifier()} are not
+	 * equivalent unless they are known to have been created in the same local
+	 * scope (see {@link #equals(Object)})
+	 * <p>
+	 * An example of a local scope may be an instance of a Java Virtual Machine
+	 * (JVM). In the context of a JVM instance, an implementor may support
+	 * insertion and removal of {@link Triple} objects containing Blank Nodes
+	 * without modifying the blank node labels.
+	 * <p>
+	 * Another example of a local scope may be a <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph">Graph</a>
+	 * or <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#section-dataset">Dataset</a>
+	 * created from a single document. In this context, an implementor should
+	 * reasonably guarantee that the label returned by getLabel only maps to
+	 * equivalent blank nodes in the same Graph or Dataset, but they may not
+	 * guarantee that it is unique for the JVM instance. In this case, the
+	 * implementor may support a mechanism to provide a mapping for blank nodes
+	 * between Graph or Dataset instances to guarantee their uniqueness.
+	 * <p>
+	 * If implementors support <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#section-skolemization"
+	 * >Skolemisation</a>, they may map instances of {@link BlankNode} objects
+	 * to {@link IRI} objects to reduce scoping issues.
+	 * <p>
+	 * It is not a requirement for the internal identifier to be a part of the
+	 * {@link #ntriplesString()}, except that two BlankNode instances with the
+	 * same internalIdentifier() and same local scope should have the same
+	 * {@link #ntriplesString()}.
+	 *
+	 * @return An internal, system identifier for the {@link BlankNode}.
+	 */
+	String internalIdentifier();
+
+	/**
+	 * Check it this BlankNode is equal to another BlankNode. <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 locally scoped
+	 * 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. 
+	 * <p>Implementations that handle blank node identifiers in
+	 * concrete syntaxes need to be careful not to create the same blank node
+	 * from multiple occurrences of the same blank node identifier except in
+	 * situations where this is supported by the syntax. 
+	 * </blockquote>
+	 * <p>
+	 * Implementations MUST check the local scope, as two BlankNode in different
+	 * Graphs MUST differ. On the other hand, two BlankNodes found in triples of
+	 * the same Graph instance MUST equal if and only if they have the same
+	 * {@link #internalIdentifier()}.
+	 * </p>
+	 * <p>
+	 * Implementations MUST also override {@link #hashCode()} so that two equal
+	 * Literals produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#equals(Object)
+	 * 
+	 * @param other
+	 *            Another object
+	 * @return true if other is a BlankNode, is in the same local scope and is
+	 *         equal to this BlankNode
+	 */
+	@Override
+	public boolean equals(Object other);
+
+	/**
+	 * Calculate a hash code for this BlankNode.
+	 * <p>
+	 * This method MUST be implemented when implementing {@link #equals(Object)}
+	 * so that two equal BlankNodes produce the same hash code.
+	 * 
+	 * @see Object#hashCode()
+	 * 
+	 * @return a hash code value for this BlankNode.
+	 */
+	@Override
+	public int hashCode();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.java b/api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.java
new file mode 100644
index 0000000..85a2e7b
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/BlankNodeOrIRI.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+/**
+ * This interface represents the {@link RDFTerm}s that may be used in the
+ * subject position of an RDF-1.1 {@link Triple}, including {@link BlankNode}
+ * and {@link IRI}.
+ */
+public interface BlankNodeOrIRI extends RDFTerm {
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..d12797a
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/Graph.java
@@ -0,0 +1,179 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+import java.util.function.Predicate;
+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
+ * Syntax</a>, a W3C Recommendation published on 25 February 2014.
+ */
+public interface Graph extends AutoCloseable {
+
+	/**
+	 * Add a triple to the graph.
+	 *
+	 * @param triple
+	 *            The triple to add
+	 */
+	void add(Triple triple);
+
+	/**
+	 * Add a triple to the graph.
+	 *
+	 * @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.
+	 * @return True if the Graph contains the given Triple.
+	 */
+	boolean contains(Triple 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)
+	 * @return True if the Graph contains any Triples that match the given
+	 *         pattern.
+	 */
+	boolean contains(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+
+	/**
+	 * Close the graph, relinquishing any underlying resources.
+	 * <p>
+	 * For example, this would close any open file and network streams and free
+	 * database locks held by the Graph implementation.
+	 * <p>
+	 * The behaviour of the other Graph methods are undefined after closing the
+	 * graph.
+	 * <p>
+	 * Implementations might not need {@link #close()}, hence the default
+	 * implementation does nothing.
+	 */
+	@Override
+	default void close() throws Exception {
+	}
+
+	/**
+	 * Remove a concrete triple from the graph.
+	 *
+	 * @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)
+	 */
+	void remove(BlankNodeOrIRI subject, IRI predicate, RDFTerm object);
+
+	/**
+	 * Clear the graph, removing all triples.
+	 * 
+	 */
+	void clear();
+
+	/**
+	 * Number of triples contained by the graph.
+	 * <p>
+	 * The count of a set does not include duplicates, as determined by the
+	 * equals method for each {@link Triple}.
+	 * 
+	 * @return The number of triples in the graph
+	 */
+	long size();
+
+	/**
+	 * Get all triples contained by the graph.<br>
+	 * <p>
+	 * The iteration does not contain any duplicate triples, as determined by
+	 * the equals method for each {@link Triple}.
+	 * <p>
+	 * The behaviour of the Stream is not specified if add, remove, or clear,
+	 * are called on the Stream before it terminates.<br>
+	 * <p>
+	 * Implementations may throw ConcurrentModificationException from Stream
+	 * methods if they detect a conflict while the Stream is active.
+	 *
+	 * @return A {@link Stream} over all of the triples in the graph
+	 */
+	Stream<? extends Triple> getTriples();
+
+	/**
+	 * Get all triples contained by the graph matched with the pattern.
+	 * <p>
+	 * The iteration does not contain any duplicate triples, as determined by
+	 * the equals method for each {@link Triple}.
+	 * <p>
+	 * The behaviour of the Stream is not specified if add, remove, or clear,
+	 * are called on the Stream before it terminates.<br>
+	 * <p>
+	 * Implementations may throw ConcurrentModificationException from Stream
+	 * methods if they detect a conflict while the Stream is active.
+	 *
+	 * @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> getTriples(BlankNodeOrIRI subject, IRI predicate,
+			RDFTerm object);
+
+	/**
+	 * Get all triples contained by the graph matched with the pattern.
+	 * <p>
+	 * The iteration does not contain any duplicate triples, as determined by
+	 * the equals method for each {@link Triple}.
+	 * <p>
+	 * The behaviour of the Stream is not specified if add, remove, or clear,
+	 * are called on the Stream before it terminates.<br>
+	 * <p>
+	 * Implementations may throw ConcurrentModificationException from Stream
+	 * methods if they detect a conflict while the Stream is active.
+	 *
+	 * @param filter
+	 *            A filter to match against each triple in the graph.
+	 * @return A {@link Stream} over the matched triples.
+	 */
+	Stream<? extends Triple> getTriples(Predicate<Triple> filter);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..041a7da
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/IRI.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+/**
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-iri" >RDF-1.1 IRI</a>,
+ * 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.<br>
+ */
+public interface IRI extends BlankNodeOrIRI {
+
+	/**
+	 * Return the IRI encoded as a native Unicode String.<br>
+	 * 
+	 * The returned string must not include URL-encoding to escape non-ASCII
+	 * characters.
+	 * 
+	 * @return The IRI encoded as a native Unicode String.
+	 */
+	String getIRIString();
+
+	/**
+	 * 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>
+	 * <p>
+	 * Two IRIs are equal are in the same local scope and their
+	 * {@link #getIRIString()} are equal.
+	 * </p>
+	 * <p>
+	 * Implementations MAY check the local scope for IRI comparison.
+	 * </p>
+	 * <p>
+	 * Implementations MUST also override {@link #hashCode()} so that two equal
+	 * IRIs produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#equals(Object)
+	 * 
+	 * @param other
+	 *            Another object
+	 * @return true if other is an IRI and is equal to this
+	 */
+	@Override
+	public boolean equals(Object other);
+
+	/**
+	 * Calculate a hash code for this IRI.
+	 * <p>
+	 * This method MUST be implemented when implementing {@link #equals(Object)}
+	 * so that two equal IRIs produce the same hash code.
+	 * 
+	 * @see Object#hashCode()
+	 * 
+	 * @return a hash code value for this IRI.
+	 */
+	@Override
+	public int hashCode();
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..5c40ac4
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/Literal.java
@@ -0,0 +1,108 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+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
+ */
+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>.
+	 *
+	 * @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>
+	 */
+	String getLexicalForm();
+
+	/**
+	 * The IRI identifying the datatype that determines how the lexical form
+	 * maps to a literal value.
+	 *
+	 * @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>
+	 */
+	IRI getDatatype();
+
+	/**
+	 * 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"
+	 * >http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</a>, this method
+	 * must return {@link Optional#empty()}.
+	 *
+	 * @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>
+	 */
+	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
+	 * language tags (if any) compare equal, character by character. Thus, two
+	 * literals can have the same value without being the same RDF term.
+	 * </blockquote>
+	 * <p>
+	 * Implementations MAY check the local scope for Literal comparison.
+	 * </p>
+	 * <p>
+	 * Implementations MUST also override {@link #hashCode()} so that two equal
+	 * Literals produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#equals(Object)
+	 * 
+	 * @param other
+	 *            Another object
+	 * @return true if other is a Literal and is equal to this
+	 */
+	@Override
+	public boolean equals(Object other);
+
+	/**
+	 * Calculate a hash code for this Literal.
+	 * <p>
+	 * This method MUST be implemented when implementing {@link #equals(Object)}
+	 * so that two equal Literals produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#hashCode()
+	 * 
+	 * @return a hash code value for this Literal.
+	 */
+	@Override
+	public int hashCode();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..0540bdd
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+/**
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>, 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.<br>
+ *
+ * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term" >RDF-1.1
+ * Term</a>
+ */
+public interface RDFTerm {
+
+    /**
+     * 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 <a href="http://www.w3.org/TR/n-triples/#canonical-ntriples">
+     *         RDF-1.1 N-Triples Canonical form</a>
+     */
+    String ntriplesString();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/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
new file mode 100644
index 0000000..7d0cef6
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java
@@ -0,0 +1,252 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+import java.util.Locale;
+
+/**
+ * Factory for creating RDFTerm and Graph instances.
+ * <p>
+ * It is not specified how an implementation should provide a RDFTermFactory.
+ * <p>
+ * If an implementation does not support a particular method (e.g. it requires
+ * additional parameters or can't create graphs), then it MAY throw
+ * UnsupportedOperationException, as provided by the default implementations
+ * here.
+ * <p>
+ * If a factory method does not allow or support a provided parameter, e.g.
+ * because an IRI is considered invalid, then it SHOULD throw
+ * IllegalArgumentException.
+ * 
+ * 
+ * @see RDFTerm
+ * @see Graph
+ * 
+ */
+public interface RDFTermFactory {
+
+	/**
+	 * Create a new blank node.
+	 * <p>
+	 * Two BlankNodes created with this method MUST NOT be equal.
+	 * <p>
+	 * If supported, the {@link BlankNode#internalIdentifier()} of the returned
+	 * blank node MUST be an auto-generated value.
+	 * 
+	 * @return A new BlankNode
+	 * @throws UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default BlankNode createBlankNode() throws UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createBlankNode() not supported");
+	}
+
+	/**
+	 * Create a blank node for the given internal identifier.
+	 * <p>
+	 * Two BlankNodes created with the same identifier using this method MUST be
+	 * equal if they are in the same local scope (e.g. in the same Graph). See
+	 * the equals contract for {@link BlankNode} for more information.
+	 * <p>
+	 * If supported, the {@link BlankNode#internalIdentifier()} of the returned
+	 * blank node MAY be equal to the provided identifier.
+	 * 
+	 * @param identifier
+	 *            A non-empty String that is unique to this blank node in this
+	 *            scope, and which may be used as the internal identifier for
+	 *            the blank node.
+	 * @return A BlankNode for the given identifier
+	 * @throws IllegalArgumentException
+	 *             if the identifier is not acceptable, e.g. was empty or
+	 *             contained unsupported characters.
+	 * @throws UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default BlankNode createBlankNode(String identifier)
+			throws IllegalArgumentException, UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createBlankNode(String) not supported");
+	}
+
+	/**
+	 * Create a new graph.
+	 * <p>
+	 * It is undefined if the graph will be persisted by any underlying storage
+	 * mechanism.
+	 * 
+	 * @return A new Graph
+	 * @throws UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default Graph createGraph() throws UnsupportedOperationException {
+		throw new UnsupportedOperationException("createGraph() not supported");
+	}
+
+	/**
+	 * Create an IRI from a (possibly escaped) String.
+	 * <p>
+	 * The provided iri string MUST be valid according to the <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-iri">W3C RDF-1.1 IRI</a>
+	 * definition.
+	 * 
+	 * @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 UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default IRI createIRI(String iri) throws IllegalArgumentException,
+			UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createIRI(String) not supported");
+	}
+
+	/**
+	 * Create a simple literal.
+	 * <p>
+	 * 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.
+	 * <p>
+	 * The returned Literal MUST have a {@link Literal#getLexicalForm()} that is
+	 * equal to the provided lexical form, MUST NOT have a
+	 * {@link Literal#getLanguageTag()} present, and SHOULD return a
+	 * {@link Literal#getDatatype()} that is equal to the IRI
+	 * <code>http://www.w3.org/2001/XMLSchema#string</code>.
+	 * 
+	 * 
+	 * @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 UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default Literal createLiteral(String lexicalForm)
+			throws IllegalArgumentException, UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createLiteral(String) not supported");
+	}
+
+	/**
+	 * Create a literal with the specified data type.
+	 * <p>
+	 * 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.
+	 * <p>
+	 * It is RECOMMENDED that the provided dataType is one of the <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#xsd-datatypes">RDF-compatible
+	 * XSD types</a>.
+	 * <p>
+	 * The provided lexical form SHOULD be in the <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-lexical-space">lexical
+	 * space</a> of the provided dataType.
+	 * <p>
+	 * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} that
+	 * is equal to the provided lexicalForm, MUST NOT have a
+	 * {@link Literal#getLanguageTag()} present, and SHOULD return a
+	 * {@link Literal#getDatatype()} that is equal to the provided dataType IRI.
+	 * 
+	 * @param lexicalForm
+	 *            The literal value
+	 * @param dataType
+	 *            The data type IRI for the literal value, e.g.
+	 *            <code>http://www.w3.org/2001/XMLSchema#integer</code>
+	 * @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 UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default Literal createLiteral(String lexicalForm, IRI dataType)
+			throws IllegalArgumentException, UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createLiteral(String) not supported");
+	}
+
+	/**
+	 * Create a language-tagged literal.
+	 * <p>
+	 * 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.
+	 * <p>
+	 * The provided language tag MUST be valid according to <a
+	 * href="http://tools.ietf.org/html/bcp47">BCP47</a>, e.g. <code>en</code>.
+	 * <p>
+	 * The provided language tag <a
+	 * href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tagged-string"
+	 * >MAY be converted to lower case</a>.
+	 * <p>
+	 * The returned Literal SHOULD have a {@link Literal#getLexicalForm()} which
+	 * is equal to the provided lexicalForm, MUST return a
+	 * {@link Literal#getDatatype()} that is equal to the IRI
+	 * <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#langString</code>, and
+	 * MUST have a {@link Literal#getLanguageTag()} present which SHOULD be
+	 * equal to the provided language tag (compared as
+	 * {@link String#toLowerCase(Locale)} in {@link Locale#ENGLISH}).
+	 * 
+	 * @param lexicalForm
+	 *            The literal value
+	 * @param languageTag
+	 *            The non-empty language tag as defined by <a
+	 *            href="http://tools.ietf.org/html/bcp47">BCP47</a>
+	 * @return The created Literal
+	 * @throws IllegalArgumentException
+	 *             If the provided values are not acceptable, e.g. because the
+	 *             languageTag was syntactically invalid.
+	 * @throws UnsupportedOperationException
+	 *             If the operation is not supported.
+	 */
+	default Literal createLiteral(String lexicalForm, String languageTag)
+			throws IllegalArgumentException, UnsupportedOperationException {
+		throw new UnsupportedOperationException(
+				"createLiteral(String,String) not supported");
+	}
+
+	/**
+	 * Create a triple.
+	 * <p>
+	 * The returned Triple SHOULD have a {@link Triple#getSubject()} that is
+	 * equal to the provided subject, a {@link Triple#getPredicate()} that is
+	 * 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
+	 * @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 UnsupportedOperationException
+	 *             If the operation is 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/fa5321e4/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
new file mode 100644
index 0000000..5981cdd
--- /dev/null
+++ b/api/src/main/java/org/apache/commons/rdf/api/Triple.java
@@ -0,0 +1,97 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rdf.api;
+
+/**
+ * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" >RDF-1.1
+ * Triple</a>, 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.<br>
+ *
+ * @see <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-triple" >RDF-1.1
+ *      Triple</a>
+ */
+public interface Triple {
+
+	/**
+	 * The subject of this triple, 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 triple.
+	 * @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 triple.
+	 *
+	 * @return The predicate {@link IRI} of this triple.
+	 * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-predicate">RDF-1.1
+	 *      Triple predicate</a>
+	 */
+	IRI getPredicate();
+
+	/**
+	 * The object of this triple, 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 triple.
+	 * @see <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-object">RDF-1.1
+	 *      Triple object</a>
+	 */
+	RDFTerm getObject();
+
+	/**
+	 * Check it this Triple is equal to another Triple.
+	 * <p>
+	 * Two Triples are equal if and only if their {@link #getSubject()},
+	 * {@link #getPredicate()} and {@link #getObject()} are equal.
+	 * </p>
+	 * <p>
+	 * Implementations MUST check the local scope for Triple comparison if
+	 * either the subject or object is a BlankNode, and MAY check the local
+	 * scope in other cases.
+	 * </p>
+	 * <p>
+	 * Implementations MUST also override {@link #hashCode()} so that two equal
+	 * Triples produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#equals(Object)
+	 * 
+	 * @param other
+	 *            Another object
+	 * @return true if other is a Triple and is equal to this
+	 */
+	@Override
+	public boolean equals(Object other);
+
+	/**
+	 * Calculate a hash code for this Triple.
+	 * <p>
+	 * This method MUST be implemented when implementing {@link #equals(Object)}
+	 * so that two equal IRIs produce the same hash code.
+	 * </p>
+	 * 
+	 * @see Object#hashCode()
+	 * 
+	 * @return a hash code value for this Triple.
+	 */
+	@Override
+	public int hashCode();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/fa5321e4/api/src/test/java/com/github/commonsrdf/api/AbstractBlankNodeTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/com/github/commonsrdf/api/AbstractBlankNodeTest.java b/api/src/test/java/com/github/commonsrdf/api/AbstractBlankNodeTest.java
deleted file mode 100644
index 6a8e6f3..0000000
--- a/api/src/test/java/com/github/commonsrdf/api/AbstractBlankNodeTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.github.commonsrdf.api;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-/**
- * Abstract test class for the BlankNode interface.
- * 
- * @author Peter Ansell p_ansell@yahoo.com
- */
-public abstract class AbstractBlankNodeTest {
-
-	protected abstract BlankNode getBlankNode();
-
-	/**
-	 * Gets a new blank node object based on the given identifier.
-	 * <p>
-	 * Subsequent calls to this method during a single test with the same
-	 * identifier must return BlankNode objects that are equals and have the
-	 * same hashCode. The objects returned from successive calls during a single
-	 * test may be the same object, or they may be different objects.
-	 * </p>
-	 * 
-	 * @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 com.github.commonsrdf.api.BlankNode#internalIdentifier()}.
-	 */
-	@Test
-	public final void testInternalIdentifier() {
-		BlankNode testNull = new BlankNode() {
-			@Override
-			public String ntriplesString() {
-				return null;
-			}
-
-			@Override
-			public String internalIdentifier() {
-				return null;
-			}
-		};
-		BlankNode testAutomatic1 = getBlankNode();
-		BlankNode testAutomatic2 = getBlankNode();
-		BlankNode testManual3a = getBlankNode("3");
-		BlankNode testManual3b = getBlankNode("3");
-		BlankNode testManual4 = getBlankNode("4");
-
-		// Test against our fake stub
-		assertNotEquals(testNull.internalIdentifier(),
-				testAutomatic1.internalIdentifier());
-		assertNotEquals(testAutomatic1.internalIdentifier(),
-				testNull.internalIdentifier());
-		assertNotEquals(testNull.internalIdentifier(),
-				testManual3a.internalIdentifier());
-		assertNotEquals(testManual3a.internalIdentifier(),
-				testNull.internalIdentifier());
-
-		// Test the two imported instances against each other
-		assertEquals(testAutomatic1.internalIdentifier(),
-				testAutomatic1.internalIdentifier());
-		assertEquals(testAutomatic2.internalIdentifier(),
-				testAutomatic2.internalIdentifier());
-		assertNotEquals(testAutomatic1.internalIdentifier(),
-				testAutomatic2.internalIdentifier());
-		assertNotEquals(testAutomatic2.internalIdentifier(),
-				testAutomatic1.internalIdentifier());
-		assertNotEquals(testAutomatic1.internalIdentifier(),
-				testManual3a.internalIdentifier());
-		assertEquals(testManual3b.internalIdentifier(),
-				testManual3a.internalIdentifier());
-		assertNotEquals(testManual3a.internalIdentifier(),
-				testManual4.internalIdentifier());
-	}
-
-	/**
-	 * Test method for
-	 * {@link com.github.commonsrdf.api.BlankNode#equals(java.lang.Object)}.
-	 */
-	@Test
-	public final void testEquals() {
-		BlankNode testNull = new BlankNode() {
-			@Override
-			public String ntriplesString() {
-				return null;
-			}
-
-			@Override
-			public String internalIdentifier() {
-				return null;
-			}
-		};
-		BlankNode testAutomatic1 = getBlankNode();
-		BlankNode testAutomatic2 = getBlankNode();
-		BlankNode testManual3a = getBlankNode("3");
-		BlankNode testManual3b = getBlankNode("3");
-		BlankNode testManual4 = getBlankNode("4");
-
-		// Test against our fake stub
-		assertNotEquals(testNull, testAutomatic1);
-		assertNotEquals(testAutomatic1, testNull);
-		assertNotEquals(testNull, testManual3a);
-		assertNotEquals(testManual3a, testNull);
-
-		// Test the two imported instances against each other
-		assertEquals(testAutomatic1, testAutomatic1);
-		assertEquals(testAutomatic2, testAutomatic2);
-		assertNotEquals(testAutomatic1, testAutomatic2);
-		assertNotEquals(testAutomatic2, testAutomatic1);
-		assertNotEquals(testAutomatic1, testManual3a);
-		assertEquals(testManual3b, testManual3a);
-		assertNotEquals(testManual3a, testManual4);
-	}
-
-	/**
-	 * Test method for {@link com.github.commonsrdf.api.BlankNode#hashCode()}.
-	 */
-	@Test
-	public final void testHashCode() {
-		BlankNode testNull = new BlankNode() {
-			@Override
-			public String ntriplesString() {
-				return null;
-			}
-
-			@Override
-			public String internalIdentifier() {
-				return null;
-			}
-		};
-		BlankNode testAutomatic1 = getBlankNode();
-		BlankNode testAutomatic2 = getBlankNode();
-		BlankNode testManual3a = getBlankNode("3");
-		BlankNode testManual3b = getBlankNode("3");
-		BlankNode testManual4 = getBlankNode("4");
-
-		// Test against our fake stub
-		assertNotEquals(testNull.hashCode(), testAutomatic1.hashCode());
-		assertNotEquals(testAutomatic1.hashCode(), testNull.hashCode());
-		assertNotEquals(testNull.hashCode(), testManual3a.hashCode());
-		assertNotEquals(testManual3a.hashCode(), testNull.hashCode());
-
-		// Test the two imported instances against each other
-		assertEquals(testAutomatic1.hashCode(), testAutomatic1.hashCode());
-		assertEquals(testAutomatic2.hashCode(), testAutomatic2.hashCode());
-		assertNotEquals(testAutomatic1.hashCode(), testAutomatic2.hashCode());
-		assertNotEquals(testAutomatic2.hashCode(), testAutomatic1.hashCode());
-		assertNotEquals(testAutomatic1.hashCode(), testManual3a.hashCode());
-		assertEquals(testManual3b.hashCode(), testManual3a.hashCode());
-		assertNotEquals(testManual3a.hashCode(), testManual4.hashCode());
-	}
-
-	/**
-	 * Test method for
-	 * {@link com.github.commonsrdf.api.RDFTerm#ntriplesString()}.
-	 */
-	@Test
-	public final void testNtriplesString() {
-		BlankNode testNull = new BlankNode() {
-			@Override
-			public String ntriplesString() {
-				return null;
-			}
-
-			@Override
-			public String internalIdentifier() {
-				return null;
-			}
-		};
-		BlankNode testAutomatic1 = getBlankNode();
-		BlankNode testAutomatic2 = getBlankNode();
-		BlankNode testManual3a = getBlankNode("3");
-		BlankNode testManual3b = getBlankNode("3");
-		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());
-
-		// 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());
-	}
-
-}


Mime
View raw message