Skip to content

Commit 9344af7

Browse files
committed
GH-3654 fixes to be more compatible with existing code
1 parent b4db49a commit 9344af7

File tree

23 files changed

+184
-291
lines changed

23 files changed

+184
-291
lines changed

core/common/iterator/src/main/java/org/eclipse/rdf4j/common/iteration/FilterIteration.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ private void findNextElement() {
101101
}
102102
}
103103
}
104-
while (nextElement == null && wrappedIter.hasNext()) {
104+
105+
// We know that nextElement has to be null and that wrappedIter.hasNext() must be true, based on the code
106+
// above. To be sure that these invariants don't change we also assert them below.
107+
assert nextElement == null && wrappedIter.hasNext();
108+
109+
do {
105110
E result;
106111
if (Thread.currentThread().isInterrupted()) {
107112
close();
@@ -118,7 +123,8 @@ private void findNextElement() {
118123
if (accept(candidate)) {
119124
nextElement = candidate;
120125
}
121-
}
126+
} while (nextElement == null && wrappedIter.hasNext());
127+
122128
} finally {
123129
if (isClosed()) {
124130
nextElement = null;

core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/DefaultEvaluationStrategy.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -976,11 +976,6 @@ protected QueryValueEvaluationStep prepare(Lang node, QueryEvaluationContext con
976976
return QueryValueEvaluationStepSupplier.prepareLang(arg, tripleSource.getValueFactory());
977977
}
978978

979-
public Value evaluate(Datatype node, BindingSet bindings) throws QueryEvaluationException {
980-
return prepare(node, new QueryEvaluationContext.Minimal(dataset, tripleSource.getComparator()))
981-
.evaluate(bindings);
982-
}
983-
984979
protected QueryValueEvaluationStep prepare(Datatype node, QueryEvaluationContext context) {
985980
QueryValueEvaluationStep arg = precompile(node.getArg(), context);
986981
return QueryValueEvaluationStepSupplier.prepareDatatype(arg, context);

core/rio/api/pom.xml

Lines changed: 102 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,105 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<parent>
5-
<groupId>org.eclipse.rdf4j</groupId>
6-
<artifactId>rdf4j-rio</artifactId>
7-
<version>5.0.0-SNAPSHOT</version>
8-
</parent>
9-
<artifactId>rdf4j-rio-api</artifactId>
10-
<name>RDF4J: Rio - API</name>
11-
<description>Rio API.</description>
12-
<dependencies>
13-
<dependency>
14-
<groupId>${project.groupId}</groupId>
15-
<artifactId>rdf4j-model</artifactId>
16-
<version>${project.version}</version>
17-
</dependency>
18-
<dependency>
19-
<groupId>${project.groupId}</groupId>
20-
<artifactId>rdf4j-common-xml</artifactId>
21-
<version>${project.version}</version>
22-
</dependency>
23-
<dependency>
24-
<groupId>commons-codec</groupId>
25-
<artifactId>commons-codec</artifactId>
26-
</dependency>
27-
<dependency>
28-
<groupId>com.github.jsonld-java</groupId>
29-
<artifactId>jsonld-java</artifactId>
30-
<exclusions>
31-
<exclusion>
32-
<groupId>com.fasterxml.jackson.core</groupId>
33-
<artifactId>jackson-annotations</artifactId>
34-
</exclusion>
35-
<exclusion>
36-
<groupId>com.fasterxml.jackson.core</groupId>
37-
<artifactId>jackson-core</artifactId>
38-
</exclusion>
39-
<exclusion>
40-
<groupId>com.fasterxml.jackson.core</groupId>
41-
<artifactId>jackson-databind</artifactId>
42-
</exclusion>
43-
</exclusions>
44-
</dependency>
45-
<dependency>
46-
<groupId>commons-io</groupId>
47-
<artifactId>commons-io</artifactId>
48-
<scope>test</scope>
49-
</dependency>
50-
</dependencies>
51-
<build>
52-
<plugins>
53-
<plugin>
54-
<groupId>org.apache.maven.plugins</groupId>
55-
<artifactId>maven-jar-plugin</artifactId>
56-
<executions>
57-
<execution>
58-
<goals>
59-
<goal>test-jar</goal>
60-
</goals>
61-
</execution>
62-
</executions>
63-
</plugin>
64-
</plugins>
65-
</build>
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.eclipse.rdf4j</groupId>
6+
<artifactId>rdf4j-rio</artifactId>
7+
<version>5.0.0-SNAPSHOT</version>
8+
</parent>
9+
<artifactId>rdf4j-rio-api</artifactId>
10+
<name>RDF4J: Rio - API</name>
11+
<description>Rio API.</description>
12+
<dependencies>
13+
<dependency>
14+
<groupId>${project.groupId}</groupId>
15+
<artifactId>rdf4j-model</artifactId>
16+
<version>${project.version}</version>
17+
</dependency>
18+
<dependency>
19+
<groupId>${project.groupId}</groupId>
20+
<artifactId>rdf4j-common-xml</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>commons-codec</groupId>
25+
<artifactId>commons-codec</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>no.hasmac</groupId>
29+
<artifactId>hasmac-json-ld</artifactId>
30+
<version>0.9.0</version>
31+
<exclusions>
32+
<exclusion>
33+
<groupId>com.google.guava</groupId>
34+
<artifactId>guava</artifactId>
35+
</exclusion>
36+
<exclusion>
37+
<groupId>jakarta.json</groupId>
38+
<artifactId>jakarta.json-api</artifactId>
39+
</exclusion>
40+
<exclusion>
41+
<groupId>org.glassfish</groupId>
42+
<artifactId>jakarta.json</artifactId>
43+
</exclusion>
44+
</exclusions>
45+
</dependency>
46+
<dependency>
47+
<groupId>com.github.jsonld-java</groupId>
48+
<artifactId>jsonld-java</artifactId>
49+
<exclusions>
50+
<exclusion>
51+
<groupId>com.fasterxml.jackson.core</groupId>
52+
<artifactId>jackson-annotations</artifactId>
53+
</exclusion>
54+
<exclusion>
55+
<groupId>com.fasterxml.jackson.core</groupId>
56+
<artifactId>jackson-core</artifactId>
57+
</exclusion>
58+
<exclusion>
59+
<groupId>com.fasterxml.jackson.core</groupId>
60+
<artifactId>jackson-databind</artifactId>
61+
</exclusion>
62+
<exclusion>
63+
<groupId>commons-io</groupId>
64+
<artifactId>commons-io</artifactId>
65+
</exclusion>
66+
<exclusion>
67+
<groupId>org.apache.httpcomponents</groupId>
68+
<artifactId>httpclient-osgi</artifactId>
69+
</exclusion>
70+
<exclusion>
71+
<groupId>org.apache.httpcomponents</groupId>
72+
<artifactId>httpcore-osgi</artifactId>
73+
</exclusion>
74+
<exclusion>
75+
<groupId>org.slf4j</groupId>
76+
<artifactId>slf4j-api</artifactId>
77+
</exclusion>
78+
<exclusion>
79+
<groupId>org.slf4j</groupId>
80+
<artifactId>jcl-over-slf4j</artifactId>
81+
</exclusion>
82+
</exclusions>
83+
</dependency>
84+
<dependency>
85+
<groupId>commons-io</groupId>
86+
<artifactId>commons-io</artifactId>
87+
<scope>test</scope>
88+
</dependency>
89+
</dependencies>
90+
<build>
91+
<plugins>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-jar-plugin</artifactId>
95+
<executions>
96+
<execution>
97+
<goals>
98+
<goal>test-jar</goal>
99+
</goals>
100+
</execution>
101+
</executions>
102+
</plugin>
103+
</plugins>
104+
</build>
66105
</project>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022 Eclipse RDF4J contributors.
2+
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Distribution License v1.0
@@ -8,15 +8,14 @@
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
1010
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.jsonld.legacy;
11+
package org.eclipse.rdf4j.rio.helpers;
1212

1313
/**
1414
* Specifies constants to identify various modes that are relevant to JSONLD documents.
1515
*
1616
* @author Peter Ansell
1717
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#features">JSONLD Features</a>
1818
*
19-
* @since 4.3.0
2019
*/
2120
public enum JSONLDMode {
2221

@@ -26,6 +25,8 @@ public enum JSONLDMode {
2625

2726
FLATTEN("Flattening", "http://json-ld.org/spec/latest/json-ld-api/index.html#flattening"),
2827

28+
FRAME("Framing", "https://www.w3.org/TR/json-ld11-framing/"),
29+
2930
;
3031

3132
private final String label;

core/rio/jsonld/src/main/java/org/eclipse/rdf4j/rio/jsonld/JSONLDSettings.java renamed to core/rio/api/src/main/java/org/eclipse/rdf4j/rio/helpers/JSONLDSettings.java

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022 Eclipse RDF4J contributors.
2+
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Distribution License v1.0
@@ -8,12 +8,11 @@
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
1010
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.jsonld;
11+
package org.eclipse.rdf4j.rio.helpers;
1212

1313
import org.eclipse.rdf4j.rio.RioSetting;
14-
import org.eclipse.rdf4j.rio.helpers.BooleanRioSetting;
15-
import org.eclipse.rdf4j.rio.helpers.ClassRioSetting;
16-
import org.eclipse.rdf4j.rio.helpers.RioSettingImpl;
14+
15+
import com.github.jsonldjava.core.DocumentLoader;
1716

1817
import no.hasmac.jsonld.document.Document;
1918

@@ -22,8 +21,6 @@
2221
*
2322
* @author Peter Ansell
2423
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
25-
*
26-
* @since 4.3.0
2724
*/
2825
public class JSONLDSettings {
2926

@@ -36,10 +33,19 @@ public class JSONLDSettings {
3633
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.compact_arrays}.
3734
*
3835
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
36+
*
3937
*/
4038
public static final RioSetting<Boolean> COMPACT_ARRAYS = new BooleanRioSetting(
4139
"org.eclipse.rdf4j.rio.jsonld.compact_arrays", "Compact arrays", Boolean.TRUE);
4240

41+
/**
42+
* If specified, it is used to retrieve remote documents and contexts; otherwise the processor's built-in loader is
43+
* used.
44+
*
45+
*/
46+
public static final RioSetting<DocumentLoader> DOCUMENT_LOADER = new ClassRioSetting<>(
47+
"org.eclipse.rdf4j.rio.jsonld.document_loader", "Document loader", null);
48+
4349
/**
4450
* The JSON-LD context to use when expanding JSON-LD
4551
*
@@ -65,6 +71,37 @@ public class JSONLDSettings {
6571
"Throw an exception when logging a warning.",
6672
Boolean.FALSE);
6773

74+
/**
75+
* If set to true, the JSON-LD processor is allowed to optimize the output of the
76+
* <a href= "http://json-ld.org/spec/latest/json-ld-api/#compaction-algorithm" >Compaction algorithm</a> to produce
77+
* even compacter representations.
78+
* <p>
79+
* Defaults to false.
80+
* <p>
81+
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.optimize}.
82+
*
83+
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
84+
*
85+
*/
86+
public static final RioSetting<Boolean> OPTIMIZE = new BooleanRioSetting("org.eclipse.rdf4j.rio.jsonld.optimize",
87+
"Optimize output", Boolean.FALSE);
88+
89+
/**
90+
* If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.
91+
* <p>
92+
* Note: the use of blank node identifiers to label properties is obsolete, and may be removed in a future version
93+
* of JSON-LD,
94+
* <p>
95+
* Defaults to false.
96+
* <p>
97+
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf}.
98+
*
99+
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
100+
*
101+
*/
102+
public static final RioSetting<Boolean> PRODUCE_GENERALIZED_RDF = new BooleanRioSetting(
103+
"org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf", "Produce generalized RDF", Boolean.FALSE);
104+
68105
/**
69106
* If set to true, the JSON-LD processor will try to convert typed values to JSON native types instead of using the
70107
* expanded object form when converting from RDF. xsd:boolean values will be converted to true or false. xsd:integer
@@ -75,6 +112,7 @@ public class JSONLDSettings {
75112
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.use_native_types}.
76113
*
77114
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
115+
*
78116
*/
79117
public static final RioSetting<Boolean> USE_NATIVE_TYPES = new BooleanRioSetting(
80118
"org.eclipse.rdf4j.rio.jsonld.use_native_types", "Use Native JSON Types", Boolean.FALSE);
@@ -88,6 +126,7 @@ public class JSONLDSettings {
88126
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.use_rdf_type}.
89127
*
90128
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
129+
*
91130
*/
92131
public static final RioSetting<Boolean> USE_RDF_TYPE = new BooleanRioSetting(
93132
"org.eclipse.rdf4j.rio.jsonld.use_rdf_type", "Use RDF Type", Boolean.FALSE);
@@ -98,6 +137,7 @@ public class JSONLDSettings {
98137
* Defaults to {@link JSONLDMode#EXPAND} to provide maximum RDF compatibility.
99138
*
100139
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#features">JSONLD Features</a>
140+
*
101141
*/
102142
public static final RioSetting<JSONLDMode> JSONLD_MODE = new RioSettingImpl<>(
103143
"org.eclipse.rdf4j.rio.jsonld_mode", "JSONLD Mode", JSONLDMode.EXPAND);
@@ -108,25 +148,11 @@ public class JSONLDSettings {
108148
* Default to false
109149
* <p>
110150
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.hierarchical_view}.
151+
*
111152
*/
112153
public static final RioSetting<Boolean> HIERARCHICAL_VIEW = new BooleanRioSetting(
113154
"org.eclipse.rdf4j.rio.jsonld.hierarchical_view", "Hierarchical representation of the JSON", Boolean.FALSE);
114155

115-
/**
116-
* If set to true, the JSON-LD processor may emit blank nodes for triple predicates, otherwise they will be omitted.
117-
* <p>
118-
* Note: the use of blank node identifiers to label properties is obsolete, and may be removed in a future version
119-
* of JSON-LD,
120-
* <p>
121-
* Defaults to false.
122-
* <p>
123-
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf}.
124-
*
125-
* @see <a href="http://json-ld.org/spec/latest/json-ld-api/#data-structures">JSONLD Data Structures</a>
126-
*/
127-
public static final RioSetting<Boolean> PRODUCE_GENERALIZED_RDF = new BooleanRioSetting(
128-
"org.eclipse.rdf4j.rio.jsonld.produce_generalized_rdf", "Produce generalized RDF", Boolean.FALSE);
129-
130156
/**
131157
* Private default constructor.
132158
*/

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.rdf4j.rio.RDFParser;
2525
import org.eclipse.rdf4j.rio.RioSetting;
2626
import org.eclipse.rdf4j.rio.helpers.AbstractRDFParser;
27+
import org.eclipse.rdf4j.rio.helpers.JSONLDSettings;
2728
import org.eclipse.rdf4j.rio.helpers.JSONSettings;
2829

2930
import com.fasterxml.jackson.core.JsonFactory;

0 commit comments

Comments
 (0)