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 8f450eb8d1902a34afa9a20ac9cca1315cb53f25
Author: Andy Seaborne <[email protected]>
AuthorDate: Wed Mar 5 20:57:01 2025 +0000

    Reformat and code tidy
---
 .../main/java/org/apache/jena/riot/RDFParser.java  |   4 +-
 .../jena/sparql/algebra/optimize/OptimizerStd.java | 143 +++++++-------
 .../algebra/optimize/TransformPathFlatten.java     |  45 +++--
 .../org/apache/jena/sparql/core/DatasetGraph.java  |  64 +++---
 .../org/apache/jena/sparql/path/PathCompiler.java  | 220 ++++++++++-----------
 .../apache/jena/sparql/sse/writers/WriterOp.java   |   2 +-
 .../java/org/apache/jena/sparql/core/TS_Core.java  |   1 -
 .../java/org/apache/jena/graph/compose/Delta.java  |  99 +++++-----
 .../org/apache/jena/graph/compose/Difference.java  |  61 +++---
 .../apache/jena/graph/compose/DisjointUnion.java   |  57 +++---
 .../java/org/apache/jena/graph/compose/Dyadic.java | 110 +++++------
 .../apache/jena/graph/compose/Intersection.java    |  47 +++--
 .../org/apache/jena/graph/compose/MultiUnion.java  |  52 +++--
 .../java/org/apache/jena/graph/compose/Union.java  |  52 ++---
 14 files changed, 464 insertions(+), 493 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java 
b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java
index cb446647ac..278e9cb7fe 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java
@@ -557,8 +557,8 @@ public class RDFParser {
                 : 
IRIxResolver.create().base(baseStr).resolve(resolve).allowRelative(allowRelative).build();
         PrefixMap pmap = ( this.prefixMap != null ) ? this.prefixMap : 
PrefixMapFactory.create();
         ParserProfileStd parserFactory = new CDTAwareParserProfile(factory, 
errorHandler,
-                                                              parserResolver, 
pmap,
-                                                              context, 
checking$, strict);
+                                                                   
parserResolver, pmap,
+                                                                   context, 
checking$, strict);
         return parserFactory;
     }
 }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/OptimizerStd.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/OptimizerStd.java
index bb4c7aca03..32afddab92 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/OptimizerStd.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/OptimizerStd.java
@@ -18,56 +18,56 @@
 
 package org.apache.jena.sparql.algebra.optimize;
 
-import org.apache.jena.query.ARQ ;
-import org.apache.jena.sparql.ARQConstants ;
-import org.apache.jena.sparql.SystemARQ ;
-import org.apache.jena.sparql.algebra.* ;
-import org.apache.jena.sparql.algebra.op.OpLabel ;
-import org.apache.jena.sparql.util.Context ;
-import org.apache.jena.sparql.util.Symbol ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
+import org.apache.jena.query.ARQ;
+import org.apache.jena.sparql.ARQConstants;
+import org.apache.jena.sparql.SystemARQ;
+import org.apache.jena.sparql.algebra.*;
+import org.apache.jena.sparql.algebra.op.OpLabel;
+import org.apache.jena.sparql.util.Context;
+import org.apache.jena.sparql.util.Symbol;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /** The standard optimization sequence. */
 public class OptimizerStd implements Rewrite
 {
-    static private Logger log = LoggerFactory.getLogger(Optimize.class) ;
-    private final Context context ;
+    static private Logger log = LoggerFactory.getLogger(Optimize.class);
+    private final Context context;
 
     public OptimizerStd(Context context) {
-        this.context = context ;
+        this.context = context;
     }
 
     /** Alternative name for compatibility only */
-    public static final Symbol filterPlacementOldName = 
SystemARQ.allocSymbol("filterPlacement") ;
+    public static final Symbol filterPlacementOldName = 
SystemARQ.allocSymbol("filterPlacement");
 
     @Override
     public Op rewrite(Op op) {
         // Record optimizer
         if ( context.get(ARQConstants.sysOptimizer) == null )
-            context.set(ARQConstants.sysOptimizer, this) ;
+            context.set(ARQConstants.sysOptimizer, this);
 
         // Old name, new name fixup.
         if ( context.isDefined(filterPlacementOldName) ) {
             if ( context.isUndef(ARQ.optFilterPlacement) )
-                context.set(ARQ.optFilterPlacement, 
context.get(filterPlacementOldName)) ;
+                context.set(ARQ.optFilterPlacement, 
context.get(filterPlacementOldName));
         }
 
         if ( false ) {
             // Removal of "group of one" join (AKA SPARQL "simplification")
             // is done during algebra generation in AlgebraGenerator
-            op = apply("Simplify", new TransformSimplify(), op) ;
-            op = apply("Delabel", new TransformRemoveLabels(), op) ;
+            op = apply("Simplify", new TransformSimplify(), op);
+            op = apply("Delabel", new TransformRemoveLabels(), op);
         }
 
         // ** TransformScopeRename
         // This is a requirement for the linearization execution that the 
default
         // ARQ query engine uses where possible.
         // This transformation must be done (e.g. by QueryEngineBase) if no 
other optimization is done.
-        op = TransformScopeRename.transform(op) ;
+        op = TransformScopeRename.transform(op);
 
         // Prepare expressions.
-        OpWalker.walk(op, new OpVisitorExprPrepare(context)) ;
+        OpWalker.walk(op, new OpVisitorExprPrepare(context));
 
         // Convert paths to triple patterns if possible.
         if ( context.isTrueOrUndef(ARQ.optPathFlatten) ) {
@@ -78,7 +78,7 @@ public class OptimizerStd implements Rewrite
             }
             // and merge adjacent BGPs (part 1)
             if ( context.isTrueOrUndef(ARQ.optMergeBGPs) )
-                op = apply("Merge BGPs", new TransformMergeBGPs(), op) ;
+                op = apply("Merge BGPs", new TransformMergeBGPs(), op);
         }
 
         // Having done the required transforms, specifically 
TransformScopeRename,
@@ -87,55 +87,55 @@ public class OptimizerStd implements Rewrite
 
         // Expression constant folding
         if ( context.isTrueOrUndef(ARQ.optExprConstantFolding) )
-            op = transformExprConstantFolding(op) ;
+            op = transformExprConstantFolding(op);
 
         if ( context.isTrueOrUndef(ARQ.propertyFunctions) )
-            op = transformPropertyFunctions(op) ;
+            op = transformPropertyFunctions(op);
 
         // Expand (A&&B) to two filter (A), (B) so that they can be placed 
independently.
         if ( context.isTrueOrUndef(ARQ.optFilterConjunction) )
-            op = transformFilterConjunction(op) ;
+            op = transformFilterConjunction(op);
 
         // Expand IN and NOT IN which then allows other optimizations to be 
applied.
         if ( context.isTrueOrUndef(ARQ.optFilterExpandOneOf) )
-            op = transformFilterExpandOneOf(op) ;
+            op = transformFilterExpandOneOf(op);
 
         // Eliminate/Inline assignments where possible
         // Do this before we do some of the filter transformation work as 
inlining assignments
         // may give us more flexibility in optimizing the resulting filters
         if ( context.isTrue(ARQ.optInlineAssignments) )
-            op = transformInlineAssignments(op) ;
+            op = transformInlineAssignments(op);
 
         // Apply some general purpose filter transformations
         if ( context.isTrueOrUndef(ARQ.optFilterImplicitJoin) )
-            op = transformFilterImplicitJoin(op) ;
+            op = transformFilterImplicitJoin(op);
 
         if ( context.isTrueOrUndef(ARQ.optImplicitLeftJoin) )
-            op = transformFilterImplicitLeftJoin(op) ;
+            op = transformFilterImplicitLeftJoin(op);
 
         if ( context.isTrueOrUndef(ARQ.optFilterDisjunction) )
-            op = transformFilterDisjunction(op) ;
+            op = transformFilterDisjunction(op);
 
         // Some ORDER BY-LIMIT N queries can be done more efficiently by only 
recording
         // the top N items, so a full sort is not needed.
         if ( context.isTrueOrUndef(ARQ.optTopNSorting) )
-            op = transformTopNSorting(op) ;
+            op = transformTopNSorting(op);
 
         // ORDER BY+DISTINCT optimizations
         // We apply the one that changes evaluation order first since when it 
does apply it will give much
         // better performance than just transforming DISTINCT to REDUCED
 
         if ( context.isTrueOrUndef(ARQ.optOrderByDistinctApplication) )
-            op = transformOrderByDistinctApplication(op) ;
+            op = transformOrderByDistinctApplication(op);
 
         // Transform some DISTINCT to REDUCED, slightly more liberal transform 
that ORDER BY+DISTINCT application
         // Reduces memory consumption.
         if ( context.isTrueOrUndef(ARQ.optDistinctToReduced) )
-            op = transformDistinctToReduced(op) ;
+            op = transformDistinctToReduced(op);
 
         // Find joins/leftJoin that can be done by index joins (generally 
preferred as fixed memory overhead).
         if ( context.isTrueOrUndef(ARQ.optIndexJoinStrategy) )
