Module: NEU::MODS::Projection::RelatedItems
- Includes:
- Support
- Included in:
- NEU::MODS::Projection
- Defined in:
- lib/neu/mods/projection/related_items.rb
Overview
Top-level relatedItem elements: the series, the host and this work's part within it, and every other relationship with its type. See docs/other-fields.md.
Constant Summary collapse
- NAMED_RELATED_ITEM_TYPES =
Types with a field of their own, which #related_items skips.
%w[series host].freeze
- NAMED_HOST_DETAIL_TYPES =
Detail types with a named key on a host entry, which #host_details skips.
%w[volume issue].freeze
Constants included from Support
Instance Method Summary collapse
-
#host_collections ⇒ Object
The host's title plus THIS work's part within it.
-
#related_items ⇒ Object
Every other relatedItem with a title, keeping its @type (nil if untyped).
- #related_series ⇒ Object
Instance Method Details
#host_collections ⇒ Object
The host's title plus THIS work's part within it. Never copy the host's own metadata: it belongs to the other record and would go stale.
18 19 20 21 22 23 |
# File 'lib/neu/mods/projection/related_items.rb', line 18 def host_collections doc.xpath("/mods:mods/mods:relatedItem[@type='host']", NAMESPACE).filter_map do |node| entry = { title: child_text(node, "mods:titleInfo/mods:title"), **host_part(node) } entry.merge(qualifiers_of(node)) if entry.values.any? end end |
#related_items ⇒ Object
Every other relatedItem with a title, keeping its @type (nil if untyped).
32 33 34 35 36 37 38 39 40 |
# File 'lib/neu/mods/projection/related_items.rb', line 32 def doc.xpath("/mods:mods/mods:relatedItem", NAMESPACE).filter_map do |node| type = clean(node["type"]) next if NAMED_RELATED_ITEM_TYPES.include?(type) title = clean(node.at_xpath("mods:titleInfo/mods:title", NAMESPACE)&.text) { type: type, title: title, **qualifiers_of(node) } if title end end |
#related_series ⇒ Object
14 |
# File 'lib/neu/mods/projection/related_items.rb', line 14 def = ("series") |