Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 3 KB

File metadata and controls

85 lines (60 loc) · 3 KB

Titanium RDF Dataset Canonicalization

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

Java 8 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
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
});

Installation

Maven

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

Gradle

implementation("com.apicatalog:titanium-rdfc:2.0.0")

Contributing

All PR's welcome!

Building

Fork and clone the project repository.

> cd titanium-rdfc
> mvn package

Resources