-            op = transformJoinStrategy(op) ;
+            op = transformJoinStrategy(op);
 
         // Do a basic reordering so that triples with more defined terms go 
first.
         // 2022-11: This does not take into account values flowed into the BGP
@@ -143,7 +143,7 @@ public class OptimizerStd implements Rewrite
         // Use "ARQ.getContext.set(ARQ.optReorderBGP, true)" to enable.
         //if ( context.isTrueOrUndef(ARQ.optReorderBGP) )
         if ( context.isTrue(ARQ.optReorderBGP) )
-            op = transformReorder(op) ;
+            op = transformReorder(op);
 
         // Place filters close to where their input variables are defined.
         // This prunes the output of that step as early as possible.
@@ -158,37 +158,37 @@ public class OptimizerStd implements Rewrite
         // of a filter in a (sequence) from each half of a (join).
         // This is harmless but it looks a bit odd.
         if ( context.isTrueOrUndef(ARQ.optFilterPlacement) )
-            op = transformFilterPlacement(op) ;
+            op = transformFilterPlacement(op);
 
         // Replace suitable FILTER(?x = TERM) with (assign) and write the TERM 
for ?x in the pattern.
         // Apply (possible a second time) after FILTER placement as it can 
create new possibilities.
         // See JENA-616.
        if ( context.isTrueOrUndef(ARQ.optFilterEquality) )
-           op = transformFilterEquality(op) ;
+           op = transformFilterEquality(op);
 
         // Replace suitable FILTER(?x != TERM) with (minus (original) (table)) 
where the table contains
         // the candidate rows to be eliminated
         // Off by default due to minimal performance difference
         if ( context.isTrue(ARQ.optFilterInequality) )
-            op = transformFilterInequality(op) ;
+            op = transformFilterInequality(op);
 
         // Promote table empty as late as possible since this will only be 
produced by other
         // optimizations and never directly from algebra generation
         if ( context.isTrueOrUndef(ARQ.optPromoteTableEmpty) )
-            op = transformPromoteTableEmpty(op) ;
+            op = transformPromoteTableEmpty(op);
 
         // Merge adjacent BGPs
         if ( context.isTrueOrUndef(ARQ.optMergeBGPs) )
-            op = transformMergeBGPs(op) ;
+            op = transformMergeBGPs(op);
 
         // Merge (extend) and (assign) stacks
         if ( context.isTrueOrUndef(ARQ.optMergeExtends) )
-            op = transformExtendCombine(op) ;
+            op = transformExtendCombine(op);
 
         // Mark
         if ( false )
-            op = OpLabel.create("Transformed", op) ;
-        return op ;
+            op = OpLabel.create("Transformed", op);
+        return op;
     }
 
     protected Op transformExprConstantFolding(Op op) {
@@ -196,14 +196,14 @@ public class OptimizerStd implements Rewrite
     }
 
     protected Op transformPropertyFunctions(Op op) {
-        return apply("Property Functions", new 
TransformPropertyFunction(context), op) ;
+        return apply("Property Functions", new 
TransformPropertyFunction(context), op);
     }
 
     protected Op transformFilterConjunction(Op op) {
-        return apply("filter conjunctions to ExprLists", new 
TransformFilterConjunction(), op) ;
+        return apply("filter conjunctions to ExprLists", new 
TransformFilterConjunction(), op);
     }
     protected Op transformFilterExpandOneOf(Op op) {
-        return apply("Break up IN and NOT IN", new TransformExpandOneOf(), op) 
;
+        return apply("Break up IN and NOT IN", new TransformExpandOneOf(), op);
     }
 
     protected Op transformInlineAssignments(Op op) {
@@ -219,11 +219,11 @@ public class OptimizerStd implements Rewrite
     }
 
     protected Op transformFilterDisjunction(Op op) {
-        return apply("Filter Disjunction", new TransformFilterDisjunction(), 
op) ;
+        return apply("Filter Disjunction", new TransformFilterDisjunction(), 
op);
     }
 
     protected Op transformTopNSorting(Op op) {
-        return apply("TopN Sorting", new TransformTopN(), op) ;
+        return apply("TopN Sorting", new TransformTopN(), op);
     }
 
     protected Op transformOrderByDistinctApplication(Op op) {
@@ -231,26 +231,26 @@ public class OptimizerStd implements Rewrite
     }
 
     protected Op transformDistinctToReduced(Op op) {
-        return apply("Distinct replaced with reduced", new 
TransformDistinctToReduced(), op) ;
+        return apply("Distinct replaced with reduced", new 
TransformDistinctToReduced(), op);
     }
 
     protected Op transformJoinStrategy(Op op) {
-        return apply("Index Join strategy", new TransformJoinStrategy(), op) ;
+        return apply("Index Join strategy", new TransformJoinStrategy(), op);
     }
 
     protected Op transformFilterPlacement(Op op) {
         if ( context.isTrue(ARQ.optFilterPlacementConservative))
-            op = apply("Filter Placement (conservative)", new 
TransformFilterPlacementConservative(), op) ;
+            op = apply("Filter Placement (conservative)", new 
TransformFilterPlacementConservative(), op);
         else {
             // Whether to push into BGPs
-            boolean b = context.isTrueOrUndef(ARQ.optFilterPlacementBGP) ;
-            op = apply("Filter Placement", new TransformFilterPlacement(b), 
op) ;
+            boolean b = context.isTrueOrUndef(ARQ.optFilterPlacementBGP);
+            op = apply("Filter Placement", new TransformFilterPlacement(b), 
op);
         }
-        return op ;
+        return op;
     }
 
     protected Op transformFilterEquality(Op op) {
-        return apply("Filter Equality", new TransformFilterEquality(), op) ;
+        return apply("Filter Equality", new TransformFilterEquality(), op);
     }
 
     protected Op transformFilterInequality(Op op) {
@@ -258,54 +258,53 @@ public class OptimizerStd implements Rewrite
     }
 
     protected Op transformPromoteTableEmpty(Op op) {
-        return apply("Table Empty Promotion", new 
TransformPromoteTableEmpty(), op) ;
+        return apply("Table Empty Promotion", new 
TransformPromoteTableEmpty(), op);
     }
 
     protected Op transformMergeBGPs(Op op) {
-        return apply("Merge BGPs", new TransformMergeBGPs(), op) ;
+        return apply("Merge BGPs", new TransformMergeBGPs(), op);
     }
 
     protected Op transformReorder(Op op) {
-        return  apply("ReorderMerge BGPs", new TransformReorder(), op) ;
+        return  apply("ReorderMerge BGPs", new TransformReorder(), op);
     }
 
     protected Op transformExtendCombine(Op op) {
-        return apply("Combine BIND/LET", new TransformExtendCombine(), op) ;
+        return apply("Combine BIND/LET", new TransformExtendCombine(), op);
     }
 
     public static Op apply(Transform transform, Op op) {
-        Op op2 = Transformer.transformSkipService(transform, op) ;
+        Op op2 = Transformer.transformSkipService(transform, op);
         if ( op2 != op )
-            return op2 ;
-        return op ;
+            return op2;
+        return op;
     }
 
