Module: NEU::MODS::Projection::OriginInfo

Includes:
Dates, Names, Support
Included in:
NEU::MODS::Projection
Defined in:
lib/neu/mods/projection/origin_info.rb

Overview

The non-date originInfo children, each carrying its block's header attributes. See docs/other-fields.md.

Constant Summary collapse

MARC_COUNTRY_AUTHORITY =

A bare marccountry code ("mau") is not a place name, so it drops. TODO: expand marccountry codes through a vendored registry, as LanguageCodes does for eng -> English.

"marccountry"

Constants included from Dates

Dates::DATE_ELEMENTS, Dates::DATE_FIELDS, Dates::DATE_FIELD_ROWS, Dates::DATE_KEYS, Dates::EMPTY_DATE, Dates::ISO8601_BASIC_DATE, Dates::ISO8601_ENCODING, Dates::W3CDTF_DATE

Constants included from Support

Support::AUTHORITY_ATTRIBUTES

Instance Method Summary collapse

Methods included from Dates

#copyright_date_with_precision, #date_created_with_precision, #date_issued_with_precision

Methods included from Names

#alternative_names, #editable_corporate_creators, #editable_personal_creators, #name_entry, #names, #preserved_names

Methods included from Selectors

#abstract_nodes, #editable_creator_nodes, #keyword_subjects, #primary_title_info, #variant_title?

Instance Method Details

#edition ⇒ Object



21
# File 'lib/neu/mods/projection/origin_info.rb', line 21

def edition = origin_texts_at("mods:edition")

#frequency ⇒ Object



58
# File 'lib/neu/mods/projection/origin_info.rb', line 58

def frequency = origin_texts_at("mods:frequency")

#issuance ⇒ Object



56
# File 'lib/neu/mods/projection/origin_info.rb', line 56

def issuance = origin_texts_at("mods:issuance")

#origin_agents ⇒ Object

originInfo/agent, composed like a top-level name.



39
40
41
42
43
44
# File 'lib/neu/mods/projection/origin_info.rb', line 39

def origin_agents
  doc.xpath("/mods:mods/mods:originInfo/mods:agent", NAMESPACE).filter_map do |node|
    entry = name_entry(node)
    entry.merge(event_type: attr_value(node.parent, "eventType")) if entry[:name]
  end
end

#place_of_publication ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/neu/mods/projection/origin_info.rb', line 28

def place_of_publication
  doc.xpath("/mods:mods/mods:originInfo/mods:place", NAMESPACE).filter_map do |place|
    value = place_term_value(place)
    next unless value

    { value: value, **origin_qualifiers_of(place.parent),
      date_elements: origin_date_elements(place.parent) }
  end
end

#place_term_value(place) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/neu/mods/projection/origin_info.rb', line 46

def place_term_value(place)
  text = clean(place.at_xpath("mods:placeTerm[@type='text']", NAMESPACE)&.text)
  return text if text

  code = place.at_xpath("mods:placeTerm", NAMESPACE)
  return nil if attr_value(code, "authority") == MARC_COUNTRY_AUTHORITY

  clean(code&.text)
end

#publication_information ⇒ Object

Headed by the enclosing originInfo: MODS puts neither attribute on its children.



20
# File 'lib/neu/mods/projection/origin_info.rb', line 20

def publication_information = origin_texts_at("mods:publisher")