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 92c88cbf9166989a19759d093c4621f5750d0d29 Author: Andy Seaborne <[email protected]> AuthorDate: Mon Nov 10 08:39:33 2025 +0000 GH-3580: Remove transition GraphMemFactory operations --- .../org/apache/jena/graph/GraphMemFactory.java | 94 +++------------------- .../main/java/org/apache/jena/mem/GraphMem.java | 11 +-- .../java/org/apache/jena/graph/test/TestGraph.java | 6 +- 3 files changed, 18 insertions(+), 93 deletions(-) diff --git a/jena-core/src/main/java/org/apache/jena/graph/GraphMemFactory.java b/jena-core/src/main/java/org/apache/jena/graph/GraphMemFactory.java index cf63f49519..6712c72169 100644 --- a/jena-core/src/main/java/org/apache/jena/graph/GraphMemFactory.java +++ b/jena-core/src/main/java/org/apache/jena/graph/GraphMemFactory.java @@ -51,71 +51,20 @@ public class GraphMemFactory static { JenaSystem.init(); } private GraphMemFactory() {} - // Default for sameTerm/sameValue - // Up to Jena 4 : default false (same value) - // From Jena 5 : default false (same term) - private static boolean defaultSameTerm = true; - static { - // Initial setting. - String x = System.getProperty("jena:graphSameTerm"); - if ( x != null ) { - if ( x.equalsIgnoreCase("true") ) - defaultSameTerm = true; - if ( x.equalsIgnoreCase("false") ) - defaultSameTerm = false; - } - } - - /** - * Set the default mode for in-memory graphs : same term (true) or same value - * (false). - * <p> - * This is initially set with system property "jena:graphSameTerm" - * with the system default is same value (Jena4). - * <p> - * This affects {@link #createDefaultGraph}. - * @deprecated To be removed. - */ - @Deprecated(forRemoval = true) - public static void setDftGraphSameTerm(boolean value) { - defaultSameTerm = value; - } - - /** - * Get the default mode for in-memory for graphs : same term (true) or same value - * (false). - * <p> - * This is used by {@link #createDefaultGraph}. - * @deprecated To be removed. - */ - @Deprecated(forRemoval = true) - public static boolean dftGraphSameTerm() { - return defaultSameTerm; - } - /** * Answer a memory-based graph. * This is the system default. */ public static Graph createDefaultGraph() { - return dftGraphSameTerm() - ? createDefaultGraphSameTerm() - : createDefaultGraphSameValue(); + return createDefaultGraphSameTerm(); } /** - * @deprecated To be renamed. Use {@link #createGraphMemForModel()}. The function will be re-purposed for the default same-term memory graph. + * This function will track the preferred general purpose graph for the Model + * API. It is value-based, to align with the Java-object mapping, rather than + * RDF-term based (Integers +001 and 1 are the same value). */ - @Deprecated(forRemoval = true) - public static Graph createGraphMem() { - //return createGraphMemForModel(); - return createGraphMem2(); - } - - /** - * This function will track the preferred general purpose graph for the Model API. - */ public static Graph createGraphMemForModel() { @SuppressWarnings("deprecation") Graph g = new org.apache.jena.mem.GraphMem(); @@ -137,7 +86,8 @@ public class GraphMemFactory /** * Answer a memory-based graph with "same term" semantics - * This method will continue to provide the preferred general purpose "same term" graph. + * This method will continue to provide the preferred + * general purpose "same term" graph. */ public static Graph createDefaultGraphSameTerm() { return createGraphMem2(); } @@ -154,18 +104,9 @@ public class GraphMemFactory * with a simpler implementation, primarily due to not providing support for {@link Iterator#remove}. * <p> * See {@link GraphMem2Legacy} for details. - * */ - public static Graph createGraphMemBasic() - { return new GraphMem2Legacy(); } - - /** - * @deprecated Use {@link #createGraphMemBasic()} - */ - @Deprecated(forRemoval = true) - public static Graph createGraphMem2Basic() - { return createGraphMemBasic(); } - + public static Graph createGraphMemBasic() + { return new GraphMem2Legacy(); } /** * A graph that stores triples in memory. This class is not thread-safe. @@ -179,19 +120,10 @@ public class GraphMemFactory * <p> * See {@link GraphMem2Fast} for details. */ - //public static Graph createGraphMemX() { - public static Graph createGraphMem2() { + public static Graph createGraphMem2() { return new GraphMem2Fast(); } -// /** -// * @deprecated Use {@link #createGraphMemBasic()} -// */ -// @Deprecated(forRemoval = true) -// public static Graph createGraphMem2() { -// return new GraphMem2Fast(); -// } - /** * A graph that stores triples in memory. This class is not thread-safe. * <p> @@ -208,14 +140,6 @@ public class GraphMemFactory public static Graph createGraphMemRoaring() { return new GraphMem2Roaring(); } - - /** - * @deprecated Use {@link #createGraphMemRoaring()} - */ - @Deprecated(forRemoval = true) - public static Graph createGraphMem2Roaring() - { return createGraphMemRoaring(); } - private final static Graph emptyGraph = new GraphBase() { @Override protected ExtendedIterator<Triple> graphBaseFind(Triple triplePattern) { diff --git a/jena-core/src/main/java/org/apache/jena/mem/GraphMem.java b/jena-core/src/main/java/org/apache/jena/mem/GraphMem.java index b19c11e95c..00eb41bf6e 100644 --- a/jena-core/src/main/java/org/apache/jena/mem/GraphMem.java +++ b/jena-core/src/main/java/org/apache/jena/mem/GraphMem.java @@ -26,11 +26,12 @@ import java.util.stream.Stream; /** * In-memory, non-thread-safe, non-transactional graph. + * This specialised graph has same-value semantics for literals. + * It is used in the ModelAPI : see {@link GraphMemFactory#createGraphMemForModel}. * - * @deprecated This implementation of GraphMem will be replaced by a new - * implementation. Applications should be using + * @deprecated Applications should be using * {@link GraphMemFactory#createDefaultGraph()} for a general purpose graph or - * {@link GraphMemFactory#createGraphMem()} to specific this style of + * {@link GraphMemFactory#createDefaultGraphSameValue()} if necessary * implementation. */ @Deprecated @@ -38,9 +39,9 @@ public class GraphMem extends GraphMemBase { // Rename as GraphMemValue. /** - This Graph's TripleStore. Visible for <i>read-only</i> purposes only. + This Graph's TripleStore. */ - public final TripleStore store; + private final TripleStore store; public GraphMem() { super(); diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestGraph.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestGraph.java index 9b6fcb1431..15ebacb9a4 100644 --- a/jena-core/src/test/java/org/apache/jena/graph/test/TestGraph.java +++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestGraph.java @@ -84,12 +84,12 @@ public class TestGraph extends GraphTestBase { } /** - * Class to provide a constructor that produces a wrapper round a GraphMem. + * Class to provide a constructor that produces a wrapper round a + * default choice of in-memory graph. */ public static class WrappedGraphMem extends WrappedGraph { - @SuppressWarnings("removal") public WrappedGraphMem() { - super(GraphMemFactory.createGraphMem()); + super(GraphMemFactory.createDefaultGraph()); } } }
