Titanium RDF Dataset Canonicalization

May 30, 2026 ยท View on GitHub

An implementation of the W3C Standard RDF Dataset Canonicalization Algorithm (RDFC 1.0) in Java.

Java 21 CI Codacy Badge Codacy Badge Maven Central javadoc License

For conformance with the specification, refer to the RDF Dataset Canonicalization and Hash 1.0 Processor Conformance report.

Examples

// 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
canon.provide(System.out::print);

// 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
});

Installation

Maven

<dependency>
    <groupId>com.apicatalog</groupId>
    <artifactId>titanium-rdfc</artifactId>
    <version>3.0.0</version>
</dependency>

Contributing

All PR's welcome!

Building

Fork and clone the project repository.

> cd titanium-rdfc
> mvn package

Resources