This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 64a800438567c1bb35a7e896c79c6182a7717435
Author: Andy Seaborne <[email protected]>
AuthorDate: Sun Nov 23 20:51:57 2025 +0000

    Code tidy (SolverLibTDB)
---
 .../org/apache/jena/tdb2/solver/SolverLibTDB.java  | 27 ++++++++--------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git 
a/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLibTDB.java 
b/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLibTDB.java
index b37cebe6de..96d8dc66f7 100644
--- a/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLibTDB.java
+++ b/jena-tdb2/src/main/java/org/apache/jena/tdb2/solver/SolverLibTDB.java
@@ -106,7 +106,7 @@ public class SolverLibTDB
                 // Can occur with BindingProject
                 continue;
 
-            // Rely on the node table cache for efficency - we will likely be
+            // Rely on the node table cache for efficiency - we will likely be
             // repeatedly looking up the same node in different bindings.
             NodeId id = nodeTable.getNodeIdForNode(n);
             // Even put in "does not exist" for a node now known not to be in 
the DB.
@@ -148,9 +148,7 @@ public class SolverLibTDB
     private static Tuple<NodeId> TupleANY = 
TupleFactory.create4(NodeId.NodeIdAny, NodeId.NodeIdAny, NodeId.NodeIdAny, 
NodeId.NodeIdAny);
 
     private enum GraphNamesDistinctMode {
-        NONE,
-        ADJACENT,
-        FULL;
+        NONE, ADJACENT, FULL;
     }
 
     /** Find all the graph names in the quads table. */
@@ -198,22 +196,17 @@ public class SolverLibTDB
         if ( filter != null )
             iter1 = Iter.filter(iter1, filter);
 
+        // Extract graph node.
         Iterator<NodeId> iter2 = Iter.map(iter1, t -> t.get(0));
+        // iter2 yields 1-1 with iter1 and does not touch the database
+        // so there is no need to wrap iter2 in an IterAbortable.
 
         // Apply the necessary distinct calculation (if any)
-        Iterator<NodeId> iter3;
-        switch (distinctMode) {
-            case FULL:
-                iter3 = Iter.distinct(iter2);
-                break;
-            case ADJACENT:
-                iter3 = Iter.distinctAdjacent(iter2);
-                break;
-            case NONE:
-            default:
-                iter3 = iter2;
-                break;
-        }
+        Iterator<NodeId> iter3 = switch (distinctMode) {
+            case FULL -> Iter.distinct(iter2);
+            case ADJACENT -> Iter.distinctAdjacent(iter2);
+            default -> iter2;
+        };
 
         Iterator<Node> iter4 = 
NodeLib.nodes(ds.getQuadTable().getNodeTupleTable().getNodeTable(), iter3);
 

Reply via email to