I don't know much about RDF4J but my comments would be 1. Better IMO to add a default method to the interface rather than adding 11 implementations which are almost identical 2. No need to restrict it to a List when any iterable would do 3. There is a bulk 'add' method in RepositoryConnection (https://rdf4j.org/javadoc/latest/org/eclipse/rdf4j/repository/RepositoryConnection.html#add(java.lang.Iterable,org.eclipse.rdf4j.model.Resource...) - might be better to use it 4. Why was RDF4JServiceLoaderTest.java deleted? 5. Method name 'addAll' is more consistent with Java collections but it seems RDF4J uses 'add' overloaded for single or multiple additions - don't know if Commons has any preference on that.
Hope that's helpful, Pete On Sun, 10 Mar 2024 at 13:03, Fred Hauschel <i...@hauschel.de> wrote: > > 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 <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 > > > > --------------------------------------------------------------------- > 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