-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the ResourceForm for FileSets #5894
Conversation
04dbd7f
to
deef139
Compare
deef139
to
a166226
Compare
This method ensures that the correct `ResourceForm` subclass is created for works.
This will enable other kinds of resources, like FileSets, to reuse the lease & embargo functionality of `Hyrax::Forms::ResourceForm` without implementing PCDM Object behaviours. Awkwardly, this means that `Hyrax::Forms::ResourceForm(MyClass)` now returns a `Hyrax::Forms::PcdmObjectForm`, not a `Hyrax::Forms::ResourceForm`, but this is the only way to preserve backwards‐compatibility.
0cc7a34
to
c129786
Compare
This is a more restrictive set of attributes than was previously present on the FileSet model, matching exactly those which were in the old FileSet form. The form options differ from `basic_metadata` in the case of `license`, which is required for FileSets but optional in other places. If using `basic_metadata` for FileSets is desired, resolving this difference will be necessary.
This allows the sharing of common pieces of implementation with other Hyrax resource forms, like those for Hyrax::Works.
c129786
to
d0b785e
Compare
Can you talk a bit more about the desire for configurable FileSet metadata? I ask because this may drift the file_set towards a conceptual work. Could these configurable attributes be better modeled in a work? |
@jeremyf i'm not sure that i see that making FileSet metadata configurable changes FileSet's status. couldn't this configuration help us move away from the work-like description in the BasicMetadata we use now? |
@jeremyf as far as this PR is concerned, @no-reply is right in that the changes here move the FileSet away from a conceptual work, in that the model used to use the same metadata as works ( as far as my personal desire for configurable metadata is concerned, this is of course open to discussion :) . mostly, though, i think it is a gut feeling deriving from the large number of attributes already present on the FileSet model—if FileSet only included none of that configurability is in this PR, though. |
@jeremyf do you have any thoughts about a path to move this one through? |
I think this looks great and the docs and conversation help better understand what's happening! |
This PR makes the following changes (in the interest of resolving the remaining issues with #5575) :—
Hyrax::Forms::PcdmObjectForm
, to enableHyrax::Forms::ResourceForm
to be used with resource types other than PCDM objects @ 5c48b30. [Note №1]file_set_metadata
, and updates the model and form to both use the same metadata (previously the model usedbasic_metadata
, and the form had hardcoded fields) @ f700452. [Note №2]Hyrax::Forms::FileSetForm
to inherit fromHyrax::Forms::ResourceForm
, with the intention of inheriting the lease and embargo handling behaviours provided there @ f63ca9c.Notes:
Hyrax::Forms::ResourceForm(…)
now returns a class subclassingHyrax::Forms::PcdmObjectForm
, notHyrax::Forms::ResourceForm
directly. This is a bit awkward and confusing, but it preserves backwards‐compatibility with existing Hyrax applications which defined their models using the recommendedclass MyObjectForm < Hyrax::Forms::ResourceForm(MyObjectForm)
syntax.FileSet forms (and other future forms which want to use the ResourceForm embargo/lease implementations but do not have PCDM object properties) consequently cannot use the function‐call syntax and should just subclass
Hyrax::Forms::ResourceForm
directly.See commit 5c48b30.
Hyrax::FileSet
formerly includedHyrax::Schema(:basic_metadata)
in the model, but had a more limited set of metadata actually exposed through theHyrax::FileSetForm
. The two furthermore did not agree onlicense
, in that it is optional inbasic_metadata
but was required inHyrax::FileSetForm
.I’ve resolved this by creating a new metadata YAML,
file_set_metadata
, with just the attributes listed in the form or required by tests, andlicense
set torequired
. But another solution might be to keep the fullbasic_metadata
schema and allowlicense
to be optional. Seehyrax/lib/hyrax/specs/shared_specs/hydra_works.rb
Lines 252 to 260 in bd2bcff
basic_metadata
support, but not all attributes are tested and compare also 792ccfd which removed that requirement for collections considering that those attributes were never exposed in forms.(The attributes required by
it_behaves_like 'a model with basic metadata'
but not previously exposed on the form are:abstract
,label
,relative_path
,resource_type
,rights_notes
,rights_statement
, andsource
. If we’re comfortable revising this test, we could probably drop those fromfile_set_metadata.yaml
.)In the long term, I would like for the FileSet metadata to be configurable, but it’s hardcoded to whatever is in the YAML file for now.
See commit f700452.