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 28efa58560a29bbc2f55948d68328396608a9aa0
Author: Andy Seaborne <[email protected]>
AuthorDate: Sun May 18 20:47:35 2025 +0100

    Tidy up code
---
 .../java/org/apache/jena/sparql/expr/E_Call.java   | 45 ++++++++++------------
 .../java/org/apache/jena/sparql/expr/ExprNone.java | 17 +++-----
 .../org/apache/jena/sparql/util/graph/GNode.java   | 36 ++++++++---------
 3 files changed, 41 insertions(+), 57 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Call.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Call.java
index 2759af5858..6f777449e3 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Call.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/E_Call.java
@@ -38,34 +38,31 @@ public class E_Call extends ExprFunctionN
     private Expr identExpr;
     private List<Expr> argExprs;
 
-    public E_Call(ExprList args)
-    {
-        this(symbol, args) ;
+    public E_Call(ExprList args) {
+        this(symbol, args);
     }
-    
-    protected E_Call(String sym, ExprList args)
-    {
-        super(sym, args) ;
-        if (args.size() == 0) {
-               identExpr = null;
+
+    protected E_Call(String sym, ExprList args) {
+        super(sym, args);
+        if ( args.size() == 0 ) {
+            identExpr = null;
         } else {
-               identExpr = args.get(0);
-               argExprs = args.getList().subList(1,args.size()) ; 
+            identExpr = args.get(0);
+            argExprs = args.getList().subList(1, args.size());
         }
     }
 
     @Override
-    public NodeValue evalSpecial(Binding binding, FunctionEnv env)
-    {
-        //No argument returns unbound
+    public NodeValue evalSpecial(Binding binding, FunctionEnv env) {
+        // No argument returns unbound
         if (identExpr == null) throw new ExprEvalException("CALL() has no 
arguments");
-        
+
         //One/More arguments means invoke a function dynamically
         NodeValue func = identExpr.eval(binding, env);
         if (func == null) throw new ExprEvalException("CALL: Function 
identifier unbound");
         if (func.isIRI()) {
                Expr e = buildFunction(func.getNode().getURI(), argExprs, 
env.getContext());
-               if (e == null) 
+               if (e == null)
                    throw new ExprEvalException("CALL: Function identifier <" + 
func.getNode().getURI() + "> does not identify a known function");
                //Calling this may throw an error which we will just let bubble 
up
                return e.eval(binding, env);
@@ -73,7 +70,7 @@ public class E_Call extends ExprFunctionN
                throw new ExprEvalException("CALL: Function identifier not an 
IRI");
         }
     }
-    
+
     @Override
     public Expr copy(ExprList newArgs)       { return new E_Call(newArgs) ; }
 
@@ -95,17 +92,17 @@ public class E_Call extends ExprFunctionN
         } else
             throw new ExprEvalException("CALL: Function identifier not an 
IRI");
     }
-    
+
        @Override
        public NodeValue eval(List<NodeValue> args) {
            // eval(List, FunctionEnv) should be called.
                throw new ARQInternalErrorException();
        }
-           
+
        /**
         * Returns the expr representing the dynamic function to be invoked
         * <p>
-        * Uses caching wherever possible to avoid 
+        * Uses caching wherever possible to avoid
         * </p>
         */
     private Expr buildFunction(String functionIRI, List<Expr> args, Context 
cxt)
@@ -113,11 +110,10 @@ public class E_Call extends ExprFunctionN
        //Use our cached version of the expression wherever possible
        if (functionCache.containsKey(functionIRI))     {
                return functionCache.get(functionIRI);
-       }       
-       
+       }
+
        //Otherwise generate a new function and cache it
-       try
-       {
+       try {
                E_Function e = new E_Function(functionIRI, new ExprList(args));
                e.buildFunction(cxt);
                functionCache.put(functionIRI, e);
@@ -127,6 +123,5 @@ public class E_Call extends ExprFunctionN
                functionCache.put(functionIRI, null);
                return null;
        }
-        
     }
 }
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNone.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNone.java
index 8012c9a3c0..c5b6a2323c 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNone.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprNone.java
@@ -23,21 +23,14 @@ import org.apache.jena.sparql.engine.binding.Binding ;
 import org.apache.jena.sparql.function.FunctionEnv ;
 import org.apache.jena.sparql.graph.NodeTransform ;
 
-/** Marker, used in place of a null.
- *  This may be tested for using {@code ==} */
-
-//public /*package*/ class ExprNone extends ExprVar { // extends ExprNode {
-//    
-//    /*package*/ static Expr NONE0 = new ExprNone() ; 
-//    
-//    private ExprNone() { super("") ; }
-//}
-
+/**
+ * Marker, used in place of a null. This may be tested for using {@code ==}
+ */
 public class ExprNone extends ExprNode {
-    
+
     /*package*/ static Expr NONE0 = new ExprNone() ;
     private ExprNone() {}
-    
+
     @Override public void visit(ExprVisitor visitor) { visitor.visit(this); }
 
     @Override public NodeValue eval(Binding binding, FunctionEnv env) {
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/util/graph/GNode.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/util/graph/GNode.java
index acd18885f8..602e4077cf 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/graph/GNode.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/graph/GNode.java
@@ -18,14 +18,10 @@
 
 package org.apache.jena.sparql.util.graph;
 
-import java.util.Collection;
-
 import org.apache.jena.graph.Graph;
 import org.apache.jena.graph.Node;
-import org.apache.jena.graph.Triple;
 import org.apache.jena.sparql.core.BasicPattern;
 
-
 /**
  * A {@code GNode} pair of (graph, node in graph) with an abstracted "findable"
  * operation so it work for graphs and collections of triples.
@@ -38,29 +34,29 @@ public class GNode
         return new GNode(graph, node);
     }
 
-    public static GNode subject(Graph graph, Triple triple) {
-        return triple == null ? null : create(graph, triple.getSubject());
-    }
-
-    public static GNode predicate(Graph graph, Triple triple) {
-        return triple == null ? null : create(graph, triple.getPredicate());
-    }
+//    public static GNode subject(Graph graph, Triple triple) {
+//        return triple == null ? null : create(graph, triple.getSubject());
+//    }
+//
+//    public static GNode predicate(Graph graph, Triple triple) {
+//        return triple == null ? null : create(graph, triple.getPredicate());
+//    }
+//
+//    public static GNode object(Graph graph, Triple triple) {
+//        return triple == null ? null : create(graph, triple.getObject());
+//    }
 
-    public static GNode object(Graph graph, Triple triple) {
-        return triple == null ? null : create(graph, triple.getObject());
-    }
-    
     public final Findable findable;
     public final Node node;
-    
+
     public GNode(Graph graph, Node node)
     { this.findable = new FindableGraph(graph); this.node = node; }
-    
+
     public GNode(BasicPattern triples, Node node)
     { this.findable = new FindableCollection(triples.getList()); this.node = 
node; }
-    
-    public GNode(Collection<Triple> triples, Node node)
-    { this.findable = new FindableCollection(triples); this.node = node; }
+
+//    public GNode(Collection<Triple> triples, Node node)
+//    { this.findable = new FindableCollection(triples); this.node = node; }
 
     public GNode(GNode other, Node node)
     { this.findable = other.findable; this.node = node; }

Reply via email to