Skip to content

Commit 822b239

Browse files
authored
sync develop branch after release 5.1.0 (#5206)
2 parents 410c62c + f462d63 commit 822b239

12 files changed

Lines changed: 210 additions & 18 deletions

File tree

site/content/about.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ The metaphactory platform is developed by [metaphacts GmbH](https://www.metaphac
107107
an RDF service backend for Knowledge Management, used by thesaurus management platform [VocBench](http://vocbench.uniroma2.it/).
108108
- [Sesame Tools](https://github.com/joshsh/sesametools)<br>
109109
a collection of utility classes for use with Sesame/RDF4J.
110+
- [Jelly](https://w3id.org/jelly/jelly-jvm)<br>
111+
a high-performance binary RDF serialization format with an implementation for RDF4J. Can be used as a JAR plugin.

site/content/download.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ toc: true
55

66
You can either retrieve RDF4J via Apache Maven, or download the SDK or onejar directly.
77

8-
## RDF4J 5.0.2 (latest)
8+
## RDF4J 5.0.3 (latest)
99

10-
RDF4J 5.0.2 is our latest stable release. It requires Java 11 minimally.
11-
For details on what’s new and how to upgrade, see the [release and upgrade notes](/release-notes/5.0.2).
10+
RDF4J 5.0.3 is our latest stable release. It requires Java 11 minimally.
11+
For details on what’s new and how to upgrade, see the [release and upgrade notes](/release-notes/5.0.3).
1212

13-
- [RDF4J 5.0.2 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.2-sdk.zip)<br/>
13+
- [RDF4J 5.0.3 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.3-sdk.zip)<br/>
1414
Full Eclipse RDF4J SDK, containing all libraries, RDF4J Server, Workbench, and Console applications, and Javadoc API.
1515

16-
- [RDF4J 5.0.2 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.2-onejar.jar)<br/>
16+
- [RDF4J 5.0.3 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.3-onejar.jar)<br/>
1717
Single jar file for easy inclusion of the full RDF4J toolkit in your Java project.
1818

1919
- [RDF4J artifacts](https://search.maven.org/search?q=org.eclipse.rdf4j) on the [Maven Central Repository](http://search.maven.org/)
@@ -28,7 +28,7 @@ You can include RDF4J as a Maven dependency in your Java project by including th
2828
<dependency>
2929
<groupId>org.eclipse.rdf4j</groupId>
3030
<artifactId>rdf4j-bom</artifactId>
31-
<version>5.0.2</version>
31+
<version>5.0.3</version>
3232
<type>pom</type>
3333
<scope>import</scope>
3434
</dependency>

site/content/news/rdf4j-503.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "RDF4J 5.0.3 released"
3+
date: 2024-11-10T14:15:45+0100
4+
layout: "single"
5+
categories: ["news"]
6+
---
7+
RDF4J 5.0.3 is now available. This is a patch release fixing 11 bugs.
8+
9+
For more details, have a look at the [release notes](/release-notes/5.0.3).
10+
<!--more-->
11+
### Links
12+
13+
- [Download RDF4J](/download/)
14+
- [release notes](/release-notes/5.0.3).

site/content/news/rdf4j-510-M1.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "RDF4J 5.1.0 Milestone 1"
3+
date: 2024-11-10T14:05:43+0100
4+
layout: "single"
5+
categories: ["news"]
6+
---
7+
Milestone number 1 of the upcoming 5.1.0 release of RDF4J is now available for download.
8+
9+
RDF4J 5.1.0 is a minor release focusing on ... .
10+
11+
This milestone build is not yet feature-complete, but we are putting it out to receive early feedback on all the improvements we have put in.
12+
13+
<!--more-->
14+
15+
- [issues fixed in 5.1.0 Milestone 1](https://github.com/eclipse/rdf4j/issues?q=is%3Aissue+label%3AM1+is%3Aclosed+milestone%3A5.1.0)
16+
- [issues planned for 5.1.0](https://github.com/eclipse/rdf4j/milestone/107)
17+
18+
### Links
19+
20+
- [Download RDF4J](/download/)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "5.0.3"
3+
toc: true
4+
---
5+
RDF4J 5.0.3 is a patch release that fixes 11 issues.
6+
7+
For a complete overview, see [all issues fixed in 5.0.3](https://github.com/eclipse/rdf4j/milestone/111?closed=1).
8+
9+
### Acknowledgements
10+
11+
This release was made possible by contributions from Hannes Ebner, Håvard M. Ottestad, Frens Jan Rumph and Andreas Schwarte.

site/static/javadoc/5.0.3.tgz

7.91 MB
Binary file not shown.

site/static/javadoc/5.1.0-M1.tgz

7.96 MB
Binary file not shown.

site/static/javadoc/latest.tgz

895 KB
Binary file not shown.

spring-components/rdf4j-spring/src/main/java/org/eclipse/rdf4j/spring/dao/support/UpdateWithModelBuilder.java

Lines changed: 120 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,38 @@
1313

1414
import java.io.StringWriter;
1515
import java.lang.invoke.MethodHandles;
16-
import java.util.ArrayList;
17-
import java.util.Collection;
18-
import java.util.List;
16+
import java.util.*;
1917
import java.util.function.Consumer;
2018
import java.util.function.Function;
2119

2220
import org.apache.commons.lang3.ObjectUtils;
23-
import org.eclipse.rdf4j.model.BNode;
24-
import org.eclipse.rdf4j.model.IRI;
25-
import org.eclipse.rdf4j.model.Model;
26-
import org.eclipse.rdf4j.model.Namespace;
27-
import org.eclipse.rdf4j.model.Resource;
28-
import org.eclipse.rdf4j.model.Statement;
21+
import org.eclipse.rdf4j.model.*;
22+
import org.eclipse.rdf4j.model.base.AbstractStatement;
23+
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
2924
import org.eclipse.rdf4j.model.util.ModelBuilder;
25+
import org.eclipse.rdf4j.query.Operation;
3026
import org.eclipse.rdf4j.repository.RepositoryConnection;
3127
import org.eclipse.rdf4j.rio.RDFFormat;
3228
import org.eclipse.rdf4j.rio.Rio;
29+
import org.eclipse.rdf4j.spring.support.RDF4JTemplate;
3330
import org.slf4j.Logger;
3431
import org.slf4j.LoggerFactory;
3532

3633
/**
34+
* <p>
35+
* An {@link Operation} that holds a {@link Model} internally and exposes a {@link ModelBuilder} for adding to it.
36+
* Moreover it allows for deleting statements.
37+
* </p>
38+
* <p>
39+
* Thus, the class provides a way of configuring an update to the repository incrementally, and no repository access
40+
* happens until {@link #execute()} is called. (unless the client uses {@link #applyToConnection(Function)} and accesses
41+
* the repository that way.)
42+
* </p>
43+
* Removing statements via {@link #remove} will remove them from the repository when {@link #execute()} is called;
44+
* moreover, the statements will also be removed from the model at the time of the {@link #remove} call, such that a
45+
* subsequent creation of some of the deleted statements to the model will result in those triples being first deleted
46+
* and then added to the repository when {@link #execute()} is called.
47+
*
3748
* @author Florian Kleedorfer
3849
* @since 4.0.0
3950
*/
@@ -42,11 +53,55 @@ public class UpdateWithModelBuilder {
4253
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
4354

4455
private final RepositoryConnection con;
56+
57+
/** the model builder being exposed to clients */
4558
private final ModelBuilder modelBuilder;
59+
/** the model being built by the modelBuilder, and that is going to be added to the repository eventually */
60+
private final Model addModel;
61+
62+
/**
63+
* Set of Statements to be removed from the repository eventually. The Statement implementation used here is the
64+
* {@link WildcardAllowingStatement}, which allows for using wildcards for deletion
65+
*/
66+
private final Set<Statement> removeStatements;
4667

4768
public UpdateWithModelBuilder(RepositoryConnection con) {
4869
this.con = con;
49-
this.modelBuilder = new ModelBuilder();
70+
this.addModel = new LinkedHashModel();
71+
this.removeStatements = new HashSet<>();
72+
this.modelBuilder = new ModelBuilder(addModel);
73+
}
74+
75+
public static UpdateWithModelBuilder fromTemplate(RDF4JTemplate template) {
76+
return template.applyToConnection(con -> new UpdateWithModelBuilder(con));
77+
}
78+
79+
/**
80+
* Will remove statements upon update execution, before processing any additions. Statements that are removed here
81+
* are also removed from the #addModel at the time of this call (not upon update execution)
82+
*
83+
* <p>
84+
* The semantics of {@link RepositoryConnection#remove(Iterable, Resource...)} apply, i.e. the resource(s) specified
85+
* here are used there, if any.
86+
*
87+
* @param subject the subject, or null to match any resource
88+
* @param predicate the predicate, or null to match any IRI
89+
* @param object the object, or null to match any value
90+
* @param resources the context(s), if any
91+
* @return this builder
92+
*/
93+
public UpdateWithModelBuilder remove(
94+
Resource subject, IRI predicate, Value object, Resource... resources) {
95+
addModel.remove(subject, predicate, object, resources);
96+
if (resources.length == 0) {
97+
removeStatements.add(new WildcardAllowingStatement(subject, predicate, object, null));
98+
} else {
99+
for (int i = 0; i < resources.length; i++) {
100+
removeStatements.add(
101+
new WildcardAllowingStatement(subject, predicate, object, resources[i]));
102+
}
103+
}
104+
return this;
50105
}
51106

52107
public UpdateWithModelBuilder setNamespace(Namespace ns) {
@@ -171,9 +226,63 @@ public void execute() {
171226
Model model = modelBuilder.build();
172227
if (logger.isDebugEnabled()) {
173228
StringWriter sw = new StringWriter();
229+
Rio.write(this.removeStatements, sw, RDFFormat.TURTLE);
230+
logger.debug("removing the following triples:\n{}", sw.toString());
231+
sw = new StringWriter();
174232
Rio.write(model, sw, RDFFormat.TURTLE);
175233
logger.debug("adding the following triples:\n{}", sw.toString());
176234
}
177-
con.add(model);
235+
con.remove(this.removeStatements);
236+
con.add(this.addModel);
237+
}
238+
239+
static class WildcardAllowingStatement extends AbstractStatement {
240+
private static final long serialVersionUID = -4116676621136121342L;
241+
private final Resource subject;
242+
private final IRI predicate;
243+
private final Value object;
244+
private final Resource context;
245+
246+
WildcardAllowingStatement(Resource subject, IRI predicate, Value object, Resource context) {
247+
this.subject = subject;
248+
this.predicate = predicate;
249+
this.object = object;
250+
this.context = context;
251+
}
252+
253+
public Resource getSubject() {
254+
return this.subject;
255+
}
256+
257+
public IRI getPredicate() {
258+
return this.predicate;
259+
}
260+
261+
public Value getObject() {
262+
return this.object;
263+
}
264+
265+
public Resource getContext() {
266+
return this.context;
267+
}
268+
269+
@Override
270+
public boolean equals(Object o) {
271+
if (this == o)
272+
return true;
273+
if (o == null || getClass() != o.getClass())
274+
return false;
275+
WildcardAllowingStatement that = (WildcardAllowingStatement) o;
276+
return Objects.equals(getSubject(), that.getSubject())
277+
&& Objects.equals(getPredicate(), that.getPredicate())
278+
&& Objects.equals(getObject(), that.getObject())
279+
&& Objects.equals(getContext(), that.getContext());
280+
}
281+
282+
@Override
283+
public int hashCode() {
284+
return Objects.hash(
285+
super.hashCode(), getSubject(), getPredicate(), getObject(), getContext());
286+
}
178287
}
179288
}

spring-components/rdf4j-spring/src/test/java/org/eclipse/rdf4j/spring/dao/support/ServiceLayerTests.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.eclipse.rdf4j.spring.RDF4JSpringTestBase;
2121
import org.eclipse.rdf4j.spring.domain.model.Artist;
22+
import org.eclipse.rdf4j.spring.domain.model.EX;
2223
import org.eclipse.rdf4j.spring.domain.model.Painting;
2324
import org.eclipse.rdf4j.spring.domain.service.ArtService;
2425
import org.eclipse.rdf4j.spring.support.RDF4JTemplate;
@@ -63,6 +64,19 @@ public void testCreatePainting() {
6364
assertTrue(painting.getId().toString().startsWith("urn:uuid"));
6465
}
6566

67+
@Test
68+
public void testChangeArtist() {
69+
Artist artist = artService.createArtist("Jan", "Vermeer");
70+
Painting painting = artService.createPainting("Cypresses", "oil on canvas", artist.getId());
71+
assertNotNull(painting.getId());
72+
assertTrue(painting.getId().toString().startsWith("urn:uuid"));
73+
assertEquals(artist.getId(), painting.getArtistId());
74+
artService.changeArtist(painting.getId(), EX.VanGogh);
75+
painting = artService.getPainting(painting.getId());
76+
assertNotNull(painting);
77+
assertEquals(EX.VanGogh, painting.getArtistId());
78+
}
79+
6680
@Test
6781
public void testCreatePaintingWithoutArtist() {
6882
assertThrows(NullPointerException.class, () -> artService.createPainting(
@@ -71,7 +85,6 @@ public void testCreatePaintingWithoutArtist() {
7185
null));
7286
}
7387

74-
// TODO
7588
@Test
7689
public void testRollbackOnException() {
7790
transactionTemplate.execute(status -> {

0 commit comments

Comments
 (0)