https://github.com/filip26/titanium-rdf-canon
An implementation of W3C Standard RDF Dataset Canonicalization (RDFC 1.0)
https://github.com/filip26/titanium-rdf-canon
rdf rdf-canonicalization rdfc urdna
Last synced: 8 months ago
JSON representation
An implementation of W3C Standard RDF Dataset Canonicalization (RDFC 1.0)
- Host: GitHub
- URL: https://github.com/filip26/titanium-rdf-canon
- Owner: filip26
- License: apache-2.0
- Created: 2022-05-27T19:00:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T17:27:18.000Z (8 months ago)
- Last Synced: 2025-04-07T18:36:39.602Z (8 months ago)
- Topics: rdf, rdf-canonicalization, rdfc, urdna
- Language: Java
- Homepage: https://apicatalog.com
- Size: 347 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-java-rdf - Titanium RDF Dataset Canonicalization
README
# Titanium RDF Dataset Canonicalization
An implementation of the [W3C Standard RDF Dataset Canonicalization Algorithm (RDFC 1.0)](https://www.w3.org/TR/rdf-canon/) in Java.
[](https://github.com/filip26/titanium-rdf-canon/actions/workflows/java8-build.yml)
[](https://app.codacy.com/gh/filip26/titanium-rdf-canon/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://app.codacy.com/gh/filip26/titanium-rdf-canon/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
[](https://search.maven.org/search?q=g:com.apicatalog%20AND%20a:titanium-rdfc)
[](https://javadoc.io/doc/com.apicatalog/titanium-rdfc)
[](https://opensource.org/licenses/Apache-2.0)
For conformance with the specification, refer to the [RDF Dataset Canonicalization and Hash 1.0 Processor Conformance](https://w3c.github.io/rdf-canon/reports/) report.
## Examples
```javascript
// 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.
```javascript
// 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
```xml
com.apicatalog
titanium-rdfc
2.0.0
```
### Gradle
```gradle
implementation("com.apicatalog:titanium-rdfc:2.0.0")
```
## Contributing
All PR's welcome!
### Building
Fork and clone the project repository.
```bash
> cd titanium-rdfc
> mvn package
```
## Resources
* [W3C Standard RDF Dataset Canonicalization Algorithm](https://www.w3.org/TR/rdf-canon/)
* [Titanium JSON-LD](https://github.com/filip26/titanium-json-ld)
* [Titanium N-QUADS](https://github.com/filip26/titanium-rdf-n-quads)
* Originally a fork of [RDF-URDNA](https://github.com/setl/rdf-urdna).