BlacklightOaiProvider: OAI-PMH service endpoint for Blacklight applications
The BlacklightOaiProvider plugin provides an Open Archives Initiative Protocolo for Metadata Harvesting (OAI-PMH) <www.openarchives.org/pmh/> data provider endpoint, using the ruby-oai gem, that let serice providers harvest that metadata.
A Rails app using Blacklight 3.x.
OAI-PMH requires a timestamp field for all records, so your Solr index should include an appropriate field. By default, the name of this field is simply ‘timestamp’.
Add
gem "blacklight_oai_provider"
to your Gemfile and run “bundle install”.
Then run “rails generate blacklight_oai_provider” to install the appropriate extensions into your CatalogController and SolrDocument classes. In you want to do customize the way this installs, instead you may:
-
add this to your Solr Document model:
use_extension(BlacklightOaiProvider::SolrDocumentExtension)
-
add this to your Controller:
include BlacklightOaiProvider::ControllerExtension
While the plugin provides some sensible (albeit generic) defaults out of the box, you probably will want to customize the OAI provider configuration. You can provide OAI-PMH provider parameters by placing the following in your blacklight configuration (in ./config/initializers/blacklight_config.rb), e.g.:
config = {
:provider => { :repository_name => 'Test', :repository_url => 'http://localhost', :record_prefix => '', :admin_email => 'root@localhost' }, :document => { :timestamp => 'timestamp', :limit => 25 } }
The “provider” configuration is documented as part of the ruby-oai gem at oai.rubyforge.org/
This plugin assumes it is in a Blacklight Rails app, uses Blacklight methods, Rails methods, and standard ruby module includes to inject it’s behaviors into the app.
You can turn off this injection if you like, although it will make the plugin less (or non-) functional unless you manually do similar injection. See lib/blacklight_oai_provider.rb#inject! to see exactly what’s going on.
In any initializer, you can set:
BlacklightOaiProvider.omit_inject = true
to turn off all injection. The plugin will be completely non-functional if you do this, of course. But perhaps you could try to re-use some of it’s classes in a non-Blacklight, highly hacked Blacklight, or even non-Rails application this way.
You can also turn off injection of individual components, which could be more useful:
BlacklightOaiProvider.omit_inject = { :routes => false, }
There are none. This is bad I know, sorry. You can test OAI-PMH conformance against www.openarchives.org/data/registerasprovider.html#Protocol_Conformance_Testing or browse the data at re.cs.uct.ac.za/