sul-dlss-deprecated / hydrus

[DEPRECATED] Superseded by https://github.com/sul-dlss/happy-heron/ An application for self-deposit of digital objects into the Stanford Digital Repository for preservation and access.
Other
12 stars 4 forks source link

Hydrus::RightsMetadataDS needs updates #27

Open atz opened 8 years ago

atz commented 8 years ago

Why does Hydrus have (so much of) its own Hydrus::RightsMetadataDS? It does not inherit from Dor::RightsMetadataDS which means it breaks indexing when other attributes to_solr expect defaultObjectRights to have minimal features.

Error is:

...
Loading druid:oo000oo0002 with delete ...
DEPRECATION WARNING: NokogiriDatastream is deprecated and will be removed in hydra-head 7.0. Use OmDatastream insead. (called from datastream_object_for at /Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/digital_object.rb:10)
DEPRECATION WARNING: NokogiriDatastream is deprecated and will be removed in hydra-head 7.0. Use OmDatastream insead. (called from datastream_object_for at /Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/digital_object.rb:10)
DEPRECATION WARNING: NokogiriDatastream is deprecated and will be removed in hydra-head 7.0. Use OmDatastream insead. (called from datastream_object_for at /Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/digital_object.rb:10)
DEPRECATION WARNING: NokogiriDatastream is deprecated and will be removed in hydra-head 7.0. Use OmDatastream insead. (called from datastream_object_for at /Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/digital_object.rb:10)
rake aborted!
NoMethodError: undefined method `creative_commons' for #<Hydrus::RightsMetadataDS:0x007ffe22df3388>
/Users/atz/.rvm/gems/ruby-2.2.0/gems/activemodel-4.2.5/lib/active_model/attribute_methods.rb:433:in `method_missing'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/om-3.0.7/lib/om/xml/document.rb:113:in `rescue in method_missing'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/om-3.0.7/lib/om/xml/document.rb:103:in `method_missing'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:163:in `creative_commons_license'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:177:in `use_license'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:52:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/describable.rb:197:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/processable.rb:157:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/indexing.rb:67:in `update_index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:38:in `index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:33:in `import_and_index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:28:in `reload'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:30:in `block (3 levels) in <top (required)>'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:26:in `each'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:26:in `block (2 levels) in <top (required)>'
/Users/atz/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/atz/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
OM::XML::Terminology::BadPointerError: This Terminology does not have a root term defined that corresponds to ":creative_commons"
/Users/atz/.rvm/gems/ruby-2.2.0/gems/om-3.0.7/lib/om/xml/terminology.rb:157:in `retrieve_term'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/om-3.0.7/lib/om/xml/document.rb:104:in `method_missing'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:163:in `creative_commons_license'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:177:in `use_license'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/editable.rb:52:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/describable.rb:197:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/dor-services-5.3.1/lib/dor/models/processable.rb:157:in `to_solr'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/indexing.rb:67:in `update_index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:38:in `index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:33:in `import_and_index'
/Users/atz/.rvm/gems/ruby-2.2.0/gems/active-fedora-6.7.3/lib/active_fedora/fixture_loader.rb:28:in `reload'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:30:in `block (3 levels) in <top (required)>'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:26:in `each'
/Users/atz/repos/hydrus/lib/tasks/fixtures.rake:26:in `block (2 levels) in <top (required)>'
/Users/atz/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/atz/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => hydrus:loadfix

Note also NokogiriDatastream deprecation. My instinct is that Hydrus should inherit and minimally extend Dor's RightsMetadataDS, but examination suggests they differ in subtle and annoying ways. What is the design intent?

atz commented 8 years ago

@blalbrit @LynnMcRae

LynnMcRae commented 8 years ago

What kind of differences do you see? What I saw in a brief sampling seems pretty vanilla (though all the creative commons text is wonky; isn't there canonical text coming from DOR Services?). But to your point, Hydrus should be making DOR objects with DOR rights; I know of nothing special the app does or needs there. Perhaps the early authors thought they might add in some Hydrus app rights to that datastream, but it would have been a bad idea and afaik never happened.

mjgiarlo commented 5 years ago

One of the differences I'm seeing is this ability which only lives in Hydrus:

https://github.com/sul-dlss/hydrus/blob/master/app/models/hydrus/licenseable.rb

mjgiarlo commented 5 years ago

And https://github.com/sul-dlss/hydrus/blob/master/app/models/hydrus/rights_metadata_ds.rb#L29

mjgiarlo commented 5 years ago

This is a work in progress, and is not in scope for my current work cycle. I briefly pursued this while working on #228, when I ran into a test failure relating to rights metadata. This is down to eight failures so I will leave this branch hanging around.

Needs:

20a21,28
>         t.license do
>           t.human {
>             t.type_ path: { attribute: type }
>           }
>           t.machine {
>             t.type_ path: { attribute: type }
>           }
>         end
22a31,42
>       t.access do
>         t.human
>         t.machine do
>           t.world
>           t.group
>           t.embargo_release_date(path: embargoReleaseDate)
>         end
>       end
>
>       t.discover_access ref: [:access], attributes: { type: discover }
>       t.read_access     ref: [:access], attributes: { type: read }
>
32a53,58
>     # Template to allow insertion and removal of licenses
>     define_template :license do |xml, gcode, code, txt|
>       xml.human(type: gcode) { xml.text(txt) }
>       xml.machine(type: gcode) { xml.text(code) }
>     end
>
47a74,77
>             xml.license do
>               xml.human(type: )
>               xml.machine(type: )
>             end