You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2025/11/30 20:39:14 UTC
(jena) 15/15: Add GraphFactory.empty()
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 fd4df838d5bba5c80cff1b5a18de75dcb88f3f44
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sun Nov 30 18:15:01 2025 +0000
Add GraphFactory.empty()
---
.../org/apache/jena/sparql/engine/QueryEngineFactory.java | 2 +-
.../main/java/org/apache/jena/sparql/graph/GraphFactory.java | 11 ++++++++++-
jena-arq/src/test/java/org/apache/jena/arq/junit/Scripts.java | 4 +---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryEngineFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryEngineFactory.java
index fb7571a2fc..df492c1f39 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryEngineFactory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/QueryEngineFactory.java
@@ -34,7 +34,7 @@ import org.apache.jena.sparql.util.Context;
* * A {@code QueryEngineFactory} is registered with the
* {@link QueryEngineRegistry}.
* <p>
- * * When determining which factory to use, the querye execution process calls
+ * When determining which factory to use, the query execution process calls
* {@link #accept(Query, DatasetGraph, Context)} or
* {@link #accept(Op, DatasetGraph, Context)} to determine whether the
* particular type of query engine produced by this factory accepts the
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 ee0d6e7006..98a5dd93f6 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
@@ -76,6 +76,15 @@ public class GraphFactory {
return new GraphTxn();
}
+ /**
+ * Return an immutable, transactional, empty graph.
+ * <p>
+ * This fully supports transactions.
+ */
+ public static Graph emptyGraph() {
+ return GraphZero.instance();
+ }
+
/**
* Create a graph - ARQ-wide default type.
* <p>
@@ -91,7 +100,7 @@ public class GraphFactory {
}
public static Graph sinkGraph() {
- return new GraphSink();
+ return GraphSink.instance();
}
/** Guaranteed call-through to Jena's ModelFactory operation */
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/Scripts.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/Scripts.java
index bee7bddaef..e5329bfa91 100644
--- a/jena-arq/src/test/java/org/apache/jena/arq/junit/Scripts.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/Scripts.java
@@ -45,7 +45,6 @@ public class Scripts {
public static Function<ManifestEntry, Runnable> testMaker() { return runnableGenerator.testMaker(); }
public static Stream<DynamicNode> manifestTestFactory(String filename, String namePrefix, Function<ManifestEntry, Runnable> testMaker) {
- // When does this happen?
EntryToTest f = entry -> {
Runnable r = testMaker.apply(entry);
if ( r == null )
@@ -119,12 +118,11 @@ public class Scripts {
}
}
- /** Does the URI of the test conain a substring? */
+ /** Does the URI of the test contain a substring? */
public static boolean entryContainsSubstring(ManifestEntry entry, String fingerprint) {
String testURI = entry.getURI();
if ( testURI == null )
return false;
return testURI.contains(fingerprint);
}
-
}