Ah, sorry. i forgot to post this PR here:
https://github.com/apache/commons-rdf/pull/205
I did it right after the mail.
Thanks Fredy
On 10.03.24 13:42, Peter Hull wrote:
On Sat, 9 Mar 2024 at 22:37, Fred Hauschel wrote:
Is there a reason, why there is no Method like GraphLike#add(List
statements); ?
It would be possible to add a method with a default implementation to
GraphLike - 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 {
*/
void add(T statement);
+/**
+ * Add a collection of statements.
+ *
+ * @param statements the TripleLike statements to add
+ */
+default void addAll(Iterable 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
-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org