Skip to content

Commit 985beac

Browse files
authored
sync develop branch after release 5.0.2 (#5099)
2 parents 51f044a + 0173d84 commit 985beac

8 files changed

Lines changed: 174 additions & 46 deletions

File tree

core/rio/api/src/test/java/org/eclipse/rdf4j/rio/AbstractParserHandlingTest.java

Lines changed: 112 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package org.eclipse.rdf4j.rio;
1212

1313
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
import static org.junit.jupiter.api.Assertions.assertFalse;
1415
import static org.junit.jupiter.api.Assertions.assertNotEquals;
1516
import static org.junit.jupiter.api.Assertions.assertTrue;
1617
import static org.junit.jupiter.api.Assertions.fail;
@@ -19,10 +20,12 @@
1920
import java.io.ByteArrayOutputStream;
2021
import java.io.InputStream;
2122
import java.io.OutputStream;
23+
import java.util.Collection;
2224
import java.util.Collections;
2325
import java.util.Date;
2426
import java.util.HashSet;
2527
import java.util.Locale;
28+
import java.util.Map;
2629

2730
import org.eclipse.rdf4j.model.BNode;
2831
import org.eclipse.rdf4j.model.IRI;
@@ -115,7 +118,7 @@ public abstract class AbstractParserHandlingTest {
115118

116119
private ParseErrorCollector testListener;
117120

118-
private Model testStatements;
121+
private TestStatementCollector testStatements;
119122

120123
/**
121124
* Returns an {@link InputStream} containing the given RDF statements in a format that is recognised by the
@@ -211,20 +214,90 @@ protected RDFWriter createWriter(OutputStream output) {
211214
}
212215

213216
/**
217+
*
214218
*/
215219
@BeforeEach
216220
public void setUp() {
217221
testParser = getParser();
218222

219223
testParser.setValueFactory(vf);
220224
testListener = new ParseErrorCollector();
221-
testStatements = new LinkedHashModel();
225+
testStatements = new TestStatementCollector(new LinkedHashModel());
222226

223227
testParser.setParseErrorListener(testListener);
224-
testParser.setRDFHandler(new StatementCollector(testStatements));
228+
testParser.setRDFHandler(testStatements);
229+
}
230+
231+
private class TestStatementCollector extends StatementCollector {
232+
233+
private boolean start;
234+
private boolean end;
235+
236+
public TestStatementCollector(Model testStatements) {
237+
super(testStatements);
238+
}
239+
240+
@Override
241+
public void clear() {
242+
super.clear();
243+
this.start = false;
244+
this.end = false;
245+
}
246+
247+
@Override
248+
public void startRDF() throws RDFHandlerException {
249+
assertFalse(start, "startRDF was called twice");
250+
assertFalse(end, "startRDF was called after endRDF");
251+
this.start = true;
252+
super.startRDF();
253+
}
254+
255+
@Override
256+
public void endRDF() throws RDFHandlerException {
257+
assertTrue(start, "startRDF was not called before endRDF");
258+
assertFalse(end, "endRDF was called twice");
259+
this.end = true;
260+
super.endRDF();
261+
}
262+
263+
@Override
264+
public void handleComment(String comment) throws RDFHandlerException {
265+
assertTrue(start, "startRDF was not called before handleComment");
266+
assertFalse(end, "endRDF was called before handleComment");
267+
super.handleComment(comment);
268+
}
269+
270+
@Override
271+
public void handleStatement(Statement st) {
272+
assertTrue(start, "startRDF was not called before handleStatement");
273+
assertFalse(end, "endRDF was called before handleStatement");
274+
super.handleStatement(st);
275+
}
276+
277+
@Override
278+
public void handleNamespace(String prefix, String uri) throws RDFHandlerException {
279+
assertTrue(start, "startRDF was not called before handleNamespace");
280+
assertFalse(end, "endRDF was called before handleNamespace");
281+
super.handleNamespace(prefix, uri);
282+
}
283+
284+
@Override
285+
public Collection<Statement> getStatements() {
286+
assertTrue(start, "startRDF was not called before getStatements");
287+
assertTrue(end, "endRDF was not called before getStatements");
288+
return super.getStatements();
289+
}
290+
291+
@Override
292+
public Map<String, String> getNamespaces() {
293+
assertTrue(start, "startRDF was not called before getStatements");
294+
assertTrue(end, "endRDF was not called before getStatements");
295+
return super.getNamespaces();
296+
}
225297
}
226298

227299
/**
300+
*
228301
*/
229302
@AfterEach
230303
public void tearDown() {
@@ -390,6 +463,9 @@ public void testUnknownDatatypeWithMessageWithFailCase1() throws Exception {
390463
}
391464

392465
assertErrorListener(0, 1, 0);
466+
// Since the parser failed it would not have called endRdf(), so we just overwrite the end variable so that
467+
// assertModel(...) doesn't fail
468+
testStatements.end = true;
393469
assertModel(new LinkedHashModel());
394470
}
395471

@@ -699,6 +775,9 @@ public void testUnknownLanguageWithMessageWithFailCase1() throws Exception {
699775
}
700776

701777
assertErrorListener(0, 1, 0);
778+
// Since the parser failed it would not have called endRdf(), so we just overwrite the end variable so that
779+
// assertModel(...) doesn't fail
780+
testStatements.end = true;
702781
assertModel(new LinkedHashModel());
703782
}
704783

@@ -917,12 +996,13 @@ public void testSkolemization() throws Exception {
917996

918997
assertErrorListener(0, 0, 0);
919998
// assertModel(expectedModel); // GH-2768 isomorphism is not maintained after skolemization
920-
assertNotEquals(new HashSet<>(expectedModel), new HashSet<>(testStatements)); // blank nodes not preserved
921-
assertTrue(Models.subjectBNodes(testStatements).isEmpty()); // skolemized
999+
assertNotEquals(new HashSet<>(expectedModel), new HashSet<>(testStatements.getStatements())); // blank nodes not
1000+
// preserved
1001+
assertTrue(Models.subjectBNodes(testStatements.getStatements()).isEmpty()); // skolemized
9221002
}
9231003

9241004
@Test
925-
public void testRDFStarCompatibility() throws Exception {
1005+
public void testRDFStarCompatibility1() throws Exception {
9261006
Model expectedModel = new LinkedHashModel();
9271007
Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"),
9281008
vf.createLiteral("example", vf.createIRI("http://example.com/3")));
@@ -939,9 +1019,20 @@ public void testRDFStarCompatibility() throws Exception {
9391019
testParser.parse(input1, BASE_URI);
9401020
assertErrorListener(0, 0, 0);
9411021
assertModel(expectedModel);
1022+
}
9421023

943-
testListener.reset();
944-
testStatements.clear();
1024+
@Test
1025+
public void testRDFStarCompatibility2() throws Exception {
1026+
Model expectedModel = new LinkedHashModel();
1027+
Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"),
1028+
vf.createLiteral("example", vf.createIRI("http://example.com/3")));
1029+
expectedModel.add(vf.createStatement(t1, DC.SOURCE, vf.createIRI("http://example.com/4")));
1030+
Triple t2 = vf.createTriple(t1, DC.DATE, vf.createLiteral(new Date()));
1031+
expectedModel.add(vf.createStatement(vf.createIRI("http://example.com/5"), DC.RELATION, t2));
1032+
Triple t3 = vf.createTriple(vf.createTriple(vf.createTriple(vf.createIRI("urn:a"), RDF.TYPE,
1033+
vf.createIRI("urn:b")), vf.createIRI("urn:c"), vf.createIRI("urn:d")), vf.createIRI("urn:e"),
1034+
vf.createIRI("urn:f"));
1035+
expectedModel.add(vf.createStatement(t3, vf.createIRI("urn:same"), t3));
9451036

9461037
// Turn off compatibility on parsing: formats with RDF-star support will produce RDF-star triples,
9471038
// non-RDF-star formats will produce IRIs of the kind urn:rdf4j:triple:xxx
@@ -952,22 +1043,26 @@ public void testRDFStarCompatibility() throws Exception {
9521043
if (testParser.getRDFFormat().supportsRDFStar()) {
9531044
assertModel(expectedModel);
9541045
} else {
955-
assertTrue(testStatements.contains(RDFStarUtil.toRDFEncodedValue(t1), DC.SOURCE,
956-
vf.createIRI("http://example.com/4")));
957-
assertTrue(testStatements.contains(vf.createIRI("http://example.com/5"), DC.RELATION,
958-
RDFStarUtil.toRDFEncodedValue(t2)));
959-
assertTrue(testStatements.contains(RDFStarUtil.toRDFEncodedValue(t3), vf.createIRI("urn:same"),
960-
RDFStarUtil.toRDFEncodedValue(t3)));
961-
assertEquals(3, testStatements.size());
1046+
assertTrue(testStatements.getStatements()
1047+
.contains(vf.createStatement(RDFStarUtil.toRDFEncodedValue(t1), DC.SOURCE,
1048+
vf.createIRI("http://example.com/4"))));
1049+
assertTrue(testStatements.getStatements()
1050+
.contains(vf.createStatement(vf.createIRI("http://example.com/5"), DC.RELATION,
1051+
RDFStarUtil.toRDFEncodedValue(t2))));
1052+
assertTrue(testStatements.getStatements()
1053+
.contains(vf.createStatement(RDFStarUtil.toRDFEncodedValue(t3), vf.createIRI("urn:same"),
1054+
RDFStarUtil.toRDFEncodedValue(t3))));
1055+
assertEquals(3, testStatements.getStatements().size());
9621056
}
9631057
}
9641058

9651059
private void assertModel(Model expectedModel) {
9661060
if (logger.isTraceEnabled()) {
9671061
logger.trace("Expected: {}", expectedModel);
968-
logger.trace("Actual: {}", testStatements);
1062+
logger.trace("Actual: {}", testStatements.getStatements());
9691063
}
970-
assertTrue(Models.isomorphic(expectedModel, testStatements), "Did not find expected statements");
1064+
assertTrue(Models.isomorphic(expectedModel, testStatements.getStatements()),
1065+
"Did not find expected statements");
9711066
}
9721067

9731068
private void assertErrorListener(int expectedWarnings, int expectedErrors, int expectedFatalErrors) {

core/rio/jsonld/src/main/java/org/eclipse/rdf4j/rio/jsonld/JSONLDParser.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import java.net.URI;
2121
import java.net.URISyntaxException;
2222
import java.util.Collection;
23-
import java.util.HashSet;
24-
import java.util.List;
2523
import java.util.Optional;
2624
import java.util.Set;
2725
import java.util.function.BiConsumer;
@@ -44,9 +42,6 @@
4442
import org.slf4j.Logger;
4543
import org.slf4j.LoggerFactory;
4644

47-
import com.fasterxml.jackson.core.type.TypeReference;
48-
import com.fasterxml.jackson.databind.ObjectMapper;
49-
5045
import jakarta.json.JsonObject;
5146
import jakarta.json.JsonString;
5247
import jakarta.json.JsonStructure;
@@ -125,6 +120,10 @@ private void parse(InputStream in, Reader reader, String baseURI)
125120
throws RDFParseException, RDFHandlerException, IOException {
126121
clear();
127122

123+
if (rdfHandler != null) {
124+
rdfHandler.startRDF();
125+
}
126+
128127
try {
129128

130129
Document document = getDocument(in, reader);
@@ -179,6 +178,9 @@ private void parse(InputStream in, Reader reader, String baseURI)
179178
}
180179

181180
RDFHandler rdfHandler = getRDFHandler();
181+
if (rdfHandler != null) {
182+
extractPrefixes(document, rdfHandler::handleNamespace);
183+
}
182184

183185
JsonLd.toRdf(document).options(opts).base(baseURI).get(new RdfConsumer<>() {
184186
@Override
@@ -242,7 +244,7 @@ public Literal createLangString(String value, String lang) {
242244
});
243245

244246
if (rdfHandler != null) {
245-
extractPrefixes(document, rdfHandler::handleNamespace);
247+
rdfHandler.endRDF();
246248
}
247249

248250
} catch (no.hasmac.jsonld.JsonLdError e) {

scripts/release.sh

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ mvn versions:set -DnewVersion="${MVN_VERSION_RELEASE}"
167167
mvn versions:commit
168168

169169

170-
171170
# delete old release branch if it exits
172171
if git show-ref --verify --quiet "refs/heads/${BRANCH}"; then
173172
git branch --delete --force "${BRANCH}" &>/dev/null
@@ -180,20 +179,11 @@ git tag "${MVN_VERSION_RELEASE}"
180179

181180
echo "";
182181
echo "Pushing release branch to github"
183-
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
184182

185183
# push release branch and tag
186184
git push -u origin "${BRANCH}"
187185
git push origin "${MVN_VERSION_RELEASE}"
188186

189-
echo "";
190-
echo "You need to tell Jenkins to start the release deployment processes, for SDK and maven artifacts"
191-
echo "- SDK deployment: https://ci.eclipse.org/rdf4j/job/rdf4j-deploy-release-sdk/ "
192-
echo "- Maven deployment: https://ci.eclipse.org/rdf4j/job/rdf4j-deploy-release-ossrh/ "
193-
echo "(if you are on linux or windows, remember to use CTRL+SHIFT+C to copy)."
194-
echo "Log in, then choose 'Build with Parameters' and type in ${MVN_VERSION_RELEASE}"
195-
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
196-
197187
# Cleanup
198188
mvn clean -Dmaven.clean.failOnError=false
199189
mvn clean -Dmaven.clean.failOnError=false
@@ -219,15 +209,13 @@ git push
219209

220210
echo "";
221211
echo "About to create PR"
222-
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
223212
echo "";
224213

225214
echo "Creating pull request to merge release branch back into main"
226-
gh pr create --title "next development iteration: ${MVN_NEXT_SNAPSHOT_VERSION}" --body "Merge using merge commit rather than rebase"
215+
gh pr create -B main --title "next development iteration: ${MVN_NEXT_SNAPSHOT_VERSION}" --body "Merge using merge commit rather than rebase"
227216

228217
echo "";
229218
echo "Preparing a merge-branch to merge into develop"
230-
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
231219

232220

233221

@@ -241,7 +229,7 @@ git push --set-upstream origin "merge_main_into_develop_after_release_${MVN_VERS
241229

242230
echo "Creating pull request to merge the merge-branch into develop"
243231
gh pr create -B develop --title "sync develop branch after release ${MVN_VERSION_RELEASE}" --body "Merge using merge commit rather than rebase"
244-
echo "It's ok to merge this PR later, so wait for the Jenkins tests to finish."
232+
echo "It's ok to merge this PR later, so wait for the CI tests to finish."
245233
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
246234

247235
mvn clean -Dmaven.clean.failOnError=false
@@ -255,7 +243,6 @@ mvn clean -Dmaven.clean.failOnError=false
255243
mvn clean -Dmaven.clean.failOnError=false
256244

257245
echo "Build javadocs"
258-
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
259246

260247
git checkout "${MVN_VERSION_RELEASE}"
261248

@@ -277,7 +264,7 @@ cp -f "site/static/javadoc/${MVN_VERSION_RELEASE}.tgz" "site/static/javadoc/late
277264
git add --all
278265
git commit -s -a -m "javadocs for ${MVN_VERSION_RELEASE}"
279266
git push --set-upstream origin "${RELEASE_NOTES_BRANCH}"
280-
gh pr create -B main --title "${RELEASE_NOTES_BRANCH}" --body "Javadocs, release-notes and news item for ${MVN_VERSION_RELEASE}"
267+
gh pr create -B main --title "${RELEASE_NOTES_BRANCH}" --body "Javadocs, release-notes and news item for ${MVN_VERSION_RELEASE}.\n\n - [ ] check that [Jenkins](https://ci.eclipse.org/rdf4j/) finished publishing the release\n - [ ] remember to also [add the release here on GitHub](https://github.com/eclipse-rdf4j/rdf4j/releases/new?tag=${MVN_VERSION_RELEASE}&title=RDF4JRDF4J%20${MVN_VERSION_RELEASE}) (include announcement)"
281268

282269
echo "Javadocs are in git branch ${RELEASE_NOTES_BRANCH}"
283270

@@ -289,7 +276,13 @@ cd scripts
289276
echo ""
290277
echo "DONE!"
291278

292-
279+
echo "";
280+
echo "You need to tell Jenkins to start the release deployment processes, for SDK and maven artifacts"
281+
echo "- SDK deployment: https://ci.eclipse.org/rdf4j/job/rdf4j-deploy-release-sdk/ "
282+
echo "- Maven deployment: https://ci.eclipse.org/rdf4j/job/rdf4j-deploy-release-ossrh/ "
283+
echo "(if you are on linux or windows, remember to use CTRL+SHIFT+C to copy)."
284+
echo "Log in, then choose 'Build with Parameters' and type in ${MVN_VERSION_RELEASE}"
285+
read -n 1 -srp "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
293286

294287
echo ""
295288
echo "You will now want to inform the community about the new release!"

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.0 (latest)
8+
## RDF4J 5.0.1 (latest)
99

10-
RDF4J 5.0.0 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.0).
10+
RDF4J 5.0.1 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.1).
1212

13-
- [RDF4J 5.0.0 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-sdk.zip)<br/>
13+
- [RDF4J 5.0.1 SDK (zip)](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.1-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.0 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.0-onejar.jar)<br/>
16+
- [RDF4J 5.0.1 onejar](http://www.eclipse.org/downloads/download.php?file=/rdf4j/eclipse-rdf4j-5.0.1-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.0</version>
31+
<version>5.0.1</version>
3232
<type>pom</type>
3333
<scope>import</scope>
3434
</dependency>

site/content/news/rdf4j-501.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.1 released"
3+
date: 2024-07-09T17:08:30+0200
4+
layout: "single"
5+
categories: ["news"]
6+
---
7+
RDF4J 5.0.1 is now available. This is a patch release fixing 8 bugs.
8+
9+
For more details, have a look at the [release notes](/release-notes/5.0.1).
10+
<!--more-->
11+
### Links
12+
13+
- [Download RDF4J](/download/)
14+
- [release notes](/release-notes/5.0.1).

0 commit comments

Comments
 (0)