Skip to content

Commit

Permalink
Improve the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Jan 11, 2025
1 parent b8f67a7 commit 57cef83
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
20 changes: 20 additions & 0 deletions spec/readme_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 57cef83

Please sign in to comment.