An implementation of the W3C Standard RDF Dataset Canonicalization Algorithm (RDFC 1.0) in Java.
For conformance with the specification, refer to the RDF Dataset Canonicalization and Hash 1.0 Processor Conformance report.
// Create a new canonicalizer instance
var canon = RdfCanon.create("SHA-256");
// Feed the canonicalizer with N-Quads
(new NQuadsReader(...)).provide(canon);
// Alternatively, manually add quads
canon.quad(...).quad(..)...quad(...);
// Get the canonicalized result
canon.provide(...);
// Get the canonicalized result as N-Quads
var writer = new NQuadsWriter(...);
canon.provide(writer);
// Access data related to the canonicalization process
var mapping = canon.mapping();
Use RdfCanonTicker
to prematurely terminate computation.
// Set a 5-second timeout (in milliseconds) after which computation will be terminated
var canon = RdfCanon.create("SHA-256", new RdfCanonTimeTicker(5 * 1000));
// Alternatively, set a custom ticker
var canon = RdfCanon.create("SHA-256", () -> {
// This will be called during computation, starting from the very beginning
});
<dependency>
<groupId>com.apicatalog</groupId>
<artifactId>titanium-rdfc</artifactId>
<version>2.0.0</version>
</dependency>
implementation("com.apicatalog:titanium-rdfc:2.0.0")
All PR's welcome!
Fork and clone the project repository.
> cd titanium-rdfc
> mvn package
- W3C Standard RDF Dataset Canonicalization Algorithm
- Titanium JSON-LD
- Titanium N-QUADS
- Originally a fork of RDF-URDNA.