What is hydra-works?
The Hydra::Works gem implements the PCDM Works data model using ActiveFedora-based models. In addition to the models, Hydra::Works includes associated behaviors around the broad concept of describable "works" or intellectual entities, the need for which was expressed by a variety of Samvera community use cases.
Product Owner & Maintenance
hydra-works is a Core Component of the Samvera community. The documentation for what this means can be found here.
The Samvera community is here to help. Please see our support guide.
The PCDM Works domain model includes the following high-level entities:
- Collection: a pcdm:Collection that indirectly contains zero or more Works and zero or more Collections
- Work: a pcdm:Object that holds zero or more FileSets and zero or more Works
- FileSet: a pcdm:Object that groups one or more related pcdm:Files, such as an original file (e.g., PDF document), its derivatives (e.g., a thumbnail), and extracted full-text
Behaviors included in the model include:
- Characterization of original files within FileSets
- Generation of derivatives from original files
- Virus checking of original files
- Full-text extraction from original files
Check out the Hydra::Derivatives README for additional dependencies.
Add these lines to your application's Gemfile:
gem 'hydra-works', '~> 0.15'
And then execute:
$ bundle install
Or install it yourself:
$ gem install hydra-works
Usage involves extending the behavior provided by this gem. In your application, you can create Hydra::Works-based models like so:
class Collection < ActiveFedora::Base include Hydra::Works::CollectionBehavior end class Book < ActiveFedora::Base include Hydra::Works::WorkBehavior end class Page < ActiveFedora::Base include Hydra::Works::FileSetBehavior end collection = Collection.create book = Book.create page = Page.create collection.members << book collection.save book.members << page book.save file = page.files.build file.content = "The quick brown fox jumped over the lazy dog." page.save
To turn on virus detection, install clamav on your system and add the
clamav gem to your Gemfile
Then include the
VirusCheck module in your
class Page < ActiveFedora::Base include Hydra::Works::FileSetBehavior include Hydra::Works::VirusCheck end
How to contribute
If you'd like to contribute to this effort, please check out the contributing guidelines
Testing with the continuous integration server
You can test Hydra::Works using the same process as our continuous integration server. To do that, run the default rake task which will download Solr and Fedora, start them, and run the tests for you.
If you want to run the tests manually, first run solr and FCRepo. To start solr:
solr_wrapper -v -d solr/config/ -n hydra-test -p 8985
To start FCRepo, open another shell and run:
fcrepo_wrapper -v -p 8986 --no-jms
Note you won't find these ports mentioned in this codebase, as testing behavior is inherited from ActiveFedora.
Now you’re ready to run the tests. In the directory where hydra-works is installed, run:
This software has been developed by and is brought to you by the Samvera community. Learn more at the Samvera website.