-    private static final boolean debug = false ;
+    private static final boolean debug = false;
     private static final boolean printNoAction = false;
 
     public static Op apply(String label, Transform transform, Op op) {
-        Op op2 = Transformer.transformSkipService(transform, op) ;
-
+        Op op2 = Transformer.transformSkipService(transform, op);
 
         if ( debug ) {
             if ( printNoAction && label != null )
-                log.info("Transform: " + label) ;
+                log.info("Transform: " + label);
             if ( op == op2 ) {
                 if ( printNoAction )
-                    log.info("No change (==)") ;
-                return op2 ;
+                    log.info("No change (==)");
+                return op2;
             }
             if ( op.equals(op2) ) {
                 if ( printNoAction )
-                    log.info("No change (equals)") ;
-                return op2 ;
+                    log.info("No change (equals)");
+                return op2;
             }
 
             if ( ! printNoAction && label != null );
-                log.info("Transform: " + label) ;
-            log.info("\n" + op.toString()) ;
-            log.info("\n" + op2.toString()) ;
+                log.info("Transform: " + label);
+            log.info("\n" + op.toString());
+            log.info("\n" + op2.toString());
         }
-        return op2 ;
+        return op2;
     }
 }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPathFlatten.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPathFlatten.java
index fba7c56b49..9b8a4b7107 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPathFlatten.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPathFlatten.java
@@ -18,44 +18,43 @@
 
 package org.apache.jena.sparql.algebra.optimize;
 
-import org.apache.jena.sparql.algebra.Op ;
-import org.apache.jena.sparql.algebra.TransformCopy ;
-import org.apache.jena.sparql.algebra.op.OpPath ;
-import org.apache.jena.sparql.core.PathBlock ;
-import org.apache.jena.sparql.path.PathCompiler ;
-import org.apache.jena.sparql.path.PathLib ;
+import org.apache.jena.sparql.algebra.Op;
+import org.apache.jena.sparql.algebra.TransformCopy;
+import org.apache.jena.sparql.algebra.op.OpPath;
+import org.apache.jena.sparql.core.PathBlock;
+import org.apache.jena.sparql.path.PathCompiler;
+import org.apache.jena.sparql.path.PathLib;
 
 /**
- * Perform the equivalent of the transactions in the SPARQL 1.1 spec. ARQ
- * regards path transformation as an optimization. ARQ does not execute the
- * exact transformation as per spec as there are better ways to do it for ARQ.
- * For example,
+ * Perform the equivalent of the transactions in the SPARQL 1.1 spec. ARQ 
regards
+ * path transformation as an optimization. ARQ does not execute the exact
+ * transformation as per spec as there are better ways to do it for ARQ. For 
example,
  * <ul>
  * <li>Path seq {@literal ->} BGPs or a (sequence)
  * <li>"|" is not expanded into a union.
  * </ul>
  */
 
-public class TransformPathFlatten extends TransformCopy
-{
-    // This transform is also used so programmatically built queries also get 
converted.
-    // Need previous BGP for merging?  Do as a separate pass (sequence, BGP 
collapse)
+public class TransformPathFlatten extends TransformCopy {
+    // This transform is also used so programmatically built queries also get
+    // converted.
+    // Need previous BGP for merging? Do as a separate pass (sequence, BGP 
collapse)
 
-    private PathCompiler pathCompiler ;
+    private PathCompiler pathCompiler;
 
-    public TransformPathFlatten() { this(new PathCompiler()) ; }
+    public TransformPathFlatten() {
+        this(new PathCompiler());
+    }
 
