Skip to content

PCDM Modeling

Thomas Johnson edited this page May 8, 2017 · 30 revisions

PCDM Modeling

Setup

Ensure the following runs green:

git checkout day1/pcdm/start
bundle
bundle exec rspec

New Requirement: Cover Subjects

The product owner has prioritized the following story from the backlog:

As a researcher, I need to find sheet music works for a project investigating their cover images. I want to be able to facet materials by the subjects depicted on their cover.

In the next sprint, we write a feature test and come up with a demo implementation that we think minimally addresses the requirements.

git checkout day1/pcdm/step1-feature_test
bundle exec rspec

Group Exercise: Make the feature test pass

Pre-written tests for this exercise are in day1/pcdm/step1-tests

What We Learn About Covers

This new feature is a huge success but introducing it, far from satisfying the user base, has made the collections usable to a new community of researchers interested in sheet music covers. A range of new use cases has emerged.

To start, covers need:

  1. Creator
  2. Description
  3. Subject

The collection maintainers are also starting to anticipate the need for higher quality scans of cover pages. They would like us to support covers as first class works. We realize this puts us firmly in modeling space.

PCDM Model

What is a Work?

MusicalWork.ancestors

A few notable ancestors:

  • Hyrax::BasicMetadata
  • Hyrax::WorkBehavior
  • Hyrax::Works::Metadata
  • Hydra::PCDM::PcdmBehavior
  • Hydra::PCDM::ObjectBehavior
  • Hydra::Works::WorkBehavior
bundle exec rake hydra:server
bundle exec rails c
col = Hydra::PCDM::Collection.create
obj1, obj2 = [Hydra::PCDM::Object.create, Hydra::PCDM::Object.create]

col.members = [obj1, obj2]

file = Hydra::PCDM::File.new
file.content = StringIO.new('moomin')
file.file_name = 'moomin.txt'
file.save

obj1.files = [file]
obj1.save

LDP Model

Hydra::PCDM projects PCDM onto LDP:

puts col.resource.dump  :ttl
puts obj1.resource.dump :ttl
puts file.metadata.dump :ttl

What about MusicalWork?

work = MusicalWork.create(title: ['Home on the Range'])

work.resource # => #<MusicalWork::GeneratedResourceSchema:0x2af6...>

puts work.resource.dump :ttl

work.resource.class.ancestors

work.ldp_source