Skip to content

Commit 029961e

Browse files
committed
GH-3654 switch to hasmac-jsonld a fork of titanium with improved performance
1 parent 5e9dd5b commit 029961e

File tree

72 files changed

+4061
-1087
lines changed

Some content is hidden

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

72 files changed

+4061
-1087
lines changed

core/repository/sail/src/main/java/org/eclipse/rdf4j/repository/sail/config/SailRepositorySchema.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class SailRepositorySchema {
3232
public static final String NAMESPACE = "http://www.openrdf.org/config/repository/sail#";
3333

3434
/**
35-
* @deprecated use {@link CONFIG#impl} instead.
35+
* @deprecated use {@link CONFIG.Sail#impl} instead.
3636
*/
3737
public final static IRI SAILIMPL = iri(NAMESPACE, "sailImpl");
3838
}

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

+41-41
Large diffs are not rendered by default.

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.io.OutputStreamWriter;
3333
import java.io.Reader;
3434
import java.io.Writer;
35+
import java.nio.charset.StandardCharsets;
3536
import java.util.ArrayList;
3637
import java.util.Arrays;
3738
import java.util.Collection;
@@ -66,7 +67,6 @@
6667
import org.eclipse.rdf4j.model.vocabulary.SPIN;
6768
import org.eclipse.rdf4j.rio.helpers.BasicParserSettings;
6869
import org.eclipse.rdf4j.rio.helpers.BasicWriterSettings;
69-
import org.eclipse.rdf4j.rio.helpers.JSONLDMode;
7070
import org.eclipse.rdf4j.rio.helpers.StatementCollector;
7171
import org.junit.jupiter.api.Test;
7272
import org.junit.jupiter.api.io.TempDir;
@@ -446,6 +446,8 @@ private void testRoundTripInternal(boolean preserveBNodeIds)
446446
rdfWriter.handleStatement(st30);
447447
rdfWriter.endRDF();
448448

449+
System.out.println(out.toString(StandardCharsets.UTF_8));
450+
449451
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
450452
RDFParser rdfParser = rdfParserFactory.getParser();
451453
setupParserConfig(rdfParser.getParserConfig());

core/rio/jsonld-legacy/pom.xml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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-jsonld-legacy</artifactId>
10+
<name>RDF4J: Rio - JSON-LD 1.0 (legacy)</name>
11+
<description>Rio parser and writer implementation for the JSON-LD file format.</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-rio-api</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>${project.groupId}</groupId>
25+
<artifactId>rdf4j-rio-datatypes</artifactId>
26+
<version>${project.version}</version>
27+
<scope>runtime</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>${project.groupId}</groupId>
31+
<artifactId>rdf4j-rio-languages</artifactId>
32+
<version>${project.version}</version>
33+
<scope>runtime</scope>
34+
</dependency>
35+
<dependency>
36+
<groupId>com.github.jsonld-java</groupId>
37+
<artifactId>jsonld-java</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.apache.httpcomponents</groupId>
41+
<artifactId>httpclient</artifactId>
42+
<exclusions>
43+
<exclusion>
44+
<groupId>commons-logging</groupId>
45+
<artifactId>commons-logging</artifactId>
46+
</exclusion>
47+
</exclusions>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.apache.httpcomponents</groupId>
51+
<artifactId>httpclient-cache</artifactId>
52+
</dependency>
53+
<!-- httpclient pulls in commons-logging -->
54+
<dependency>
55+
<groupId>org.slf4j</groupId>
56+
<artifactId>jcl-over-slf4j</artifactId>
57+
<scope>runtime</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>com.fasterxml.jackson.core</groupId>
61+
<artifactId>jackson-core</artifactId>
62+
</dependency>
63+
<dependency>
64+
<groupId>commons-io</groupId>
65+
<artifactId>commons-io</artifactId>
66+
</dependency>
67+
<dependency>
68+
<groupId>${project.groupId}</groupId>
69+
<artifactId>rdf4j-rio-api</artifactId>
70+
<classifier>tests</classifier>
71+
<type>test-jar</type>
72+
<version>${project.version}</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>${project.groupId}</groupId>
77+
<artifactId>rdf4j-query</artifactId>
78+
<version>${project.version}</version>
79+
<scope>test</scope>
80+
</dependency>
81+
</dependencies>
82+
</project>

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

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018 Eclipse RDF4J contributors.
2+
* Copyright (c) 2023 Eclipse RDF4J contributors.
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
66
* which accompanies this distribution, and is available at
77
* http://www.eclipse.org/org/documents/edl-v10.php.
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
10-
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.jsonld;
12-
13-
import java.util.*;
10+
******************************************************************************/
11+
package org.eclipse.rdf4j.rio.jsonld.legacy;
12+
13+
import java.util.ArrayList;
14+
import java.util.HashSet;
15+
import java.util.LinkedHashMap;
16+
import java.util.LinkedList;
17+
import java.util.List;
18+
import java.util.Map;
19+
import java.util.Set;
1420
import java.util.stream.Collectors;
1521

