Skip to content

ActiveTriples/active_triples-mongoid_strategy

Repository files navigation

ActiveTriples::MongoidStrategy

Build Status Coverage Status Gem Version

Provides a graph-based persistence strategy for the ActiveTriples framework. RDF Sources are persisted to MongoDB natively as Flattened 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.

ActiveTriples currently (as of 0.8.1) uses an RDF::Repository as the default persistence strategy. To override this, you have to manually set MongoidStrategy on 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:...>

See this gist for more information on Persistence Strategies.

History Tracking

MongoidStrategy optionally allows tracking history (aka 'versioning') to store changes in a graph's state over time. In order to use history tracking, use the ActiveTriples::MongoidStrategy::Trackable persistence strategy.

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.

About

Mongoid persistence for ActiveTriples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages