An implementation of the JSON-LD 1.1 (JSON-based Serialization for Linked Data) specification in Java utilizing JSONP (JSR 374 - Java API for JSON Processing).
- conformance to the specification
- secure, stable, fast, A+ code
- minimal external dependencies
- only
javax.json:javax.json-api
is required now
- only
- simple to use
The goal is to pass the official test suite and conform to the JSON-LD 1.1 specification.
Feature | Tests | Pass | Status | Notes |
---|---|---|---|---|
Expansion | 369 | 369 | 100% | |
Compaction | 239 | 239 | 100% | |
Flattening | 55 | 55 | 100% | |
JSON-LD to RDF | 449 | 447 | 99.5% | |
RDF to JSON-LD | 51 | 51 | 100% | |
Framing | 89 | 88 | 98.8% | |
Remote Document and Context Retrieval | 18 | 17 | 94.4% |
See EARL results from the JSON-LD 1.1 Test Suite for more details.
Titanium JSON-LD
Maven
<dependency>
<groupId>com.apicatalog</groupId>
<artifactId>titanium-json-ld</artifactId>
<version>0.8</version>
</dependency>
Gradle
compile group: 'com.apicatalog', name: 'titanium-json-ld', version: '0.8'
JSONP Provider
Add JSONP provider, if it is not on the classpath already.
Maven
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
Gradle
compile group: 'org.glassfish', name: 'javax.json', version: '1.1.4'
TBD
Titanium provides high-level JsonLd API to interact with the processor.
// Expansion
JsonLd.expand("https://w3c.github.io/json-ld-api/tests/expand/0001-in.jsonld")
.ordered()
.get();
JsonLd.expand("file:/home/filip/document.json") // HTTP(S) and File schemes supported
.context("file:/home/filip/context.jsonld") // external context
.get();
// Compaction
JsonLd.compact("https://example/expanded.jsonld", "https://example/context.jsonld")
.compactToRelative(false)
.get();
// Flattening
JsonLd.flatten("https://example/document.jsonld").get();
// JSON-LD to RDF
JsonLd.toRdf("https://example/document.jsonld").get();
// RDF to JSON-LD
JsonLd.fromRdf("https://example/document.nq").options(options).get();
// Framing
JsonLd.frame("https://example/document.jsonld", "https://example/frame.jsonld").get();
// Local document
Document document = Document.of(InputStream) or Document.of(Reader) ...
JsonLd.expand(document).get();
JsonLd.compact(document, contextDocument).get();
...
Your contribution is welcome.
- 0.1
Expansion Algorithms - 0.2
Compaction Algorithms - 0.3
Flattening Algorithms - 0.4
JSON-LD to RDF - 0.5
RDF to JSON-LD - 0.6
Framing - 0.7
Remote Document and Context Retrieval - 0.8
JsonLd API - 0.9 HTML
- 1.0 Documented, A+ code
Fork and clone the project repository:
> git clone [email protected]:filip26/titanium-json-ld.git
Compile sources:
> cd titanium-json-ld
> mvn package