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/09/05 15:53:48 UTC

[04/19] incubator-commonsrdf git commit: added createDataset() and createQuad()

added createDataset() and createQuad()


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

Branch: refs/heads/master
Commit: 5e952b5f6e1b9fdf95fb0f4ae2e83470e4169f0d
Parents: 63745d3
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Apr 8 14:52:44 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Apr 8 14:52:44 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rdf/api/RDFTermFactory.java  | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/5e952b5f/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java b/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java
index 41a7b94..f2a6f95 100644
--- a/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java
+++ b/api/src/main/java/org/apache/commons/rdf/api/RDFTermFactory.java
@@ -99,6 +99,19 @@ public interface RDFTermFactory {
     }
 
     /**
+     * Create a new dataset.
+     *
+     * It is undefined if the dataset will be persisted by any underlying storage
+     * mechanism.
+     *
+     * @return A new Dataset
+     * @throws UnsupportedOperationException If the operation is not supported.
+     */
+    default Dataset createDataset() throws UnsupportedOperationException {
+        throw new UnsupportedOperationException("createDataset() not supported");
+    }
+
+    /**
      * Create an IRI from a (possibly escaped) String.
      *
      * The provided iri string MUST be valid according to the <a
@@ -234,4 +247,31 @@ public interface RDFTermFactory {
                 "createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported");
     }
 
+    /**
+     * Create a quad.
+     * <p>
+     * The returned Quad SHOULD have a
+     * {@link Quad#getGraphName()} that is equal to the provided graphName, a
+     * {@link Quad#getSubject()} that is
+     * equal to the provided subject, a {@link Quad#getPredicate()} that is
+     * equal to the provided predicate, and a {@link Quad#getObject()} that is
+     * equal to the provided object.
+     *
+     * @param graphName The IRI or BlankNode that this quad belongs to, or <code>null</code> for the default graph
+     * @param subject   The IRI or BlankNode that is the subject of the quad
+     * @param predicate The IRI that is the predicate of the quad
+     * @param object    The IRI, BlankNode or Literal that is the object of the quad
+     * @return The created Quad
+     * @throws IllegalArgumentException      If any of the provided arguments are not acceptable, e.g.
+     *                                       because a Literal has a lexicalForm that is too large for an
+     *                                       underlying storage.
+     * @throws UnsupportedOperationException If the operation is not supported.
+     */
+    default Quad createQuad(BlankNodeOrIRI graphName, BlankNodeOrIRI subject, IRI predicate,
+                                RDFTerm object) throws IllegalArgumentException,
+            UnsupportedOperationException {
+        throw new UnsupportedOperationException(
+                "createTriple(BlankNodeOrIRI,IRI,RDFTerm) not supported");
+    }
+
 }