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

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

commit 04982e4bea9dea6d0284175b0eaea0fe289777ae
Author: Andy Seaborne <[email protected]>
AuthorDate: Tue May 12 12:22:24 2026 +0100

    GH-3915: Deprecate 'jenaDefault' operations
---
 .../org/apache/jena/sparql/graph/GraphFactory.java |  21 +-
 .../apache/jena/sparql/resultset/RDFOutput.java    |   4 +-
 .../java/org/apache/jena/sparql/util/Closure.java  | 289 ++++++++++-----------
 .../org/apache/jena/sparql/util/DatasetUtils.java  |   4 +-
 .../java/org/apache/jena/sparql/api/TestAPI.java   |   4 +-
 .../jena/sparql/api/TestQueryExecutionCancel.java  |   2 +-
 .../jena/sparql/modify/AbstractTestUpdateBase.java |   2 +-
 .../exec/AbstractTestQueryExecutionCancel.java     |   2 +-
 8 files changed, 160 insertions(+), 168 deletions(-)

diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphFactory.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphFactory.java
index 4a7c9cb870..81e31e374a 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphFactory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphFactory.java
@@ -51,7 +51,7 @@ public class GraphFactory {
      * This affects {@link #createDefaultGraph}.
      * @deprecated Do not use.
      */
-    @Deprecated
+    @Deprecated(forRemoval = true)
     public static void setDftGraphSameTerm(boolean value) {
         defaultSameTerm = value;
     }
@@ -89,15 +89,19 @@ public class GraphFactory {
     }
 
     /**
-     * Create a graph - ARQ-wide default type.
+     * Create a graph.
      * <p>
      * From Jena5, this is "same-term"
      */
     public static Graph createDefaultGraph() {
-        return createJenaDefaultGraph();
+        return GraphMemFactory.createDefaultGraph();
     }
 
-    /** Create a graph - the Jena default graph for ARQ and RIOT */
+    /**
+     * Create a graph - the Jena default graph.
+     * @deprecated use {@link #createDefaultGraph()}
+     */
+    @Deprecated(forRemoval = true)
     public static Graph createJenaDefaultGraph() {
         return GraphMemFactory.createDefaultGraph();
     }
@@ -106,12 +110,15 @@ public class GraphFactory {
         return GraphSink.instance();
     }
 
-    /** Guaranteed call-through to Jena's ModelFactory operation */
+    /**
+     * @deprecated use {@link #makeDefaultModel()}
+     */
+    @Deprecated(forRemoval = true)
     public static Model makeJenaDefaultModel() {
-        return ModelFactory.createDefaultModel();
+        return makeDefaultModel();
     }
 
-    /** Create a model over a default graph (ARQ-wide for default graph type) 
*/
+    /** Create a model over a default graph (system-wide for default graph 
type) */
     public static Model makeDefaultModel() {
         return ModelFactory.createModelForGraph(createDefaultGraph());
     }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFOutput.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFOutput.java
index 4b1cfe3dad..74051807f5 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFOutput.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/RDFOutput.java
@@ -55,7 +55,7 @@ public class RDFOutput
      * @return Model Model contains the results
      */
     public Model asModel(ResultSet resultSet) {
-        Model m = GraphFactory.makeJenaDefaultModel();
+        Model m = GraphFactory.makeDefaultModel();
         asRDF(m, resultSet);
         if ( m.getNsPrefixURI("rs") == null )
             m.setNsPrefix("rs", ResultSetGraphVocab.getURI());
@@ -130,7 +130,7 @@ public class RDFOutput
 
     // Boolean results
     public Model asModel(boolean result) {
-        Model m = GraphFactory.makeJenaDefaultModel();
+        Model m = GraphFactory.makeDefaultModel();
         encodeAsRDF(m, result);
         addPrefixes(m);
         return m;
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/util/Closure.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/util/Closure.java
index 41947dc89b..1d65ff031b 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/Closure.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/Closure.java
@@ -22,225 +22,210 @@
 /** Code to calculate the transitive-bNode closures */
 
 package org.apache.jena.sparql.util;
-import java.util.ArrayList ;
-import java.util.Collection ;
-import java.util.List ;
 
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.sparql.graph.GraphFactory ;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
-public class Closure
-{
-    /** Calculate the bNode closure from a statement .
-     *  The Statement itself does not automatically get included.
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.sparql.graph.GraphFactory;
+
+public class Closure {
+    /**
+     * Calculate the bNode closure from a statement . The Statement itself 
does not
+     * automatically get included.
+     *
      * @param stmt
      * @return A model containing statements
      */
 
-    public static Model closure(Statement stmt)
-    {
-        return closure(stmt, new ClosureBNode()) ;
+    public static Model closure(Statement stmt) {
+        return closure(stmt, new ClosureBNode());
     }
 
-    /** Calculate the bNode closure from a statement .
-      *  The Statement itself does not automatically get included.
-      * @param statement  Starting point for the closure.
-      * @param test       The test object to be applied
-      * @return A model containing statements
-      * @see ClosureTest
-      */
-
-    public static Model closure(Statement statement, ClosureTest test)
-    {
-        return closure(statement, test, GraphFactory.makeJenaDefaultModel()) ;
+    /**
+     * Calculate the bNode closure from a statement . The Statement itself 
does not
+     * automatically get included.
+     *
+     * @param statement Starting point for the closure.
+     * @param test The test object to be applied
+     * @return A model containing statements
+     * @see ClosureTest
+     */
+
+    public static Model closure(Statement statement, ClosureTest test) {
+        return closure(statement, test, GraphFactory.makeDefaultModel());
     }
 
-    /** Calculate the bNode closure from a statement .
-      *  The Statement itself does not automatically get included.
-      * @param statement  Starting point for the closure.
-      * @param model      Add the statements to this model
-      * @return A model containing statements
-      * @see ClosureTest
-      */
-
-    public static Model closure(Statement statement, Model model)
-    {
-        return closure(statement, new ClosureBNode(), model) ;
+    /**
+     * Calculate the bNode closure from a statement . The Statement itself 
does not
+     * automatically get included.
+     *
+     * @param statement Starting point for the closure.
+     * @param model Add the statements to this model
+     * @return A model containing statements
+     * @see ClosureTest
+     */
+
+    public static Model closure(Statement statement, Model model) {
+        return closure(statement, new ClosureBNode(), model);
     }
-    
-    /** Calculate the bNode closure from a statement .
-      *  The Statement itself does not automatically get included.
-      * @param statement  Starting point for the closure.
-      * @param test       The test object to be applied
-      * @param model      Add the statements to this model
-      * @return A model containing statements
-      * @see ClosureTest
-      */
-
-    public static Model closure(Statement statement, ClosureTest test, Model 
model)
-    {
-        //Set visited = new HashSet() ;
-        List<Resource> visited = new ArrayList<>() ;
-
-        closure(statement, model, visited, test) ;
-        return model ;
+
+    /**
+     * Calculate the bNode closure from a statement . The Statement itself 
does not
+     * automatically get included.
+     *
+     * @param statement Starting point for the closure.
+     * @param test The test object to be applied
+     * @param model Add the statements to this model
+     * @return A model containing statements
+     * @see ClosureTest
+     */
+
+    public static Model closure(Statement statement, ClosureTest test, Model 
model) {
+        // Set visited = new HashSet() ;
+        List<Resource> visited = new ArrayList<>();
+
+        closure(statement, model, visited, test);
+        return model;
     }
 
-    /** Calculate the bNode closure from a resource.
-     *  The Statement itself does not automatically get included.
-     * @param resource       Starting point for the closure.
-     * @param testThisNode   Indicate whether to apply the closure test to the 
Resource argument.
+    /**
+     * Calculate the bNode closure from a resource. The Statement itself does 
not
+     * automatically get included.
+     *
+     * @param resource Starting point for the closure.
+     * @param testThisNode Indicate whether to apply the closure test to the 
Resource
+     *     argument.
      * @return A model containing statements
      */
 
-    public static Model closure(Resource resource, boolean testThisNode)
-    {
-        return closure(resource, new ClosureBNode(), testThisNode) ;
+    public static Model closure(Resource resource, boolean testThisNode) {
+        return closure(resource, new ClosureBNode(), testThisNode);
     }
 
-    /** Calculate the bNode closure from a resource .
-     *  The Statement itself does not automatically get included.
+    /**
+     * Calculate the bNode closure from a resource . The Statement itself does 
not
+     * automatically get included.
+     *
      * @param resource
-     * @param test            The test object to be applied
-     * @param testThisNode    Indicate whether to apply the closure test to 
the Resource argument.
+     * @param test The test object to be applied
+     * @param testThisNode Indicate whether to apply the closure test to the 
Resource
+     *     argument.
      * @return A model containing statements
      */
 
-    public static Model closure(Resource resource, ClosureTest test, boolean 
testThisNode)
-    {
-        return closure(resource, test, testThisNode, 
GraphFactory.makeJenaDefaultModel()) ;
+    public static Model closure(Resource resource, ClosureTest test, boolean 
testThisNode) {
+        return closure(resource, test, testThisNode, 
GraphFactory.makeDefaultModel());
     }
 
-
-    /** Calculate the bNode closure from a resource .
-     *  The Statement itself does not automatically get included.
+    /**
+     * Calculate the bNode closure from a resource . The Statement itself does 
not
+     * automatically get included.
+     *
      * @param resource
-     * @param testThisNode Indicate whether to apply the closure test to the 
Resource argument.
-     * @param results      Add the statements to this model
+     * @param testThisNode Indicate whether to apply the closure test to the 
Resource
+     *     argument.
+     * @param results Add the statements to this model
      * @return A model containing statements
      */
 
-    public static Model closure(Resource resource, boolean testThisNode, Model 
results)
-    {
-        return closure(resource, new ClosureBNode(), testThisNode, results) ;
+    public static Model closure(Resource resource, boolean testThisNode, Model 
results) {
+        return closure(resource, new ClosureBNode(), testThisNode, results);
     }
-    
-    
-    /** Calculate the bNode closure from a resource .
-     *  The Statement itself does not automatically get included.
+
+    /**
+     * Calculate the bNode closure from a resource . The Statement itself does 
not
+     * automatically get included.
+     *
      * @param resource
-     * @param test          The test object to be applied
-     * @param testThisNode  Indicate whether to apply the closure test to the 
Resource argument.
-     * @param results       Add the statements to this model
+     * @param test The test object to be applied
+     * @param testThisNode Indicate whether to apply the closure test to the 
Resource
+     *     argument.
+     * @param results Add the statements to this model
      * @return A model containing statements
      */
 
-    public static Model closure(Resource resource, ClosureTest test,
-                                boolean testThisNode, Model results)
-    {
-        //Set s = new HashSet() ;
-        //Set visited = new HashSet() ;
-        List<Resource> visited = new ArrayList<>() ;
-        
-        if ( ! testThisNode )
-            closureNoTest(resource, results, visited, test) ;
+    public static Model closure(Resource resource, ClosureTest test, boolean 
testThisNode, Model results) {
+        // Set s = new HashSet() ;
+        // Set visited = new HashSet() ;
+        List<Resource> visited = new ArrayList<>();
+
+        if ( !testThisNode )
+            closureNoTest(resource, results, visited, test);
         else
-            closure(resource, results, visited, test) ;
-        return results ;
+            closure(resource, results, visited, test);
+        return results;
     }
 
-
-
     // 
--------------------------------------------------------------------------------
 
-    private static void closure(Statement stmt,
-                                Model closureBlob, Collection<Resource> 
visited,
-                                ClosureTest test)
-    {
+    private static void closure(Statement stmt, Model closureBlob, 
Collection<Resource> visited, ClosureTest test) {
         if ( test.includeStmt(stmt) )
-                closureBlob.add(stmt) ;
-        closure(stmt.getSubject(), closureBlob, visited, test) ;
-        closure(stmt.getObject(),  closureBlob, visited, test) ;
+            closureBlob.add(stmt);
+        closure(stmt.getSubject(), closureBlob, visited, test);
+        closure(stmt.getObject(), closureBlob, visited, test);
     }
 
+    private static void closure(RDFNode n, Model closureBlob, 
Collection<Resource> visited, ClosureTest test) {
+        if ( !(n instanceof Resource) )
+            return;
 
-    private static void closure(RDFNode n,
-                                Model closureBlob, Collection<Resource> 
visited,
-                                ClosureTest test)
-    {
-        if ( ! ( n instanceof Resource ) )
-            return ;
-
-        Resource r = (Resource)n ;
+        Resource r = (Resource)n;
 
         if ( visited.contains(r) )
-            return ;
+            return;
 
-        if ( ! test.traverse(r) )
-            return ;
+        if ( !test.traverse(r) )
+            return;
 
-        closureNoTest(r, closureBlob, visited, test) ;
+        closureNoTest(r, closureBlob, visited, test);
     }
-    
-     
-    private static void closureNoTest(Resource r,
-                                      Model closureBlob, Collection<Resource> 
visited,
-                                      ClosureTest test)
-    {
-        visited.add(r) ;
-
-        StmtIterator sIter = r.listProperties() ;
-        for ( ; sIter.hasNext() ; )
-        {
-            Statement stmt = sIter.nextStatement() ;
-            closure(stmt, closureBlob, visited, test) ;
+
+    private static void closureNoTest(Resource r, Model closureBlob, 
Collection<Resource> visited, ClosureTest test) {
+        visited.add(r);
+
+        StmtIterator sIter = r.listProperties();
+        for ( ; sIter.hasNext() ; ) {
+            Statement stmt = sIter.nextStatement();
+            closure(stmt, closureBlob, visited, test);
         }
     }
 
-
-    private static String dbg_string(Collection<?> s)
-    {
-        String tmp = "" ;
-        for ( Object value : s )
-        {
+    private static String dbg_string(Collection<? > s) {
+        String tmp = "";
+        for ( Object value : s ) {
             tmp = tmp + " " + value.toString();
         }
-        return tmp ;
+        return tmp;
     }
 
     // Defines the bNode closure
-    
-    public static class ClosureBNode implements ClosureTest
-    {
+
+    public static class ClosureBNode implements ClosureTest {
         @Override
-        public boolean traverse(Resource r)
-        {
-            return r.isAnon() ;
+        public boolean traverse(Resource r) {
+            return r.isAnon();
         }
 
         @Override
-        public boolean includeStmt(Statement s)
-        {
-            return true ;
+        public boolean includeStmt(Statement s) {
+            return true;
         }
     }
 
-    // Defines the reachable (on forward arcs) subgraph. 
-    
-    public static class ClosureReachable implements ClosureTest
-    {
+    // Defines the reachable (on forward arcs) subgraph.
+
+    public static class ClosureReachable implements ClosureTest {
         @Override
-        public boolean traverse(Resource r)
-        {
-            return true ;
+        public boolean traverse(Resource r) {
+            return true;
         }
 
         @Override
-        public boolean includeStmt(Statement s)
-        {
-            return true ;
+        public boolean includeStmt(Statement s) {
+            return true;
         }
     }
-    
 
 }
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/util/DatasetUtils.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/util/DatasetUtils.java
index e6b28cb2e3..ac30c9bb4e 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/DatasetUtils.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/DatasetUtils.java
@@ -195,7 +195,7 @@ public class DatasetUtils
         // Merge into background graph
         if ( uriList != null && ! uriList.isEmpty() ) {
             // Isolate from syntax errors
-            Graph gTmp = GraphFactory.createJenaDefaultGraph();
+            Graph gTmp = GraphFactory.createDefaultGraph();
             for ( Iterator<String> iter = uriList.iterator() ; iter.hasNext() 
; ) {
                 String sourceURI = iter.next();
                 String absURI = baseURI(sourceURI, absBaseURI);
@@ -210,7 +210,7 @@ public class DatasetUtils
                 String sourceURI = iter.next();
                 String absURI = baseURI(sourceURI, absBaseURI);
                 // Read into a tmp graph in case of syntax errors.
-                Graph gTmp = GraphFactory.createJenaDefaultGraph();
+                Graph gTmp = GraphFactory.createDefaultGraph();
                 RDFDataMgr.read(gTmp, sourceURI, absBaseURI, null);
                 Node gn = NodeFactory.createURI(sourceURI);
                 dsg.addGraph(gn, gTmp);
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
index 39dd81ca3a..33bfdfa5c9 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
@@ -50,12 +50,12 @@ public class TestAPI
 {
     private static final String ns = "http://example/ns#";;
 
-    static Model m = GraphFactory.makeJenaDefaultModel();
+    static Model m = GraphFactory.makeDefaultModel();
     static Resource r1 = m.createResource();
     static Property p1 = m.createProperty(ns+"p1");
     static Property p2 = m.createProperty(ns+"p2");
     static Property p3 = m.createProperty(ns+"p3");
-    static Model dft = GraphFactory.makeJenaDefaultModel();
+    static Model dft = GraphFactory.makeDefaultModel();
     static Resource s = dft.createResource(ns+"s");
     static Property p = dft.createProperty(ns+"p");
     static Resource o = dft.createResource(ns+"o");
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionCancel.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionCancel.java
index f5f72a4b3f..6363a0fade 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionCancel.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestQueryExecutionCancel.java
@@ -68,7 +68,7 @@ public class TestQueryExecutionCancel {
 
     private static final String ns = "http://example/ns#";;
 
-    static Model m = GraphFactory.makeJenaDefaultModel();
+    static Model m = GraphFactory.makeDefaultModel();
     static Resource r1 = m.createResource();
     static Property p1 = m.createProperty(ns+"p1");
     static Property p2 = m.createProperty(ns+"p2");
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
index eda32e525f..615389d463 100644
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java
@@ -43,7 +43,7 @@ public abstract class AbstractTestUpdateBase
     protected void namedGraphData(DatasetGraph gStore, Node uri, Graph data) {
         Graph g = gStore.getGraph(uri);
         if ( g == null ) {
-            gStore.addGraph(uri, GraphFactory.createJenaDefaultGraph());
+            gStore.addGraph(uri, GraphFactory.createDefaultGraph());
             g = gStore.getGraph(uri);
         } else
             g.clear();
diff --git 
a/jena-integration-tests/src/test/java/org/apache/jena/sparql/exec/AbstractTestQueryExecutionCancel.java
 
b/jena-integration-tests/src/test/java/org/apache/jena/sparql/exec/AbstractTestQueryExecutionCancel.java
index 2a0b667036..1f03829477 100644
--- 
a/jena-integration-tests/src/test/java/org/apache/jena/sparql/exec/AbstractTestQueryExecutionCancel.java
+++ 
b/jena-integration-tests/src/test/java/org/apache/jena/sparql/exec/AbstractTestQueryExecutionCancel.java
@@ -82,7 +82,7 @@ public abstract class AbstractTestQueryExecutionCancel {
 
     private static final String ns = "http://example/ns#";;
 
-    static Model m = GraphFactory.makeJenaDefaultModel();
+    static Model m = GraphFactory.makeDefaultModel();
     static Resource r1 = m.createResource();
     static Property p1 = m.createProperty(ns+"p1");
     static Property p2 = m.createProperty(ns+"p2");

Reply via email to