Skip to content

Commit 64b0e86

Browse files
committed
Merge remote-tracking branch 'origin/main' into GH-273-add-benchmark
2 parents 887ed47 + 2880ca9 commit 64b0e86

Some content is hidden

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

48 files changed

+1839
-1299
lines changed

README.md

+50-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The goals of Titanium are:
1515
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c530c6b43b0243c08ce81521c5b4cf6a)](https://www.codacy.com/gh/filip26/titanium-json-ld/dashboard?utm_source=github.com&utm_medium=referral&utm_content=filip26/titanium-json-ld&utm_campaign=Badge_Grade)
1616
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=filip26_titanium-json-ld&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=filip26_titanium-json-ld)
1717
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/c530c6b43b0243c08ce81521c5b4cf6a)](https://www.codacy.com/manual/filip26/titanium-json-ld?utm_source=github.com&utm_medium=referral&utm_content=filip26/titanium-json-ld&utm_campaign=Badge_Coverage)
18-
[![Maven Central](https://img.shields.io/maven-central/v/com.apicatalog/titanium-json-ld.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.apicatalog%22%20AND%20a:%22titanium-json-ld%22)
18+
[![Maven Central](https://img.shields.io/maven-central/v/com.apicatalog/titanium-json-ld.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:com.apicatalog%20AND%20a:titanium-json-ld)
1919
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
2020

2121

@@ -39,10 +39,10 @@ The goal is to pass the [official test suite](https://github.com/w3c/json-ld-api
3939

4040
| Feature | Tests | Pass | Status | Notes |
4141
| --- | ---: | ---: | ---: | --- |
42-
| [Expansion](https://www.w3.org/TR/json-ld/#expanded-document-form) | 371 | 371 | 100% | |
43-
| [Compaction](https://www.w3.org/TR/json-ld/#compacted-document-form) | 242 | 242 | 100% | |
42+
| [Expansion](https://www.w3.org/TR/json-ld/#expanded-document-form) | 373 | 373 | 100% | |
43+
| [Compaction](https://www.w3.org/TR/json-ld/#compacted-document-form) | 243 | 243 | 100% | |
4444
| [Flattening](https://www.w3.org/TR/json-ld/#flattened-document-form) | 55 | 55 | 100% | |
45-
| [JSON-LD to RDF](https://www.w3.org/TR/json-ld/#relationship-to-rdf) | 451 | 449 | 99.5% | <ul><li>[te075 - @vocab as blank node identifier](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te075)</li><li>[tli12 - List with bad @base](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tli12)</li></ul> |
45+
| [JSON-LD to RDF](https://www.w3.org/TR/json-ld/#relationship-to-rdf) | 453 | 451 | 99.5% | <ul><li>[te075 - @vocab as blank node identifier](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te075)</li><li>[tli12 - List with bad @base](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tli12)</li></ul> |
4646
| [RDF to JSON-LD](https://www.w3.org/TR/json-ld/#relationship-to-rdf) | 51 | 51 | 100% | |
4747
| [Framing](https://www.w3.org/TR/json-ld11-framing/#framing) | 89 | 88 | 98.8% | <ul><li>[t0059 - @embed: @last](https://w3c.github.io/json-ld-framing/tests/frame-manifest#t0059)</li></ul> |
4848
| [Remote Document and Context Retrieval](https://www.w3.org/TR/json-ld11-api/#remote-document-and-context-retrieval) | 18 | 17 | 94.4% | <ul><li>[t0013 - HTML document](https://w3c.github.io/json-ld-api/tests/remote-doc-manifest#t0013)</li></ul> |
@@ -57,6 +57,7 @@ See [EARL results from the JSON-LD 1.1 Test Suite](https://w3c.github.io/json-ld
5757

5858
- [JSON-LD-star](https://json-ld.github.io/json-ld-star) expansion and compaction built-in support (experimental)
5959
- [Universal RDF Dataset Normalization Algorithm - URDNA2015](https://github.com/simon-greatrix/rdf-urdna)
60+
- [Iridium CBOR-LD](https://github.com/filip26/iridium-cbor-ld) - A CBOR-based Processor for Linked Data
6061

6162
## Usage
6263

@@ -65,28 +66,28 @@ See [EARL results from the JSON-LD 1.1 Test Suite](https://w3c.github.io/json-ld
6566
#### Titanium
6667

6768
##### Maven
68-
Java 11 or higher
69+
Java 11+
6970

7071
```xml
7172
<dependency>
7273
<groupId>com.apicatalog</groupId>
7374
<artifactId>titanium-json-ld</artifactId>
74-
<version>1.3.2</version>
75+
<version>1.3.3</version>
7576
</dependency>
7677
```
7778

7879
##### Gradle
79-
Java 8+, Android API Level >=21
80+
Java 8+, Android API Level >=24
8081

8182
```gradle
82-
compile group: 'com.apicatalog', name: 'titanium-json-ld-jre8', version: '1.3.2'
83+
implementation("com.apicatalog:titanium-json-ld-jre8:1.3.3")
8384
```
8485

8586
#### JSON-P Provider
8687

8788
Add JSON-P provider, if it is not on the classpath already.
8889

89-
Maven
90+
##### Maven
9091

9192
```xml
9293
<dependency>
@@ -96,11 +97,10 @@ Maven
9697
</dependency>
9798
```
9899

99-
Gradle
100+
##### Gradle
100101

101102
```gradle
102-
compile group: 'org.glassfish', name: 'jakarta.json', version: '2.0.1'
103-
103+
implementation("org.glassfish:jakarta.json:2.0.1")
104104
```
105105

106106
### Documentation
@@ -111,6 +111,8 @@ compile group: 'org.glassfish', name: 'jakarta.json', version: '2.0.1'
111111

112112
Titanium provides high-level [JsonLd](https://javadoc.io/doc/com.apicatalog/titanium-json-ld/latest/com/apicatalog/jsonld/JsonLd.html) API to interact with the processor.
113113

114+
#### Transformations
115+
114116
```javascript
115117

116118
// Expansion
@@ -141,8 +143,9 @@ JsonLd.frame("https://example/document.jsonld", "https://example/frame.jsonld").
141143

142144
```
143145

146+
#### Local JSON Document
147+
144148
```javascript
145-
// Local document
146149
Document document = JsonDocument.of(InputStream) or JsonDocument.of(Reader) ...
147150

148151
JsonLd.expand(document).get();
@@ -151,6 +154,40 @@ JsonLd.compact(document, contextDocument).get();
151154
...
152155
```
153156

157+
#### Processing Timeout
158+
A processor gets terminated eventually after a specified time. Please note
159+
the duration does not cover `DocumentLoader` processing time.
160+
You have to set-up a read timeout separately.
161+
162+
```javascript
163+
// since 1.4.0 -
164+
JsonLd.expand(...).timeout(duration)...get();
165+
```
166+
167+
#### HTTP Document Loader Timeout
168+
Configure and set a custom HTTP document loader instance.
169+
170+
```javascript
171+
// since 1.4.0 - set read timeout
172+
static DocumentLoader LOADER = HttpLoader.defaultInstance().timeount(Duration.ofSeconds(30));
173+
...
174+
JsonLd.expand(...).loader(LOADER).get();
175+
```
176+
177+
#### Document caching
178+
Configure LRU-based cache for loading documents.
179+
The argument determines size of the LRU-cache.
180+
```javascript
181+
JsonLd.toRdf("https://example/document.jsonld").loader(new LRUDocumentCache(loader, 12)).get();
182+
```
183+
184+
You can share instance of `LRUDocumentCache` among multiple calls to reuse cached documents.
185+
```javascript
186+
DocumentLoader cachedLoader = new LRUDocumentCache(12);
187+
JsonLd.toRdf("https://example/document.jsonld").loader(cachedLoader).get();
188+
JsonLd.toRdf("https://example/another-document.jsonld").loader(cachedLoader).get();
189+
```
190+
154191
## Contributing
155192

156193
All PR's welcome!

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.apicatalog</groupId>
88
<artifactId>titanium</artifactId>
9-
<version>1.3.3-SNAPSHOT</version>
9+
<version>1.4.0-SNAPSHOT</version>
1010
<relativePath>pom_parent.xml</relativePath>
1111
</parent>
1212
<artifactId>titanium-json-ld</artifactId>

pom_jre8.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.apicatalog</groupId>
88
<artifactId>titanium</artifactId>
9-
<version>1.3.3-SNAPSHOT</version>
9+
<version>1.4.0-SNAPSHOT</version>
1010
<relativePath>pom_parent.xml</relativePath>
1111
</parent>
1212
<artifactId>titanium-json-ld-jre8</artifactId>
@@ -27,7 +27,7 @@
2727
<dependency>
2828
<groupId>com.squareup.okhttp3</groupId>
2929
<artifactId>okhttp</artifactId>
30-
<version>4.10.0</version>
30+
<version>4.12.0</version>
3131
</dependency>
3232
</dependencies>
3333
</project>

0 commit comments

Comments
 (0)