ActiveTriples::MongoidStrategy

Build Status Coverage Status Gem Version

Provides a graph-based persistence strategy for the ActiveTriples framework. ActiveTriples::RDFSources are persisted to MongoDB natively as Compacted JSON-LD documents.

Installation

Add this line to your application's Gemfile:

gem 'active_triples-mongoid_strategy'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install active_triples-mongoid_strategy

Usage

Start by configuring Mongoid for your environment or application as per the documentation.

Persistence strategies currently (as of ActiveTriples 0.8.1) use RDF::Repository as the default persistence strategy. To override this, you have to inject MongoidStrategy into RDFSource instances at runtime:

require 'active_triples/mongoid_strategy'

source = ActiveTriples::Resource.new
source.persistence_strategy # => #<ActiveTriples::RepositoryStrategy:...>

source.set_persistence_strategy(ActiveTriples::MongoidStrategy)
source.persistence_strategy # => #<ActiveTriples::MongoidStrategy:...>

Contributing

Please observe the following guidelines:

  • Do your work in a feature branch based on master and rebase before submitting a pull request.
  • Write tests for your contributions.
  • Document every method you add using YARD annotations. (Note: Annotations are sparse in the existing codebase, help us fix that!)
  • Organize your commits into logical units.
  • Don't leave trailing whitespace (i.e. run git diff --check before committing).
  • Use well formed commit messages.