-
Notifications
You must be signed in to change notification settings - Fork 20
Dive Into Curation Concerns
This is a guided tour of CurationConcerns, including the built-in functionality and the parts that can be customized to add new fields and functionality.
- originally presented at the dc fedora users group, 2016-04-28
- updated for hydraconnect 2016-10-03 and eresearch australasia 2016-10-14
CurationConcerns uses a new set of components collaboratively developed by the Hydra community:
- AF (the core of the traditional Hydra stack) provides ActiveRecord-style modeling for Fedora
- Hydra::PCDM provides the basic PCDM classes and relationships
- Hydra::Works adds Works and FileSets, plus a Swiss Army Knife of repository functionality
- CurationConcerns adds a Rails engine, views, controllers, etc.
- Sufia 7 is rebuilding Sufia on top of CurationConcerns, and adds dashboards, reporting, and other IR functionality
the curation-concerns-vagrant VM uses solr_wrapper and fcrepo_wrapper instead of a more traditional Tomcat-based setup.
- standard hydra test/development infrastructure
- download solr and fcrepo and quickly spin up with minimal config
- do not use in production: they delete data
for a production setup, you would have a host of other concerns that are not easily accommodated with solr_wrapper and fcrepo_wrapper.
- fedora
- separate machine with tomcat or jetty
- files on network storage
- relational database for metadata
- event-based workflow
- solr
- solr 5+ standalone app
- might be shared with other applications
- fast disk and/or enough memory to keep index in memory
-
install the requirements and download the hydra-vagrant environment
https://github.com/projecthydra-labs/hydra-vagrant/archive/master.zip
-
start the vagrant environment
$ unzip hydra-vagrant-master.zip $ cd hydra-vagrant-master $ vagrant up
-
start the curation-concerns-demo application
$ vagrant ssh $ cd curation-concerns-demo $ rake demo
- demo of unmodified curation concerns
- create an account
- click
Log In
- click
Sign up
- fill out your email and desired password
- click the
Sign up
button and your account will be created and you will be signed in
- click
- add an object
- click the + in the toolbar to get a menu of items you can create
- click
New Book
- you can add basic Dublin Core metadata
- you can attach a file
- visibility options including embargo, lease, institutional access
- you can select a Creative Commons license for your work
- click the
Create Book
button at the bottom- the Book object is created with the properties you added
- the file is uploaded
- background processing runs FITS, generates derivatives, etc.
- once your object is created, see the thumbnail, metadata, you can view the files, etc.
- search, facet, view, download
- search for your object's title
- standard Blacklight search results page
- some facets configured
- create an account
- behind the scenes
- fedora view of an object: http://localhost:8984/rest/
- go to fedora and click on
dev
to see the objects created - objects for your Book, any File(s) you attached, plus more for WebAC access control
- search for your newly-created object's ID to see your Book's object
- metadata as RDF properties, links to the file with
pcdm:hasMember
- membership proxies in
members
child container - ordering with ORE Proxies in
list_source
child container
- go to fedora and click on
- solr view of an object: http://localhost:8983/solr/hydra-development/select
- use the solr admin tool or add
?q=id:[your Book's ID]
to the url - see the properties mapped to solr fields
- use the solr admin tool or add
- fedora view of an object: http://localhost:8984/rest/
- basic customization
- adding a property to a model
- adding to edit and show forms
- as we look at how to customize CurationConcerns, explain how the framework is organized
- models, views, controllers
- very common application framework pattern, with models for the core data, views for the user interface, and controllers in the middle handling logic
- forms, indexers, presenters
- address gaps in model-view-controller framework: form objects help building editing forms, indexers/presenters map to/from Solr
- models, views, controllers
- model defines the property
- form wraps the model
- view provides HTML UI for the create/edit form
class Book < ActiveFedora::Base
include ::CurationConcerns::WorkBehavior
include ::CurationConcerns::BasicMetadata
validates :title, presence: { message: 'Your work must have a title.' }
+ property :copyright, predicate: ::RDF::URI('http://www.loc.gov/premis/rdf/v1#hasCopyrightStatus')
end
module CurationConcerns
class BookForm < CurationConcerns::Forms::WorkForm
self.model_class = ::Book
+ delegate :copyright, to: :model
+ self.terms += [:copyright]
end
end
+ <fieldset class="optional prompt">
+ <legend>Additional Information</legend>
+ <%= f.input :subject, as: :multi_value, input_html: { class: 'form-control' } %>
+ <%= f.input :publisher, as: :multi_value, input_html: { class: 'form-control' } %>
+ <%= f.input :source, as: :multi_value, input_html: { class: 'form-control' } %>
+ <%= f.input :language, as: :multi_value, input_html: { class: 'form-control' } %>
+ <%= f.input :copyright, as: :multi_value, input_html: { class: 'form-control' } %>
+ </fieldset>
- create or edit a record
- add a copyright value
- view the copyright value in fedora
- but it doesn't show up in solr
- indexer maps from the model to Solr
- model defines which indexer to use
$ mkdir app/indexers
+ class BookIndexer < CurationConcerns::WorkIndexer
+ def generate_solr_document
+ super.tap do |solr_doc|
+ Solrizer.set_field(solr_doc, 'copyright', object.copyright, :displayable)
+ end
+ end
+ end
class Book < ActiveFedora::Base
include ::CurationConcerns::WorkBehavior
include ::CurationConcerns::BasicMetadata
validates :title, presence: { message: 'Your work must have a title.' }
property :copyright, predicate: ::RDF::URI('http://www.loc.gov/premis/rdf/v1#hasCopyrightStatus')
+ self.indexer = ::BookIndexer
end
- update the object to trigger reindexing
- view the copyright field in solr
- still not showing up on the show page
- presenter maps from Solr to the form
- controller defines which presenter to use
- view provides HTML UI
$ mkdir app/presenters
+ class BookPresenter < CurationConcerns::WorkShowPresenter
+ delegate :copyright, to: :solr_document
+ end
...
+ def copyright
+ fetch('copyright_ssm', [])
+ end
end
class CurationConcerns::BooksController < ApplicationController
include CurationConcerns::CurationConcernController
self.curation_concern_type = Book
+ def show_presenter
+ ::BookPresenter
+ end
end
+ <%= presenter.attribute_to_html(:description) %>
+ <%= presenter.attribute_to_html(:creator, catalog_search_link: true ) %>
+ <%= presenter.attribute_to_html(:contributor, label: 'Contributors', catalog_search_link: true) %>
+ <%= presenter.attribute_to_html(:subject, catalog_search_link: true) %>
+ <%= presenter.attribute_to_html(:publisher) %>
+ <%= presenter.attribute_to_html(:language) %>
+ <%= presenter.attribute_to_html(:copyright) %>
- reload the show page
- see the copyright value displayed to end users
- update the indexer to index as facetable
- update the search controller to display the facet
class BookIndexer < CurationConcerns::WorkIndexer
def generate_solr_document
super.tap do |solr_doc|
- Solrizer.set_field(solr_doc, 'copyright', object.copyright, :displayable)
+ Solrizer.set_field(solr_doc, 'copyright', object.copyright, :displayable, :facetable)
end
end
end
class CatalogController < ApplicationController
include CurationConcerns::CatalogController
configure_blacklight do |config|
...
config.add_facet_field solr_name('based_near', :facetable), limit: 5
config.add_facet_field solr_name('publisher', :facetable), limit: 5
config.add_facet_field solr_name('file_format', :facetable), limit: 5
config.add_facet_field 'generic_type_sim', show: false, single: true
+ config.add_facet_field solr_name('copyright', :facetable), limit: 5, label: 'Copyright'
...
end
- update a record with copyright
- perform a search
- see copyright facet in the sidebar
thanks to Justin Coyne for great tutorials: