Skip to content

Commit 0d4c658

Browse files
committed
GH2701: Fuseki Mod to list and abort running executions.
1 parent 191ed13 commit 0d4c658

File tree

77 files changed

+4389
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4389
-220
lines changed

CHANGES.txt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,3 @@
1-
==== Apache Jena 5.5.0
2-
Released: 2025-07-18
3-
Issues: https://s.apache.org/jena-5.5.0-issues
4-
Announcement:
5-
https://lists.apache.org/thread/9dtbh9j30qh03bbgj4j27htx7fdbmyy8
6-
7-
== RDF 1.2
8-
9-
There is a Model API class StatementTerm for RDF 1.2 triple terms.
10-
This change reflects the W3C Working Groups decision. It is only permitted
11-
in the only in the object position. Unlike the work of the RDF-star CG,
12-
triple terms are not valid in the subject position.
13-
Most application code will be using reifiers : Model.createReifier
14-
15-
== Fuseki/TDB2
16-
17-
There is a fix to release database files promptly on deletion.
18-
This includes after compaction.
19-
https://github.com/apache/jena/issues/3240
20-
21-
== Preparation for Jena 6.0.0
22-
23-
In preparation for a future Jena 6.0.0, the 5.5.0 release has code deprecations
24-
indicating methods, classes and modules that are planned for removal.
25-
26-
== Contributions
27-
28-
@ebremer
29-
GH-2411: Command line improvements (arq)
30-
Issue #2411, PR #3216
31-
32-
Aklakan
33-
+ Add GeoSPARQL to jena-fuseki-server
34-
https://github.com/apache/jena/issues/3026
35-
https://github.com/apache/jena/pull/3027
36-
37-
+ Fixed ExprUtils.eval raising exception because of null dataset.
38-
39-
+ Support for uploading compressed data with GSP and SPARQL
40-
https://github.com/apache/jena/issues/3258
41-
https://github.com/apache/jena/pull/3266
42-
43-
@fpotier
44-
GH-3221 Fix SchemaDO._abstract URI
45-
46-
Kengo Seki / @sekikn
47-
Fix DBpedia examples
48-
https://github.com/apache/jena/pull/3252
49-
50-
511
==== Apache Jena 5.4.0
522
Released: 2025-04-27
533
Issues: https://s.apache.org/jena-5.4.0-issues

jena-arq/src/main/java/org/apache/jena/http/sys/ExecUpdateHTTPBuilder.java

Lines changed: 5 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
package org.apache.jena.http.sys;
2020

2121
import java.net.http.HttpClient;
22-
import java.util.*;
22+
import java.util.ArrayList;
23+
import java.util.HashMap;
24+
import java.util.List;
25+
import java.util.Map;
26+
import java.util.Objects;
2327
import java.util.concurrent.TimeUnit;
24-
import java.util.stream.Collectors;
2528

2629
import org.apache.jena.graph.Node;
2730
import org.apache.jena.http.HttpEnv;
@@ -37,106 +40,10 @@
3740
import org.apache.jena.sys.JenaSystem;
3841
import org.apache.jena.update.Update;
3942
import org.apache.jena.update.UpdateException;
40-
import org.apache.jena.update.UpdateFactory;
4143
import org.apache.jena.update.UpdateRequest;
4244

4345
public abstract class ExecUpdateHTTPBuilder<X, Y> {
4446

45-
/** Update element. Either an Update object or a string. */
46-
private record UpdateElt(Update update, String updateString) {
47-
UpdateElt(Update update) { this(Objects.requireNonNull(update), null); }
48-
UpdateElt(String updateString) { this(null, Objects.requireNonNull(updateString)); }
49-
boolean isParsed() { return update != null; }
50-
51-
@Override
52-
public String toString() {
53-
return isParsed()
54-
? new UpdateRequest(update()).toString() // Reuse UpdateRequest's serialization approach
55-
: updateString();
56-
}
57-
}
58-
59-
/** Accumulator for update elements. Can build an overall string or UpdateRequest from the elements. */
60-
private class UpdateEltAcc implements Iterable<UpdateElt> {
61-
/** Delimiter for joining multiple SPARQL update strings into a single one.
62-
* The delimiter takes into account that the last line of a statement may be a single-line-comment. */
63-
public static final String DELIMITER = "\n;\n";
64-
65-
private List<UpdateElt> updateOperations = new ArrayList<>();
66-
private List<UpdateElt> updateOperationsView = Collections.unmodifiableList(updateOperations);
67-
private boolean isParsed = true; // True iff there are no strings in updateOperations
68-
69-
public boolean isParsed() {
70-
return isParsed;
71-
}
72-
73-
public void add(UpdateElt updateElt) {
74-
isParsed = isParsed && updateElt.isParsed();
75-
updateOperations.add(updateElt);
76-
}
77-
78-
public void add(Update update) {
79-
add(new UpdateElt(update));
80-
}
81-
82-
/** Add a string by parsing it. */
83-
public void add(String updateRequestString) {
84-
UpdateRequest updateRequest = UpdateFactory.create(updateRequestString);
85-
add(updateRequest);
86-
}
87-
88-
public void add(UpdateRequest updateRequest) {
89-
updateRequest.getOperations().forEach(this::add);
90-
}
91-
92-
/** Add a string without parsing it. */
93-
public void addString(String updateRequestString) {
94-
add(new UpdateElt(updateRequestString));
95-
}
96-
97-
/** Attempt to build an UpdateRequest from the state of this accumulator. Attempts to parse any string elements. */
98-
public UpdateRequest buildUpdateRequest() {
99-
return addToUpdateRequest(new UpdateRequest());
100-
}
101-
102-
public UpdateRequest addToUpdateRequest(UpdateRequest updateRequest) {
103-
for (UpdateElt elt : updateOperations) {
104-
if (elt.isParsed()) {
105-
updateRequest.add(elt.update());
106-
} else {
107-
try {
108-
updateRequest.add(elt.updateString());
109-
} catch (Exception e) {
110-
// Expose the string that failed to parse
111-
e.addSuppressed(new RuntimeException("Failed to parse: " + elt.updateString()));
112-
throw e;
113-
}
114-
}
115-
}
116-
return updateRequest;
117-
}
118-
119-
public void clear() {
120-
updateOperations.clear();
121-
isParsed = true;
122-
}
123-
124-
public boolean isEmpty() {
125-
return updateOperations.isEmpty();
126-
}
127-
128-
@Override
129-
public Iterator<UpdateElt> iterator() {
130-
return updateOperationsView.iterator();
131-
}
132-
133-
public String buildString() {
134-
return updateOperations.stream()
135-
.map(UpdateElt::toString)
136-
.collect(Collectors.joining(DELIMITER));
137-
}
138-
}
139-
14047
static { JenaSystem.init(); }
14148

14249
protected String serviceURL;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.apache.jena.http.sys;
2+
3+
import java.util.Objects;
4+
5+
import org.apache.jena.update.Update;
6+
import org.apache.jena.update.UpdateRequest;
7+
8+
/** Update element. Either an Update object or a string. */
9+
record UpdateElt(Update update, String updateString) {
10+
UpdateElt(Update update) { this(Objects.requireNonNull(update), null); }
11+
UpdateElt(String updateString) { this(null, Objects.requireNonNull(updateString)); }
12+
boolean isParsed() { return update != null; }
13+
14+
@Override
15+
public String toString() {
16+
return isParsed()
17+
? new UpdateRequest(update()).toString() // Reuse UpdateRequest's serialization approach
18+
: updateString();
19+
}
20+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package org.apache.jena.http.sys;
2+
3+
import java.util.ArrayList;
4+
import java.util.Collections;
5+
import java.util.Iterator;
6+
import java.util.List;
7+
import java.util.stream.Collectors;
8+
9+
import org.apache.jena.update.Update;
10+
import org.apache.jena.update.UpdateFactory;
11+
import org.apache.jena.update.UpdateRequest;
12+
13+
/** Accumulator for update elements. Can build an overall string or UpdateRequest from the elements. */
14+
public class UpdateEltAcc implements Iterable<UpdateElt> {
15+
/** Delimiter for joining multiple SPARQL update strings into a single one.
16+
* The delimiter takes into account that the last line of a statement may be a single-line-comment. */
17+
public static final String DELIMITER = "\n;\n";
18+
19+
private List<UpdateElt> updateOperations = new ArrayList<>();
20+
private List<UpdateElt> updateOperationsView = Collections.unmodifiableList(updateOperations);
21+
private boolean isParsed = true; // True iff there are no strings in updateOperations
22+
23+
public boolean isParsed() {
24+
return isParsed;
25+
}
26+
27+
public void add(UpdateElt updateElt) {
28+
isParsed = isParsed && updateElt.isParsed();
29+
updateOperations.add(updateElt);
30+
}
31+
32+
public void add(Update update) {
33+
add(new UpdateElt(update));
34+
}
35+
36+
/** Add a string by parsing it. */
37+
public void add(String updateRequestString) {
38+
UpdateRequest updateRequest = UpdateFactory.create(updateRequestString);
39+
add(updateRequest);
40+
}
41+
42+
public void add(UpdateRequest updateRequest) {
43+
updateRequest.getOperations().forEach(this::add);
44+
}
45+
46+
/** Add a string without parsing it. */
47+
public void addString(String updateRequestString) {
48+
add(new UpdateElt(updateRequestString));
49+
}
50+
51+
/** Attempt to build an UpdateRequest from the state of this accumulator. Attempts to parse any string elements. */
52+
public UpdateRequest buildUpdateRequest() {
53+
return addToUpdateRequest(new UpdateRequest());
54+
}
55+
56+
public UpdateRequest addToUpdateRequest(UpdateRequest updateRequest) {
57+
for (UpdateElt elt : updateOperations) {
58+
if (elt.isParsed()) {
59+
updateRequest.add(elt.update());
60+
} else {
61+
try {
62+
updateRequest.add(elt.updateString());
63+
} catch (Exception e) {
64+
// Expose the string that failed to parse
65+
e.addSuppressed(new RuntimeException("Failed to parse: " + elt.updateString()));
66+
throw e;
67+
}
68+
}
69+
}
70+
return updateRequest;
71+
}
72+
73+
public void clear() {
74+
updateOperations.clear();
75+
isParsed = true;
76+
}
77+
78+
public boolean isEmpty() {
79+
return updateOperations.isEmpty();
80+
}
81+
82+
@Override
83+
public Iterator<UpdateElt> iterator() {
84+
return updateOperationsView.iterator();
85+
}
86+
87+
public String buildString() {
88+
return updateOperations.stream()
89+
.map(UpdateElt::toString)
90+
.collect(Collectors.joining(DELIMITER));
91+
}
92+
}

jena-arq/src/main/java/org/apache/jena/sparql/ARQConstants.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ public class ARQConstants
317317
public static final Symbol registryExtensions =
318318
SystemARQ.allocSymbol("registryExtensions") ;
319319

320-
public static void init() {}
320+
/** The query dispatch registry key */
321+
public static final Symbol registryQueryDispatchers =
322+
SystemARQ.allocSymbol("registryQueryDispatchers") ;
323+
324+
/** The update dispatch registry key */
325+
public static final Symbol registryUpdateDispatchers =
326+
SystemARQ.allocSymbol("registryUpdateDispatchers") ;
321327

328+
public static void init() {}
322329
}

jena-arq/src/main/java/org/apache/jena/sparql/engine/Timeouts.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,23 @@ public static String toString(Timeout timeout) {
233233
return result;
234234
}
235235

236-
// Set times from context if not set directly. e..g Context provides default values.
237-
// Contrast with SPARQLQueryProcessor where the context is limiting values of the protocol parameter.
236+
/**
237+
* Update unset values in the builder with values from the context.
238+
*
239+
* Set times from context if not set directly, i.e. context provides default values.
240+
* Contrast with SPARQLQueryProcessor where the context is limiting values of the protocol parameter.
241+
*/
238242
public static void applyDefaultQueryTimeoutFromContext(TimeoutBuilderImpl builder, Context cxt) {
239243
Timeout queryTimeout = extractQueryTimeout(cxt);
240244
applyDefaultTimeout(builder, queryTimeout);
241245
}
242246

247+
/** Update unset values in the builder with values from the context. */
248+
public static void applyDefaultUpdateTimeoutFromContext(TimeoutBuilderImpl builder, Context cxt) {
249+
Timeout queryTimeout = extractUpdateTimeout(cxt);
250+
applyDefaultTimeout(builder, queryTimeout);
251+
}
252+
243253
/** Returns milliseconds if the given time unit is null. */
244254
private static TimeUnit nullToMillis(TimeUnit unit) {
245255
return unit != null ? unit : TimeUnit.MILLISECONDS;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.apache.jena.sparql.engine.dispach;
2+
3+
import org.apache.jena.query.Query;
4+
import org.apache.jena.query.Syntax;
5+
import org.apache.jena.sparql.core.DatasetGraph;
6+
import org.apache.jena.sparql.engine.binding.Binding;
7+
import org.apache.jena.sparql.exec.QueryExec;
8+
import org.apache.jena.sparql.util.Context;
9+
10+
public interface ChainingQueryDispatcher {
11+
QueryExec create(Query query, DatasetGraph dsg, Binding initialBinding, Context context, QueryDispatcher chain);
12+
QueryExec create(String queryString, Syntax syntax, DatasetGraph dsg, Binding initialBinding, Context context, QueryDispatcher chain);
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.apache.jena.sparql.engine.dispach;
2+
3+
import org.apache.jena.sparql.core.DatasetGraph;
4+
import org.apache.jena.sparql.engine.binding.Binding;
5+
import org.apache.jena.sparql.exec.UpdateExec;
6+
import org.apache.jena.sparql.util.Context;
7+
import org.apache.jena.update.UpdateRequest;
8+
9+
public interface ChainingUpdateDispatcher {
10+
UpdateExec create(String updateRequestString, DatasetGraph dsg, Binding initialBinding, Context context, UpdateDispatcher chain);
11+
UpdateExec create(UpdateRequest updateRequest, DatasetGraph dsg, Binding initialBinding, Context context, UpdateDispatcher chain);
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.apache.jena.sparql.engine.dispach;
2+
3+
import org.apache.jena.query.Query;
4+
import org.apache.jena.query.Syntax;
5+
import org.apache.jena.sparql.core.DatasetGraph;
6+
import org.apache.jena.sparql.engine.binding.Binding;
7+
import org.apache.jena.sparql.exec.QueryExec;
8+
import org.apache.jena.sparql.util.Context;
9+
10+
public interface QueryDispatcher {
11+
QueryExec create(String queryString, Syntax syntax, DatasetGraph dsg, Binding initialBinding, Context context);
12+
QueryExec create(Query query, DatasetGraph dsg, Binding initialBinding, Context context);
13+
}

0 commit comments

Comments
 (0)