RDF Graph normalizer for RDF.rb.
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.
gem install rdf-normalize
- 100% free and unencumbered public domain software.
- Compatible with Ruby >= 3.0.
Full documentation available on GitHub
Returning normalized N-Quads
require 'rdf/normalize' require 'rdf/turtle' g = ::.("etc/doap.ttl") puts g.dump(:normalize) # Can also use :canonicalize
Normalizing an abstract Graph/Dataset
require 'rdf/normalize' require 'rdf/turtle' g = ::.("etc/doap.ttl") g_canon = g.canonicalize # graph with URIs, literals, and blank nodes canonicalized. puts g_canon.dump(:nquads) # Normalized, but not sorted
The recommended installation method is via RubyGems.
To install the latest official release of the
RDF::Normalize gem, do:
% [sudo] gem install rdf-normalize
- 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
AUTHORSfiles. If you need to change them, do so on your private branch only.
- Do feel free to add yourself to the
CREDITSfile 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.