Skip to content

ruby-rdf/rdf-borsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

aeaf829 Β· Jan 11, 2025

History

13 Commits
Jan 7, 2025
Jan 8, 2025
Jan 11, 2025
Jan 11, 2025
Jan 7, 2025
Jan 7, 2025
Jan 7, 2025
Jan 11, 2025
Jan 7, 2025
Jan 11, 2025
Jan 7, 2025
Jan 11, 2025
Jan 11, 2025

Repository files navigation

RDF/Borsh for Ruby

License Compatibility Package Documentation

RDF/Borsh is a Ruby library and RDF.rb extension for encoding and decoding RDF knowledge graphs in the Borsh binary serialization format. (See the specification.)

✨ Features

  • Serializes RDF datasets into compact and efficient binary files.
  • Implements the application/x-rdf+borsh MIME type with a .rdfb extension.
  • Employes LZ4 compression for both the term dictionary and quad data.
  • Designed for blockchain and distributed ledger applications.
  • Supports reading from and writing to files or I/O streams.
  • Plays nice with others: entirely contained in the RDF::Borsh module.
  • 100% free and unencumbered public domain software.

πŸ› οΈ Prerequisites

⬇️ Installation

Installation via RubyGems

gem install rdf-borsh

πŸ‘‰ Examples

Importing the library

require 'rdf/borsh'

include RDF

Serializing an RDF graph into an RDF/Borsh file

RDF::Borsh::Writer.open("mygraph.rdfb") do |writer|
  writer << [RDF::URI("https://rubygems.org/gems/rdf-borsh"), RDFS.label, "RDF/Borsh for Ruby"]
end

Parsing an RDF graph from an RDF/Borsh file

graph = RDF::Graph.load("mygraph.rdfb")
graph.to_a

Parsing an RDF/Borsh dataset from standard input

RDF::Borsh::Reader.new($stdin).to_a

πŸ“š Reference

https://rubydoc.info/gems/rdf-borsh

πŸ‘¨β€πŸ’» Development

git clone https://github.com/ruby-rdf/rdf-borsh.git

Share on Twitter Share on Reddit Share on Hacker News Share on Facebook