Aklakan commented on code in PR #2925: URL: https://github.com/apache/jena/pull/2925#discussion_r1915112399
########## jena-arq/src/main/java/org/apache/jena/sparql/algebra/TableFactory.java: ########## @@ -27,31 +28,45 @@ import org.apache.jena.sparql.algebra.table.TableUnit ; import org.apache.jena.sparql.core.Var ; import org.apache.jena.sparql.engine.QueryIterator ; +import org.apache.jena.sparql.engine.binding.Binding; +import org.apache.jena.sparql.exec.RowSet; public class TableFactory { public static Table createUnit() { return new TableUnit() ; } - + public static Table createEmpty() { return new TableEmpty() ; } public static Table create() { return new TableN() ; } - + public static Table create(List<Var> vars) { return new TableN(vars) ; } - + public static Table create(QueryIterator queryIterator) - { + { if ( queryIterator.isJoinIdentity() ) { queryIterator.close(); return createUnit() ; } - + return new TableN(queryIterator) ; } public static Table create(Var var, Node value) { return new Table1(var, value) ; } + + /** Creates a mutable table from the detached bindings of the row set. */ + public static Table create(RowSet rs) Review Comment: The difference (to my understanding) is that a Table acts as a Collection and a RowSet as an Iterator. A Table can thus be seen as a factory for RowSets via `Table.toRowSet()` - each obtained RowSet is an independent iterator over the Table. My qualms with RowSet.materialize/rewindable is that these methods operate on the iterator level; it seemed clean to me to add Table as a collection of bindings. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org For additional commands, e-mail: pr-h...@jena.apache.org