samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
185 stars 124 forks source link

Use Schemas for Metadata Concerns #1628

Open no-reply opened 7 years ago

no-reply commented 7 years ago

The current strategy for combining metadata on Hyrax models is to mixin modules with an included block that adds the properties. This metaprogramming approach is extremely rigid, and makes it hard to customize schemas.

ActiveFedora supports ActiveTriples::Schema application through #apply_schema, and switching to this approach would make schema application significantly more flexible. It would also give us an interface for future extension, replacing metaprogramming practices that need to be carefully replicated in each application.

Related work

A proof of concept branch is at https://github.com/samvera/hyrax/compare/use_schema

mark-dce commented 7 years ago

FWIW - this came out of me asking @no-reply about a question that came up for Samvera Camp - there's an institution (in Germany I think) that would like an alternate, more specific predicate for creator. We've also seen use cases for changing keywords to something other than DC11.relation.

In general, I think we need to provide clear guidance on the preferred way to do this, or less popularly that this is not a supported modification of Hyrax.

Right now the only way @bess and I could figure out to meet the requirement is to copy the full Hyrax::BasicMetadata module into the app and edit it appropriately. That seems like alot to override if you really are concerned about one or two attributes.

ghost commented 7 years ago

Just checking my understanding ... in this approach could we apply multiple schemas with multiple apply_schema calls? Would it then be possible to override a single property in the BasicSchema by applying the new property after the BasicSchema has been applied?

eg.

apply_schema BasicSchema
apply_schema NewSchema # defines creator with a different predicate