ActiveTriples::MongoidStrategy

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: