RDF::Normalize

RDF Graph normalizer for RDF.rb.

Description

This is a Ruby implementation of a RDF Dataset Canonicalization for RDF.rb.

Features

RDF::Normalize generates normalized [N-Quads][] output for an RDF Dataset using the algorithm defined in [RDF Normalize][]. It also implements an RDF Writer interface, which can be used to serialize normalized statements.

Algorithms implemented:

Install with gem install rdf-normalize

  • 100% free and unencumbered public domain software.

  • Compatible with Ruby >= 3.0.

Usage

Documentation

Full documentation available on GitHub

Examples

Returning normalized N-Quads

require 'rdf/normalize'
require 'rdf/turtle'
g = RDF::Graph.load("etc/doap.ttl")
puts g.dump(:normalize) # Can also use :canonicalize

Normalizing an abstract Graph/Dataset

require 'rdf/normalize'
require 'rdf/turtle'
g = RDF::Graph.load("etc/doap.ttl")
g_canon = g.canonicalize # graph with URIs, literals, and blank nodes canonicalized.
puts g_canon.dump(:nquads) # Normalized, but not sorted

Principle Classes

Dependencies

Installation

The recommended installation method is via RubyGems. To install the latest official release of the RDF::Normalize gem, do:

% [sudo] gem install rdf-normalize

Mailing List

Author

Contributing

  • Do your best to adhere to the existing coding conventions and idioms.

  • Don’t use hard tabs, and don’t leave trailing whitespace on any line.

  • Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.

  • Don’t touch the .gemspec, VERSION or AUTHORS files. If you need to change them, do so on your private branch only.

  • Do feel free to add yourself to the CREDITS file and the corresponding list in the the README. Alphabetical order applies.

  • Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you, which you will be asked to agree to on the first commit to a repo within the organization. Note that the agreement applies to all repos in the Ruby RDF organization.

License

This is free and unencumbered public domain software. For more information, see unlicense.org/ or the accompanying LICENSE file.