@@ -15,7 +15,7 @@ The goals of Titanium are:
15
15
[ ![ 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 )
16
16
[ ![ 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 )
17
17
[ ![ 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 )
19
19
[ ![ License] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
20
20
21
21
@@ -39,10 +39,10 @@ The goal is to pass the [official test suite](https://github.com/w3c/json-ld-api
39
39
40
40
| Feature | Tests | Pass | Status | Notes |
41
41
| --- | ---: | ---: | ---: | --- |
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% | |
44
44
| [ 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 > |
46
46
| [ RDF to JSON-LD] ( https://www.w3.org/TR/json-ld/#relationship-to-rdf ) | 51 | 51 | 100% | |
47
47
| [ 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 > |
48
48
| [ 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
57
57
58
58
- [ JSON-LD-star] ( https://json-ld.github.io/json-ld-star ) expansion and compaction built-in support (experimental)
59
59
- [ 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
60
61
61
62
## Usage
62
63
@@ -65,28 +66,28 @@ See [EARL results from the JSON-LD 1.1 Test Suite](https://w3c.github.io/json-ld
65
66
#### Titanium
66
67
67
68
##### Maven
68
- Java 11 or higher
69
+ Java 11+
69
70
70
71
``` xml
71
72
<dependency >
72
73
<groupId >com.apicatalog</groupId >
73
74
<artifactId >titanium-json-ld</artifactId >
74
- <version >1.3.2 </version >
75
+ <version >1.3.3 </version >
75
76
</dependency >
76
77
```
77
78
78
79
##### Gradle
79
- Java 8+, Android API Level >=21
80
+ Java 8+, Android API Level >=24
80
81
81
82
``` 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")
83
84
```
84
85
85
86
#### JSON-P Provider
86
87
87
88
Add JSON-P provider, if it is not on the classpath already.
88
89
89
- Maven
90
+ ##### Maven
90
91
91
92
``` xml
92
93
<dependency >
@@ -96,11 +97,10 @@ Maven
96
97
</dependency >
97
98
```
98
99
99
- Gradle
100
+ ##### Gradle
100
101
101
102
``` gradle
102
- compile group: 'org.glassfish', name: 'jakarta.json', version: '2.0.1'
103
-
103
+ implementation("org.glassfish:jakarta.json:2.0.1")
104
104
```
105
105
106
106
### Documentation
@@ -111,6 +111,8 @@ compile group: 'org.glassfish', name: 'jakarta.json', version: '2.0.1'
111
111
112
112
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.
113
113
114
+ #### Transformations
115
+
114
116
``` javascript
115
117
116
118
// Expansion
@@ -141,8 +143,9 @@ JsonLd.frame("https://example/document.jsonld", "https://example/frame.jsonld").
141
143
142
144
```
143
145
146
+ #### Local JSON Document
147
+
144
148
``` javascript
145
- // Local document
146
149
Document document = JsonDocument .of (InputStream) or JsonDocument .of (Reader) ...
147
150
148
151
JsonLd .expand (document ).get ();
@@ -151,6 +154,40 @@ JsonLd.compact(document, contextDocument).get();
151
154
...
152
155
```
153
156
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
+
154
191
## Contributing
155
192
156
193
All PR's welcome!
0 commit comments