-    public TransformPathFlatten(PathCompiler pathCompiler)
-    {
-        this.pathCompiler = pathCompiler ;
+    public TransformPathFlatten(PathCompiler pathCompiler) {
+        this.pathCompiler = pathCompiler;
     }
 
     @Override
-    public Op transform(OpPath opPath)
-    {
+    public Op transform(OpPath opPath) {
         // Flatten down to triples where possible.
-        PathBlock pattern = pathCompiler.reduce(opPath.getTriplePath()) ;
+        PathBlock pattern = pathCompiler.reduce(opPath.getTriplePath());
         // Any generated paths of exactly one to triple; convert to Op.
-        return PathLib.pathToTriples(pattern) ;
+        return PathLib.pathToTriples(pattern);
     }
 }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraph.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraph.java
index 57223fdf27..db6926410c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraph.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraph.java
@@ -16,20 +16,20 @@
  * limitations under the License.
  */
 
-package org.apache.jena.sparql.core ;
+package org.apache.jena.sparql.core;
 
-import java.util.Iterator ;
+import java.util.Iterator;
 import java.util.stream.Stream;
 
 import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.atlas.lib.Closeable ;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.query.Dataset ;
+import org.apache.jena.atlas.lib.Closeable;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.query.Dataset;
 import org.apache.jena.riot.system.PrefixMap;
-import org.apache.jena.shared.Lock ;
-import org.apache.jena.sparql.util.Context ;
+import org.apache.jena.shared.Lock;
+import org.apache.jena.sparql.util.Context;
 
 /** DatasetGraph: The graph representation of an RDF Dataset. See {@link 
Dataset}
  * for the Model level of an RDF dataset.
@@ -43,13 +43,13 @@ public interface DatasetGraph extends Transactional, 
Closeable
     // ---- Graph container view
 
     /** Get the default graph as a Jena Graph */
-    public Graph getDefaultGraph() ;
+    public Graph getDefaultGraph();
 
     /** Get the graph named by graphNode : returns null when there is no such 
graph.
      * NB Whether a dataset contains a graph if there are no triples is not 
defined - see the specific implementation.
      * Some datasets are "open" - they have all graphs even if no triples.
      */
-    public Graph getGraph(Node graphNode) ;
+    public Graph getGraph(Node graphNode);
 
     /**
      * Return a {@link Graph} that is the union of all named graphs in this 
dataset. This
@@ -67,7 +67,7 @@ public interface DatasetGraph extends Transactional, Closeable
      * @param graphNode
      * @return boolean
      */
-    public boolean containsGraph(Node graphNode) ;
+    public boolean containsGraph(Node graphNode);
 
     /**
      * Add the given graph to the dataset.
@@ -75,26 +75,26 @@ public interface DatasetGraph extends Transactional, 
Closeable
      * get the graph and add triples to it, or add quads to the dataset.
      * Do not assume that the same Java object is returned by {@link #getGraph}
      */
-    public void addGraph(Node graphName, Graph graph) ;
+    public void addGraph(Node graphName, Graph graph);
 
     /** Remove all data associated with the named graph.
      * This will include prefixes associated with the graph.
      */
-    public void removeGraph(Node graphName) ;
+    public void removeGraph(Node graphName);
 
     /** Iterate over all names of named graphs */
-    public Iterator<Node> listGraphNodes() ;
+    public Iterator<Node> listGraphNodes();
 
     // ---- Quad view
 
     /** Add a quad */
-    public void add(Quad quad) ;
+    public void add(Quad quad);
 
     /** Delete a quad */
-    public void delete(Quad quad) ;
+    public void delete(Quad quad);
 
     /** Add a quad */
-    public void add(Node g, Node s, Node p, Node o) ;
+    public void add(Node g, Node s, Node p, Node o);
 
     /** Add the {@code src} DatasetGraph to this one. */
     public default void addAll(DatasetGraph src) {
@@ -102,10 +102,10 @@ public interface DatasetGraph extends Transactional, 
Closeable
     }
 
     /** Delete a quad */
-    public void delete(Node g, Node s, Node p, Node o) ;
+    public void delete(Node g, Node s, Node p, Node o);
 
     /** Delete any quads matching the pattern */
-    public void deleteAny(Node g, Node s, Node p, Node o) ;
+    public void deleteAny(Node g, Node s, Node p, Node o);
 
     /** Iterate over all quads in the dataset graph */
     public default Iterator<Quad> find() {
@@ -115,17 +115,17 @@ public interface DatasetGraph extends Transactional, 
Closeable
     /** Find matching quads in the dataset - may include wildcards, Node.ANY 
or null
      * @see Graph#find(Triple)
      */
-    public Iterator<Quad> find(Quad quad) ;
+    public Iterator<Quad> find(Quad quad);
 
     /** Find matching quads in the dataset (including default graph) - may 
include wildcards, Node.ANY or null
      * @see Graph#find(Node,Node,Node)
      */
-    public Iterator<Quad> find(Node g, Node s, Node p , Node o) ;
+    public Iterator<Quad> find(Node g, Node s, Node p , Node o);
 
     /** Find matching quads in the dataset in named graphs only - may include 
wildcards, Node.ANY or null
      * @see Graph#find(Node,Node,Node)
      */
-    public Iterator<Quad> findNG(Node g, Node s, Node p , Node o) ;
+    public Iterator<Quad> findNG(Node g, Node s, Node p , Node o);
 
     /** Returns a {@link Stream} of {@link Quad Quads} matching a pattern.
      *
@@ -144,31 +144,31 @@ public interface DatasetGraph extends Transactional, 
Closeable
     }
 
     /** Test whether the dataset (including default graph) contains a quad - 
may include wildcards, Node.ANY or null */
-    public boolean contains(Node g, Node s, Node p , Node o) ;
+    public boolean contains(Node g, Node s, Node p , Node o);
 
     /** Test whether the dataset contains a quad (including default graph)- 
may include wildcards, Node.ANY or null */
-    public boolean contains(Quad quad) ;
+    public boolean contains(Quad quad);
 
     /** Remove everything - remove all named graphs, clear the default graph */
-    public void clear() ;
+    public void clear();
 
     /** Test whether the dataset is empty */
-    public boolean isEmpty() ;
+    public boolean isEmpty();
 
     /** Return a lock for the dataset to help with concurrency control
      * @see Lock
      */
-    public Lock getLock() ;
+    public Lock getLock();
 
     /** Get the context associated with this object - may be null */
-    public Context getContext() ;
+    public Context getContext();
 
     /** Get the size (number of named graphs) - may be -1 for unknown */
-    public long size() ;
+    public long size();
 
     /** Close the dataset */
     @Override
-    public void close() ;
+    public void close();
 
     /** Prefixes for this DatasetGraph */
     public PrefixMap prefixes();
@@ -184,7 +184,7 @@ public interface DatasetGraph extends Transactional, 
Closeable
      * See {@link #supportsTransactionAbort()} for {@link #abort}.
      * In addition, check details of a specific implementation.
      */
-    public boolean supportsTransactions() ;
+    public boolean supportsTransactions();
 
     /** Declare whether {@link #abort} is supported.
      *  This goes along with clearing up after exceptions inside application 
transaction code.
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/path/PathCompiler.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/path/PathCompiler.java
index bee6376f11..5a8657c084 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/path/PathCompiler.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/path/PathCompiler.java
@@ -18,151 +18,138 @@
 
 package org.apache.jena.sparql.path;
 
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.sparql.ARQConstants ;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.sparql.ARQConstants;
 import org.apache.jena.sparql.ARQException;
 import org.apache.jena.sparql.algebra.optimize.TransformPathFlattenAlgebra;
 import org.apache.jena.sparql.algebra.optimize.TransformPathFlatten;
-import org.apache.jena.sparql.core.PathBlock ;
-import org.apache.jena.sparql.core.TriplePath ;
+import org.apache.jena.sparql.core.PathBlock;
+import org.apache.jena.sparql.core.TriplePath;
 import org.apache.jena.sparql.core.Var;
-import org.apache.jena.sparql.core.VarAlloc ;
+import org.apache.jena.sparql.core.VarAlloc;
 
-public class PathCompiler
-{
+public class PathCompiler {
     // Convert to work on OpPath.
     // Need pre (and post) BGPs.
 
-    private static VarAlloc varAlloc = new 
VarAlloc(ARQConstants.allocPathVariables) ;
+    private VarAlloc varAlloc = new VarAlloc(ARQConstants.allocPathVariables);
 
     /** Testing use only. */
-    public static void resetForTest() {  varAlloc = new 
VarAlloc(ARQConstants.allocPathVariables) ; }
+    public static void resetForTest() {
+        //varAlloc = new VarAlloc(ARQConstants.allocPathVariables);
+    }
+
+    public PathCompiler() {}
 
+    // Assumes one PathCompiler per query so that the varAlloc is per query.
+    // See TransformPathFlatten
+    //
     // Move to AlgebraCompiler and have a per-transaction scoped var generator
 
     // ---- Syntax-based
 
-    /** Simplify : turns constructs in simple triples and simpler TriplePaths 
where possible */
-    public PathBlock reduce(PathBlock pathBlock)
-    {
-        PathBlock x = new PathBlock() ;
+    /**
+     * Simplify : turns constructs in simple triples and simpler TriplePaths 
where
+     * possible
+     */
+    public PathBlock reduce(PathBlock pathBlock) {
+        PathBlock x = new PathBlock();
         // No context during algebra generation time.
-//        VarAlloc varAlloc = VarAlloc.get(context, 
ARQConstants.sysVarAllocNamed) ;
-//        if ( varAlloc == null )
-//            // Panic
-//            throw new ARQInternalErrorException("No execution-scope 
allocator for variables") ;
+        //        VarAlloc varAlloc = VarAlloc.get(context, 
ARQConstants.sysVarAllocNamed) ;
+        //        if ( varAlloc == null )
+        //            // Panic
+        //            throw new ARQInternalErrorException("No execution-scope 
allocator for variables") ;
 
         // Translate one into another.
-        reduce(x, pathBlock, varAlloc) ;
-        return x ;
+        reduce(x, pathBlock, varAlloc);
+        return x;
     }
 
-    void reduce(PathBlock x, PathBlock pathBlock, VarAlloc varAlloc )
-    {
-        for ( TriplePath tp : pathBlock )
-        {
-            if ( tp.isTriple() )
-            {
-                x.add(tp) ;
-                continue ;
+    void reduce(PathBlock x, PathBlock pathBlock, VarAlloc varAlloc) {
+        for ( TriplePath tp : pathBlock ) {
+            if ( tp.isTriple() ) {
+                x.add(tp);
+                continue;
             }
-            reduce(x, varAlloc, tp.getSubject(), tp.getPath(), tp.getObject()) 
;
+            reduce(x, varAlloc, tp.getSubject(), tp.getPath(), tp.getObject());
         }
     }
 
     /**
      * Algebra-based transformation.
      * <p>
-     * Does not include "|", this method is called by {@link 
TransformPathFlatten}. See
-     * {@link TransformPathFlattenAlgebra} for union expansion.
+     * Does not include "|", this method is called by {@link 
TransformPathFlatten}.
+     * See {@link TransformPathFlattenAlgebra} for union expansion.
      * </p>
      */
-    public PathBlock reduce(TriplePath triplePath)
-    {
-        PathBlock x = new PathBlock() ;
-        reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), 
triplePath.getObject()) ;
-        return x ;
+    public PathBlock reduce(TriplePath triplePath) {
+        PathBlock x = new PathBlock();
+        reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), 
triplePath.getObject());
+        return x;
     }
 
-    public PathBlock reduce(Node start, Path path, Node finish)
-    {
-        PathBlock x = new PathBlock() ;
-        reduce(x, varAlloc, start, path, finish) ;
-        return x ;
+    public PathBlock reduce(Node start, Path path, Node finish) {
+        PathBlock x = new PathBlock();
+        reduce(x, varAlloc, start, path, finish);
+        return x;
     }
 
-    private static void reduce(PathBlock x, VarAlloc varAlloc, Node startNode, 
Path path, Node endNode)
-    {
-        // V-i-s-i-t-o-r!
-
-        if ( path instanceof P_Link )
-        {
-            Node pred = ((P_Link)path).getNode() ;
-            Triple t = Triple.create(startNode, pred, endNode) ;
-            x.add(new TriplePath(t)) ;
-            return ;
+    private static void reduce(PathBlock x, VarAlloc varAlloc, Node startNode, 
Path path, Node endNode) {
+        if ( path instanceof P_Link pLink) {
+            Node pred = pLink.getNode();
+            Triple t = Triple.create(startNode, pred, endNode);
+            x.add(new TriplePath(t));
+            return;
         }
 
-        if ( path instanceof P_Seq )
-        {
-            P_Seq ps = (P_Seq)path ;
-            Node v = varAlloc.allocVar() ;
-            if ( Var.isVar(startNode) && ! Var.isVar(endNode) ) {
+        if ( path instanceof P_Seq pSeq) {
+            Node v = varAlloc.allocVar();
+            if ( Var.isVar(startNode) && !Var.isVar(endNode) ) {
                 // start at the grounded term.
-                reduce(x, varAlloc, v, ps.getRight(), endNode) ;
-                reduce(x, varAlloc, startNode, ps.getLeft(), v) ;
+                reduce(x, varAlloc, v, pSeq.getRight(), endNode);
+                reduce(x, varAlloc, startNode, pSeq.getLeft(), v);
             } else {
-                reduce(x, varAlloc, startNode, ps.getLeft(), v) ;
-                reduce(x, varAlloc, v, ps.getRight(), endNode) ;
+                reduce(x, varAlloc, startNode, pSeq.getLeft(), v);
+                reduce(x, varAlloc, v, pSeq.getRight(), endNode);
             }
-            return ;
+            return;
         }
 
-        if ( path instanceof P_Inverse )
-        {
-            reduce(x, varAlloc, endNode, ((P_Inverse)path).getSubPath(), 
startNode) ;
-            return ;
+        if ( path instanceof P_Inverse pInverse) {
+            reduce(x, varAlloc, endNode, pInverse.getSubPath(), startNode);
+            return;
         }
 
-        if ( path instanceof P_FixedLength )
-        {
-            P_FixedLength pFixed = (P_FixedLength)path ;
-            long N = pFixed.getCount() ;
-            if ( N > 0 )
-            {
+        if ( path instanceof P_FixedLength pFixedLen ) {
+            long N = pFixedLen.getCount();
+            if ( N > 0 ) {
                 // Don't do {0}
-                Node stepStart = startNode ;
+                Node stepStart = startNode;
 
-                for ( long i = 0 ; i < N-1 ; i++ )
-                {
-                    Node v = varAlloc.allocVar() ;
-                    reduce(x, varAlloc, stepStart, pFixed.getSubPath(), v) ;
-                    stepStart = v ;
+                for ( long i = 0 ; i < N - 1 ; i++ ) {
+                    Node v = varAlloc.allocVar();
+                    reduce(x, varAlloc, stepStart, pFixedLen.getSubPath(), v);
+                    stepStart = v;
                 }
-                reduce(x, varAlloc, stepStart, pFixed.getSubPath(), endNode) ;
-                return ;
+                reduce(x, varAlloc, stepStart, pFixedLen.getSubPath(), 
endNode);
+                return;
             }
         }
 
-        if ( path instanceof P_Mod )
-        {
-            P_Mod pMod = (P_Mod)path ;
-            if ( pMod.isFixedLength() && pMod.getFixedLength() > 0 )
-            {
-                long N = pMod.getFixedLength() ;
-                if ( N > 0 )
-                {
-                    Node stepStart = startNode ;
-
-                    for ( long i = 0 ; i < N-1 ; i++ )
-                    {
-                        Node v = varAlloc.allocVar() ;
-                        reduce(x, varAlloc, stepStart, pMod.getSubPath(), v) ;
-                        stepStart = v ;
+        if ( path instanceof P_Mod pMod ) {
+            if ( pMod.isFixedLength() && pMod.getFixedLength() > 0 ) {
+                long N = pMod.getFixedLength();
+                if ( N > 0 ) {
+                    Node stepStart = startNode;
+
+                    for ( long i = 0 ; i < N - 1 ; i++ ) {
+                        Node v = varAlloc.allocVar();
+                        reduce(x, varAlloc, stepStart, pMod.getSubPath(), v);
+                        stepStart = v;
                     }
-                    reduce(x, varAlloc, stepStart, pMod.getSubPath(), endNode) 
;
-                    return ;
+                    reduce(x, varAlloc, stepStart, pMod.getSubPath(), endNode);
+                    return;
                 }
             }
 
@@ -173,45 +160,40 @@ public class PathCompiler
             //   {n} union {n+1} union ... union {m}
             // which leads to a lot of repeated work.
 
-            if ( pMod.getMin() > 0 )
-            {
-                Path p1 = PathFactory.pathFixedLength(pMod.getSubPath(), 
pMod.getMin()) ;
-                Path p2 ;
+            if ( pMod.getMin() > 0 ) {
+                Path p1 = PathFactory.pathFixedLength(pMod.getSubPath(), 
pMod.getMin());
+                Path p2;
 
                 if ( pMod.getMax() < 0 )
-                    p2 = PathFactory.pathZeroOrMoreN(pMod.getSubPath()) ;
-                else
-                {
+                    p2 = PathFactory.pathZeroOrMoreN(pMod.getSubPath());
+                else {
                     if ( pMod.getMin() > pMod.getMax() )
                         throw new ARQException("Bad path: " + pMod);
 
-                    long len2 = pMod.getMax()-pMod.getMin() ;
-                    if ( len2 < 0 ) len2 = 0 ;
-                    p2 = PathFactory.pathMod(pMod.getSubPath(),0, len2) ;
+                    long len2 = pMod.getMax() - pMod.getMin();
+                    if ( len2 < 0 )
+                        len2 = 0;
+                    p2 = PathFactory.pathMod(pMod.getSubPath(), 0, len2);
                 }
 
-                Node v = varAlloc.allocVar() ;
+                Node v = varAlloc.allocVar();
 
                 // Start at the fixed end.
-                if ( ! startNode.isVariable() || endNode.isVariable() )
-                {
-                    reduce(x, varAlloc, startNode, p1, v) ;
-                    reduce(x, varAlloc, v, p2, endNode) ;
-                }
-                else
-                {
+                if ( !startNode.isVariable() || endNode.isVariable() ) {
+                    reduce(x, varAlloc, startNode, p1, v);
+                    reduce(x, varAlloc, v, p2, endNode);
+                } else {
                     // endNode fixed, start node not.
-                    reduce(x, varAlloc, v, p2, endNode) ;
-                    reduce(x, varAlloc, startNode, p1, v) ;
+                    reduce(x, varAlloc, v, p2, endNode);
+                    reduce(x, varAlloc, startNode, p1, v);
                 }
-                return ;
+                return;
             }
 
-
             // Else drop through
         }
 
         // Nothing can be done.
-        x.add(new TriplePath(startNode, path, endNode)) ;
+        x.add(new TriplePath(startNode, path, endNode));
     }
 }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java
index dd3672cab4..c239bdb7f6 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/sse/writers/WriterOp.java
@@ -105,7 +105,7 @@ public class WriterOp
     }
 
     // Without the base/prefix wrapper.
-    static void outputNoPrologue(final IndentedWriter iWriter, final Op op, 
final SerializationContext sCxt) {
+    public static void outputNoPrologue(final IndentedWriter iWriter, final Op 
op, final SerializationContext sCxt) {
         OpWriterWorker v = new OpWriterWorker(iWriter, sCxt);
         op.visit(v);
     }
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java 
b/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
index b49de18ed5..8f3fa9ec0b 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_Core.java
@@ -49,4 +49,3 @@ import org.junit.runners.Suite ;
 
 public class TS_Core
 {}
-
diff --git a/jena-core/src/main/java/org/apache/jena/graph/compose/Delta.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/Delta.java
index b34251c5c2..373b4851aa 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Delta.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Delta.java
@@ -16,33 +16,29 @@
  * limitations under the License.
  */
 
-package org.apache.jena.graph.compose ;
+package org.apache.jena.graph.compose;
 
-import org.apache.jena.graph.Capabilities ;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.graph.impl.GraphPlain ;
-import org.apache.jena.graph.impl.SimpleEventManager ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.graph.Capabilities;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.graph.impl.GraphPlain;
+import org.apache.jena.graph.impl.SimpleEventManager;
+import org.apache.jena.util.iterator.ExtendedIterator;
 
 /**
- * Graph operation for wrapping a base graph and leaving it unchanged while
- * recording all the attempted updates for later access.
- * 
- * The behavior of this class is not well defined if triples are added to or
- * removed from the base graph, the additions graph, or the deletions graph
- * while this graph is in use.
+ * Graph operation for wrapping a base graph and leaving it unchanged while 
recording
+ * all the attempted updates for later access. The behavior of this class is 
not well
+ * defined if triples are added to or removed from the base graph, the 
additions
+ * graph, or the deletions graph while this graph is in use.
  */
 
-public class Delta extends CompositionBase implements Graph
-{
-    private Graph base ;
-    private Graph additions ;
-    private Graph deletions ;
+public class Delta extends CompositionBase implements Graph {
+    private Graph base;
+    private Graph additions;
+    private Graph deletions;
 
-    public Delta(Graph base)
-    {
-        super() ;
+    public Delta(Graph base) {
+        super();
         this.base = GraphPlain.plain(base);
         this.additions = GraphPlain.plain();
         this.deletions = GraphPlain.plain();
@@ -50,72 +46,65 @@ public class Delta extends CompositionBase implements Graph
 
     @Override
     public Capabilities getCapabilities() {
-        // Not stricly accurate.
+        // Not strictly accurate.
         return base.getCapabilities();
     }
 
     /**
      * Answer the graph of all triples added.
      */
-    public Graph getAdditions()
-    {
-        return additions ;
+    public Graph getAdditions() {
+        return additions;
     }
 
     /**
      * Answer the graph of all triples removed.
      */
-    public Graph getDeletions()
-    {
-        return deletions ;
+    public Graph getDeletions() {
+        return deletions;
     }
 
     /**
-     * Add the triple to the graph, ie add it to the additions, remove it from
-     * the removals.
+     * Add the triple to the graph, ie add it to the additions, remove it from 
the
+     * removals.
      */
     @Override
-    public void performAdd(Triple t)
-    {
-        if (!base.contains(t))
-            additions.add(t) ;
-        deletions.delete(t) ;
+    public void performAdd(Triple t) {
+        if ( !base.contains(t) )
+            additions.add(t);
+        deletions.delete(t);
     }
 
     /**
      * Remove the triple, ie, remove it from the adds, add it to the removals.
      */
     @Override
-    public void performDelete(Triple t)
-    {
-        additions.delete(t) ;
-        if (base.contains(t))
-            deletions.add(t) ;
+    public void performDelete(Triple t) {
+        additions.delete(t);
+        if ( base.contains(t) )
+            deletions.add(t);
     }
 
     /**
-     * Find all the base triples matching tm, exclude the ones that are 
deleted,
-     * add the ones that have been added.
+     * Find all the base triples matching tm, exclude the ones that are 
deleted, add
+     * the ones that have been added.
      */
     @Override
-    protected ExtendedIterator<Triple> graphBaseFind(Triple t)
-    {
-        ExtendedIterator<Triple> iterator = 
base.find(t).filterDrop(deletions::contains).andThen(additions.find(t)) ;
-        return SimpleEventManager.notifyingRemove( this, iterator ) ;
+    protected ExtendedIterator<Triple> graphBaseFind(Triple t) {
+        ExtendedIterator<Triple> iterator = 
base.find(t).filterDrop(deletions::contains).andThen(additions.find(t));
+        return SimpleEventManager.notifyingRemove(this, iterator);
     }
 
     @Override
-    public void close()
-    {
-        super.close() ;
-        base.close() ;
-        additions.close() ;
-        deletions.close() ;
+    public void close() {
+        super.close();
+        base.close();
+        additions.close();
+        deletions.close();
     }
 
     @Override
-    public int graphBaseSize()
-    {
-        return base.size() + additions.size() - deletions.size() ;
+    public int graphBaseSize() {
+        return base.size() + additions.size() - deletions.size();
     }
 }
diff --git 
a/jena-core/src/main/java/org/apache/jena/graph/compose/Difference.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/Difference.java
index e37f40e7d4..dc30701901 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Difference.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Difference.java
@@ -18,38 +18,43 @@
 
 package org.apache.jena.graph.compose;
 
-import org.apache.jena.graph.* ;
-import org.apache.jena.util.iterator.* ;
+import org.apache.jena.graph.*;
+import org.apache.jena.util.iterator.*;
 
 /**
-    Class representing the dynamic set difference L - R of two graphs. This is 
updatable;
-    the updates are written through to one or other of the base graphs.
-*/
-public class Difference extends Dyadic implements Graph 
-       {
+ * Class representing the dynamic set difference L - R of two graphs. This is
+ * updatable; the updates are written through to one or other of the base 
graphs.
+ */
+public class Difference extends Dyadic implements Graph {
     /**
-        Initialise a graph representing the difference L - R.
-    */
-       public Difference( Graph L, Graph R )
-               { super( L, R ); }
-               
+     * Initialise a graph representing the difference L - R.
+     */
+    public Difference(Graph L, Graph R) {
+        super(L, R);
+    }
+
     /**
-        Add a triple to the difference: add it to the left operand, and remove 
it from the 
-        right operand.
-    */
-       @Override public void performAdd( Triple t )
-               {
-               L.add( t );
-               R.delete( t );
-               }
+     * Add a triple to the difference: add it to the left operand, and remove 
it from
+     * the right operand.
+     */
+    @Override
+    public void performAdd(Triple t) {
+        L.add(t);
+        R.delete(t);
+    }
 
     /**
-        Remove a triple from the difference: remove it from the left operand. 
[It could
-        be added to the right operand instead, but somehow that feels less 
satisfactory.]
-    */
-       @Override public void performDelete( Triple t )
-               { L.delete( t ); }
+     * Remove a triple from the difference: remove it from the left operand. 
[It
+     * could be added to the right operand instead, but somehow that feels less
+     * satisfactory.]
+     */
+    @Override
+    public void performDelete(Triple t) {
+        L.delete(t);
+    }
 
-       @Override public ExtendedIterator<Triple> _graphBaseFind( Triple t ) 
-               { return L.find( t ). filterDrop ( ifIn( R ) ); }
-       }
+    @Override
+    public ExtendedIterator<Triple> _graphBaseFind(Triple t) {
+        return L.find(t).filterDrop(ifIn(R));
+    }
+}
diff --git 
a/jena-core/src/main/java/org/apache/jena/graph/compose/DisjointUnion.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/DisjointUnion.java
index a296a0dfda..378552de95 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/DisjointUnion.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/DisjointUnion.java
@@ -18,31 +18,40 @@
 
 package org.apache.jena.graph.compose;
 
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.util.iterator.ExtendedIterator;
 
 /**
-     DisjointUnion - a version of Union that assumes the graphs are disjoint, 
and
-     hence that <code>find</code> need not do duplicate-removal. Adding things
-     to the graph adds them to the left component, and does <i>not</i> add
-     triples that are already in the right component.
-     
-*/
-public class DisjointUnion extends Dyadic
-    {
-    public DisjointUnion( Graph L, Graph R )
-        { super( L, R ); }
+ * DisjointUnion - a version of Union that assumes the graphs are disjoint, 
and hence
+ * that <code>find</code> need not do duplicate-removal. Adding things to the 
graph
+ * adds them to the left component, and does <i>not</i> add triples that are 
already
+ * in the right component.
+ */
+public class DisjointUnion extends Dyadic {
+    public DisjointUnion(Graph L, Graph R) {
+        super(L, R);
+    }
+
+    @Override
+    protected ExtendedIterator<Triple> _graphBaseFind(Triple m) {
+        return L.find(m).andThen(R.find(m));
+    }
+
+    @Override
+    public boolean graphBaseContains(Triple t) {
+        return L.contains(t) || R.contains(t);
+    }
+
+    @Override
+    public void performDelete(Triple t) {
+        L.delete(t);
+        R.delete(t);
+    }
 
-    @Override protected ExtendedIterator<Triple> _graphBaseFind( Triple m )
-        { return L.find( m ) .andThen( R.find( m ) ); }
-    
-    @Override public boolean graphBaseContains( Triple t )
-        { return L.contains( t ) || R.contains( t ); }
-    
-    @Override public void performDelete( Triple t )
-        { L.delete( t ); R.delete( t ); }
-    
-    @Override public void performAdd( Triple t )
-        { if (!R.contains( t )) L.add( t ); }
+    @Override
+    public void performAdd(Triple t) {
+        if ( !R.contains(t) )
+            L.add(t);
     }
+}
diff --git a/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
index 4437b6d69e..f266bf80ae 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Dyadic.java
@@ -18,79 +18,75 @@
 
 package org.apache.jena.graph.compose;
 
-import org.apache.jena.graph.* ;
-import org.apache.jena.graph.impl.SimpleEventManager ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.graph.*;
+import org.apache.jena.graph.impl.SimpleEventManager;
+import org.apache.jena.util.iterator.ExtendedIterator;
 
 /**
-    Base class for the two-operand composition operations; has two graphs L 
and R
-*/
+ * Base class for the two-operand composition operations; has two graphs L and 
R
+ */
 
-public abstract class Dyadic extends CompositionBase
-       {
-       protected Graph L;
-       protected Graph R;
+public abstract class Dyadic extends CompositionBase {
+    protected Graph L;
+    protected Graph R;
 
     /**
-        When the graph is constructed, copy the prefix mappings of both 
components
-        into this prefix mapping. The prefix mapping doesn't change afterwards 
with the
-        components, which might be regarded as a bug.
-    */
-       public Dyadic( Graph L, Graph R )
-               {
-               this.L = L;
-               this.R = R;
-        getPrefixMapping()
-            .setNsPrefixes( L.getPrefixMapping() )
-            .setNsPrefixes( R.getPrefixMapping() )
-            ;
-               }
-
+     * When the graph is constructed, copy the prefix mappings of both 
components
+     * into this prefix mapping. The prefix mapping doesn't change afterwards 
with
+     * the components, which might be regarded as a bug.
+     */
+    public Dyadic(Graph L, Graph R) {
+        this.L = L;
+        this.R = R;
+        
getPrefixMapping().setNsPrefixes(L.getPrefixMapping()).setNsPrefixes(R.getPrefixMapping());
+    }
 
-       /**
-        * override graphBaseFind to return an iterator that will report when
-        * a deletion occurs.
-        */
-       @Override
-    protected final ExtendedIterator<Triple> graphBaseFind( Triple m )
-    {
-               return SimpleEventManager.notifyingRemove( this, 
this._graphBaseFind( m ) );
+    /**
+     * override graphBaseFind to return an iterator that will report when a 
deletion
+     * occurs.
+     */
+    @Override
+    protected final ExtendedIterator<Triple> graphBaseFind(Triple m) {
+        return SimpleEventManager.notifyingRemove(this, 
this._graphBaseFind(m));
     }
 
-       /**
-        * The method that the overridden graphBaseFind( Triple t ) calls to 
actually
-        * do the work of finding.
-        */
-       protected abstract ExtendedIterator<Triple> _graphBaseFind( Triple t );
+    /**
+     * The method that the overridden graphBaseFind( Triple t ) calls to 
actually do
+     * the work of finding.
+     */
+    protected abstract ExtendedIterator<Triple> _graphBaseFind(Triple t);
 
     @Override
-    public void close()
-       {
-       L.close();
-       R.close();
-       this.closed = true;
-        }
+    public void close() {
+        L.close();
+        R.close();
+        this.closed = true;
+    }
 
     /**
-        Generic dependsOn, true iff it depends on either of the subgraphs.
-    */
+     * Generic dependsOn, true iff it depends on either of the subgraphs.
+     */
     @Override
-    public boolean dependsOn( Graph other )
-        { return other == this || L.dependsOn( other ) || R.dependsOn( other 
); }
+    public boolean dependsOn(Graph other) {
+        return other == this || L.dependsOn(other) || R.dependsOn(other);
+    }
 
-    public Union union( Graph X )
-        { return new Union( this, X ); }
+    public Union union(Graph X) {
+        return new Union(this, X);
+    }
 
     /**
-         Answer the left (first) operand of this Dyadic.
-    */
-    public Graph getL()
-        { return L; }
+     * Answer the left (first) operand of this Dyadic.
+     */
+    public Graph getL() {
+        return L;
+    }
 
     /**
-         Answer the right (second) operand of this Dyadic.
-    */
-    public Graph getR()
-        { return R; }
-
+     * Answer the right (second) operand of this Dyadic.
+     */
+    public Graph getR() {
+        return R;
     }
+
+}
diff --git 
a/jena-core/src/main/java/org/apache/jena/graph/compose/Intersection.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/Intersection.java
index 90bfcb573f..ef754da48f 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Intersection.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Intersection.java
@@ -18,7 +18,7 @@
 
 /*
     INSERT HP DISCLAIMER HERE
-    
+
     Dynamic intersection, May 2002, hedgehog
 */
 
@@ -31,26 +31,25 @@ import org.apache.jena.util.iterator.* ;
 /**
     The dynamic intersection of two graphs L and R. <code>add()</code> affects 
both L and R, whereas <code>delete()</code> affects L only.
 */
-public class Intersection extends Dyadic implements Graph
-       {
-       public Intersection( Graph L, Graph R )
-           {
-           super( L, R );
-           }
-           
-       @Override public void performAdd( Triple t )
-           {
-           L.add( t );
-           R.add( t );
-           }
-
-       @Override public void performDelete( Triple t )
-               {
-               if (this.contains( t )) L.delete( t );
-               }
-               
-       @Override protected ExtendedIterator<Triple> _graphBaseFind( Triple s )
-               {
-        return L.find( s ) .filterKeep(  ifIn( R ) );
-               }
-       }
+public class Intersection extends Dyadic implements Graph {
+    public Intersection(Graph L, Graph R) {
+        super(L, R);
+    }
+
+    @Override
+    public void performAdd(Triple t) {
+        L.add(t);
+        R.add(t);
+    }
+
+    @Override
+    public void performDelete(Triple t) {
+        if ( this.contains(t) )
+            L.delete(t);
+    }
+
+    @Override
+    protected ExtendedIterator<Triple> _graphBaseFind(Triple s) {
+        return L.find(s).filterKeep(ifIn(R));
+    }
+}
diff --git 
a/jena-core/src/main/java/org/apache/jena/graph/compose/MultiUnion.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/MultiUnion.java
index 697098e4f6..7f00e5261a 100755
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/MultiUnion.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/MultiUnion.java
@@ -48,7 +48,6 @@ public class MultiUnion extends Polyadic
         super();
     }
 
-
     /**
      * <p>
      * Construct a union of all of the given graphs
@@ -60,7 +59,6 @@ public class MultiUnion extends Polyadic
         super( graphs );
     }
 
-
     /**
      * <p>
      * Construct a union of all of the given graphs.
@@ -108,26 +106,24 @@ public class MultiUnion extends Polyadic
         getRequiredBaseGraph().delete( t );
     }
 
-
     /**
      * <p>
-     * Answer true if at least one of the graphs in this union contain the 
given triple.
+     * Answer true if at least one of the graphs in this union contain the 
given
+     * triple.
      * </p>
      *
      * @param t A triple
      * @return True if any of the graphs in the union contain t
      */
-    @Override  public boolean graphBaseContains( Triple t )
-        {
-            for ( Graph m_subGraph : m_subGraphs )
-            {
-                if ( m_subGraph.contains( t ) )
-                {
-                    return true;
-                }
+    @Override
+    public boolean graphBaseContains(Triple t) {
+        for ( Graph m_subGraph : m_subGraphs ) {
+            if ( m_subGraph.contains(t) ) {
+                return true;
             }
-        return false;
         }
+        return false;
+    }
 
     /**
      * <p>
@@ -149,29 +145,27 @@ public class MultiUnion extends Polyadic
          Answer the result of <code>find( t )</code> on the single graph in
          this union.
     */
-    private ExtendedIterator<Triple> singleGraphFind( final Triple t )
-        { return (m_subGraphs.get( 0 )).find(  t  ); }
-
+    private ExtendedIterator<Triple> singleGraphFind(final Triple t) {
+        return (m_subGraphs.get(0)).find(t);
+    }
 
     /**
      * Answer the concatenation of all the iterators from a-subGraph.find( t ).
      */
-    private ExtendedIterator<Triple> multiGraphFind(final Triple t)
-    {
-        Set<Triple> seen = CollectionFactory.createHashedSet() ;
-        ExtendedIterator<Triple> result = NullIterator.instance() ;
-        boolean finished = false ;
+    private ExtendedIterator<Triple> multiGraphFind(final Triple t) {
+        Set<Triple> seen = CollectionFactory.createHashedSet();
+        ExtendedIterator<Triple> result = NullIterator.instance();
+        boolean finished = false;
         try {
-            for ( Graph m_subGraph : m_subGraphs )
-            {
-                ExtendedIterator<Triple> newTriples = recording( rejecting( 
m_subGraph.find( t ), seen ), seen );
-                result = result.andThen( newTriples );
+            for ( Graph m_subGraph : m_subGraphs ) {
+                ExtendedIterator<Triple> newTriples = 
recording(rejecting(m_subGraph.find(t), seen), seen);
+                result = result.andThen(newTriples);
             }
-            finished = true ;
-            return result ;
+            finished = true;
+            return result;
         } finally { // Throwable happened.
-            if (!finished)
-                result.close() ;
+            if ( !finished )
+                result.close();
         }
     }
 
diff --git a/jena-core/src/main/java/org/apache/jena/graph/compose/Union.java 
b/jena-core/src/main/java/org/apache/jena/graph/compose/Union.java
index 7375b61e50..82eb6bf915 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/compose/Union.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/compose/Union.java
@@ -26,43 +26,43 @@ import org.apache.jena.util.CollectionFactory ;
 import org.apache.jena.util.iterator.ExtendedIterator ;
 
 /**
-    A class representing the dynamic union of two graphs. Addition only 
affects the left 
-    operand, deletion affects both. 
+    A class representing the dynamic union of two graphs. Addition only 
affects the left
+    operand, deletion affects both.
     @see MultiUnion
 */
 
-public class Union extends Dyadic implements Graph 
-       {
-       public Union( Graph L, Graph R )
-               { super( L, R ); }
-               
+public class Union extends Dyadic implements Graph
+{
+    public Union( Graph L, Graph R )
+    { super( L, R ); }
+
     /**
         To add a triple to the union, add it to the left operand; this is 
asymmetric.
-    */
-       @Override public void performAdd( Triple t )
-               { L.add( t ); }
+     */
+    @Override public void performAdd( Triple t )
+    { L.add( t ); }
 
     /**
         To remove a triple, remove it from <i>both</i> operands.
-    */
-       @Override public void performDelete( Triple t )
-               {
-               L.delete( t );
-               R.delete( t );
-               }
+     */
+    @Override public void performDelete( Triple t )
+    {
+        L.delete( t );
+        R.delete( t );
+    }
 
     @Override public boolean graphBaseContains( Triple t )
-        { return L.contains( t ) || R.contains( t ); }
-        
+    { return L.contains( t ) || R.contains( t ); }
+
     /**
         To find in the union, find in the components, concatenate the results, 
and omit
         duplicates. That last is a performance penalty, but I see no way to 
remove it
         unless we know the graphs do not overlap.
-    */
-       @Override protected ExtendedIterator<Triple> _graphBaseFind( final 
Triple t ) 
-           {
-           Set<Triple> seen = CollectionFactory.createHashedSet();
-        return recording( L.find( t ), seen ).andThen( rejecting( R.find( t ), 
seen ) ); 
-           // return L.find( t ) .andThen( rejecting( R.find( t ), L ) ); 
-               }
-       }
+     */
+    @Override protected ExtendedIterator<Triple> _graphBaseFind( final Triple 
t )
+    {
+        Set<Triple> seen = CollectionFactory.createHashedSet();
+        return recording( L.find( t ), seen ).andThen( rejecting( R.find( t ), 
seen ) );
+        // return L.find( t ) .andThen( rejecting( R.find( t ), L ) );
+    }
+}

Reply via email to