1622
/**
@@ -121,16 +127,7 @@ private static Object expandContextInDepth(Object input) {
121127
if (graph.containsKey(objectsPredId) && !currentNode.get(ID).equals(objectsPredId)
122128
&& !currentTreeNode.hasPassedThrough(objectsPredId)) {
123129
children.add(objectsPredId);
124-
Map<String, Object> tuples = (Map<String, Object>) graph.get(objectsPredId);
125-
Map<String, Object> copiedTuples = tuples.entrySet().stream().map(tuple -> {
126-
Map.Entry<String, Object> entry = new AbstractMap.SimpleEntry<>(tuple);
127-
if (tuple.getValue() instanceof List) {
128-
List<Object> copy = new ArrayList<>((Collection<?>) tuple.getValue());
129-
entry.setValue(copy);
130-
}
131-
return entry;
132-
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
133-
objectsPredSubjPairs.set(i, copiedTuples);
130+
objectsPredSubjPairs.set(i, (Map<String, Object>) graph.get(objectsPredId));
134131
frontier.add(new TreeNode(objectsPredSubjPairs.get(i), currentTreeNode));
135132
}
136133
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
2+
* Copyright (c) 2023 Eclipse RDF4J contributors.
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
66
* which accompanies this distribution, and is available at
77
* http://www.eclipse.org/org/documents/edl-v10.php.
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
10-
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.jsonld;
10+
******************************************************************************/
11+
package org.eclipse.rdf4j.rio.jsonld.legacy;
1212

1313
import java.util.Set;
1414

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
2+
* Copyright (c) 2023 Eclipse RDF4J contributors.
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
66
* which accompanies this distribution, and is available at
77
* http://www.eclipse.org/org/documents/edl-v10.php.
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
10-
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.jsonld;
10+
******************************************************************************/
11+
package org.eclipse.rdf4j.rio.jsonld.legacy;
1212

1313
import java.util.List;
1414
import java.util.Map.Entry;

core/rio/api/src/main/java/org/eclipse/rdf4j/rio/helpers/JSONLDMode.java core/rio/jsonld-legacy/src/main/java/org/eclipse/rdf4j/rio/jsonld/legacy/JSONLDMode.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015 Eclipse RDF4J contributors, Aduna, and others.
2+
* Copyright (c) 2022 Eclipse RDF4J contributors.
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,16 +8,16 @@
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
1010
*******************************************************************************/
11-
package org.eclipse.rdf4j.rio.helpers;
11+
package org.eclipse.rdf4j.rio.jsonld.legacy;
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
1920
*/
20-
@Deprecated(since = "4.3.0", forRemoval = true)
2121
public enum JSONLDMode {
2222

2323
EXPAND("Expansion", "http://json-ld.org/spec/latest/json-ld-api/index.html#expansion"),

0 commit comments

Comments
 (0)