diff --git a/README.md b/README.md index 9b8cfdd..e91f114 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,15 @@ **RDF/Borsh** is a [Ruby] library and [RDF.rb] extension for encoding and decoding [RDF] knowledge graphs in the [Borsh] binary serialization -format. +format. (See the [specification].) ## ✨ Features -- 100% pure Ruby with minimal dependencies and no bloat. +- 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. @@ -79,3 +83,4 @@ git clone https://github.com/ruby-rdf/rdf-borsh.git [RDF]: https://www.w3.org/TR/rdf12-concepts/ [RDF.rb]: https://github.com/ruby-rdf/rdf [Ruby]: https://ruby-lang.org +[specification]: https://github.com/ruby-rdf/rdf-borsh/blob/master/doc/spec.md diff --git a/spec/readme_spec.rb b/spec/readme_spec.rb new file mode 100644 index 0000000..2c9fba3 --- /dev/null +++ b/spec/readme_spec.rb @@ -0,0 +1,20 @@ +require 'rdf/borsh' + +include RDF + +RSpec.describe RDF::Borsh do + describe 'README examples' do + it 'roundtrip correctly' do + statement = [RDF::URI("https://rubygems.org/gems/rdf-borsh"), RDFS.label, "RDF/Borsh for Ruby"] + + ### Serializing an RDF graph into an RDF/Borsh file + RDF::Borsh::Writer.open("mygraph.rdfb") do |writer| + writer << statement + end + + ### Parsing an RDF graph from an RDF/Borsh file + graph = RDF::Graph.load("mygraph.rdfb") + expect(graph.to_a).to eq([statement]) + end + end +end