RDF/Borsh for Ruby
An RDF.rb extension for encoding and decoding RDF knowledge graphs in the Borsh binary serialization format.
🛠️ Prerequisites
- Ruby 3.0+
⬇️ 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
👨💻 Development
git clone https://github.com/ruby-rdf/rdf-borsh.git