On Sat, 9 Mar 2024 at 22:37, Fred Hauschel <naturzuku...@hauschel.de> wrote:

> Is there a reason, why there is no Method like GraphLike#add(List<T>
> statements); ?

It would be possible to add a method with a default implementation to
GraphLike<T> - then look to see if this can be more efficient for
RDF4J (e.g. avoiding the multiple connections)
I don't think this would break compatibility unless someone had
already implemented addAll on a subclass, with a different signature.
Peter

diff --git 
a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
index f50423f8..0b7b936a 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/GraphLike.java
@@ -55,6 +55,17 @@ public interface GraphLike<T extends TripleLike> {
      */
     void add(T statement);

+    /**
+     * Add a collection of statements.
+     *
+     * @param statements the TripleLike statements to add
+     */
+    default void addAll(Iterable<? extends T> statements) {
+        for (T statement : statements) {
+            add(statement);
+        }
+    }
+
     /**
      * Remove all statements.
      */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to