Github user stain commented on a diff in the pull request: https://github.com/apache/incubator-commonsrdf/pull/25#discussion_r85500800 --- Diff: api/src/main/java/org/apache/commons/rdf/api/RDF.java --- @@ -0,0 +1,244 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.io.Serializable; +import java.util.Locale; + +/** + * A RDF implementation. + * <p> + * A <code>RDF</code> implementation can create instances of + * the {@link RDFTerm} types + * {@link IRI}, {@link BlankNode} and {@link Literal}, as well as creating + * instances of the types {@link Triple}, {@link Quad}, {@link Graph} or + * {@link Dataset}. + * <p> + * A <em>partial RDF implementation</em> + * should be clearly documented as such, and may throw + * {@link UnsupportedOperationException} where applicable, e.g. if it + * does not support creating {@link Dataset}s or {@link Quad}s. + * <p> + * Instances of <code>RDF</code> work like a factory for + * creating Commons RDF instances. + * spezializations of this interface may also provide methods + * for conversions from/to their underlying RDF framework. + * <p> + * If a factory method of a particular implementation does not allow or support + * a provided parameter, e.g. because an IRI is considered invalid, then it + * SHOULD throw {@link IllegalArgumentException}. + * + * @since 0.3.0-incubating + * @see RDFTerm + * @see Graph + * @see Quad + */ +public interface RDF { + + /** + * Create a new blank node. + * <p> + * The returned blank node MUST NOT be equal to any existing + * {@link BlankNode} instances according to {@link BlankNode#equals(Object)}. + * + * @return A new, unique {@link BlankNode} + */ + public BlankNode createBlankNode(); + + /** + * Create a blank node based on the given name. + * <p> + * All {@link BlankNode}s created with the given <code>name</code> + * <em>on a particular instance</em> of <code>RDF</code> MUST be + * equivalent according to {@link BlankNode#equals(Object)}, + * <p> + * The returned BlankNode MUST NOT be equal to <code>BlankNode</code> + * instances returned for any other <code>name</code> or those returned from + * {@link #createBlankNode()}. + * <p> + * The returned BlankNode SHOULD NOT be equivalent to any BlankNodes created + * on a <em>different</em> <code>RDF</code> instance, e.g. + * different instances of <code>RDF</code> should produce + * different blank nodes for the same <code>name</code> unless they + * purposely are intending to create equivalent {@link BlankNode} + * instances (e.g. a reinstated {@link Serializable} factory). + * + * @param name + * A non-empty, non-null, String that is unique to this blank + * node in the context of this {@link RDF}. + * @return A BlankNode for the given name + */ + public BlankNode createBlankNode(String name); + + /** + * Create a new graph. + * + * It is undefined if the graph will be persisted by any underlying storage + * mechanism. + * + * @return A new Graph + */ + public Graph createGraph(); --- End diff -- Thanks, I'll do a separate commit to fix indentation to all spaces, which I think is what Commons prefer. (That got quite a large diff, so I won't pollute this PR with it)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---