Class: Cocina::Models::Mapping::FromMods::RelatedResource
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::RelatedResource
- Defined in:
- lib/cocina/models/mapping/from_mods/related_resource.rb
Overview
Maps MODS relatedItem to cocina relatedResource
Constant Summary collapse
- TYPES =
{ 'has original version' => 'original', 'has other format' => 'otherFormat', 'has part' => 'constituent', 'has version' => 'otherVersion', 'in series' => 'series', 'part of' => 'host', 'preceded by' => 'preceding', 'related to' => nil, # 'related to' is a null type by design 'reviewed by' => 'reviewOf', 'referenced by' => 'isReferencedBy', 'references' => 'references', 'succeeded by' => 'succeeding' }.invert.freeze
- DETAIL_TYPES =
{ 'location within source' => 'part', 'volume' => 'volume', 'issue' => 'issue', 'chapter' => 'chapter', 'section' => 'section', 'paragraph' => 'paragraph', 'track' => 'track', 'marker' => 'marker' }.invert.freeze
- OTHER_TYPES =
[ 'supplement to', 'supplemented by', 'derived from', 'source of', 'version of record', 'identical to' ].freeze
Class Method Summary collapse
-
.build(resource_element:, description_builder:, purl:) ⇒ Hash
A hash that can be mapped to a cocina model.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(resource_element:, description_builder:, purl:) ⇒ RelatedResource
constructor
A new instance of RelatedResource.
Constructor Details
#initialize(resource_element:, description_builder:, purl:) ⇒ RelatedResource
Returns a new instance of RelatedResource.
53 54 55 56 57 58 |
# File 'lib/cocina/models/mapping/from_mods/related_resource.rb', line 53 def initialize(resource_element:, description_builder:, purl:) @resource_element = resource_element @description_builder = description_builder @notifier = description_builder.notifier @purl = purl end |
Class Method Details
.build(resource_element:, description_builder:, purl:) ⇒ Hash
Returns a hash that can be mapped to a cocina model.
49 50 51 |
# File 'lib/cocina/models/mapping/from_mods/related_resource.rb', line 49 def self.build(resource_element:, description_builder:, purl:) new(resource_element: resource_element, description_builder: description_builder, purl: purl).build end |
Instance Method Details
#build ⇒ Object
60 61 62 |
# File 'lib/cocina/models/mapping/from_mods/related_resource.rb', line 60 def build + end |