Module: NEU::MODS::Projection::Subjects

Includes:
NameDisplay, Support, Titles, Selectors
Included in:
NEU::MODS::Projection
Defined in:
lib/neu/mods/projection/subjects.rb

Overview

Every top-level subject, as assembled headings and as one list per axis. See docs/subjects.md.

Constant Summary collapse

HEADING_OMITTED_CHILDREN =

A coordinate and a MARC code: neither is heading text.

%w[cartographics geographicCode].freeze
HEADING_SEPARATOR =

Joined here so a display and a browse index hold the same string. Atlas reads it as Projection::HEADING_SEPARATOR.

" -- "
TYPELESS_NAME_SUBJECT_TYPE =

The axis a with no @type reaches.

"corporate"
HIERARCHICAL_GEOGRAPHIC_LEVELS =

The eleven hierarchicalGeographic children, in schema order, broadest first.

%i[
  continent country province region state territory county city
  city_section island area
].freeze

Constants included from Titles

Titles::NON_SORT_BINDING, Titles::TITLE_SEPARATORS

Constants included from Support

NEU::MODS::Projection::Support::AUTHORITY_ATTRIBUTES

Instance Method Summary collapse

Methods included from Titles

#abbreviated_title, #access_title_parts, #alternative_title, compose_title, join_non_sort, #main_title, #main_title_display_label, #plain_title, #title_parts, #translated_title, #uniform_title

Methods included from Selectors

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

Instance Method Details

#corporate_name_subjects ⇒ Object



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

def corporate_name_subjects = name_subjects("corporate")

#genre_subjects ⇒ Object



60
# File 'lib/neu/mods/projection/subjects.rb', line 60

def genre_subjects = texts_at("/mods:mods/mods:subject/mods:genre")

#geographic_code_subjects ⇒ Object

A MARC GAC code, as written. The label vocabulary is the consumer's.



63
# File 'lib/neu/mods/projection/subjects.rb', line 63

def geographic_code_subjects = texts_at("/mods:mods/mods:subject/mods:geographicCode")

#geographic_subjects ⇒ Object



51
# File 'lib/neu/mods/projection/subjects.rb', line 51

def geographic_subjects = texts_at("/mods:mods/mods:subject/mods:geographic")

#hierarchical_geographic_subjects ⇒ Object

One key per level, kept structured so a consumer can take one level.



71
72
73
74
75
76
# File 'lib/neu/mods/projection/subjects.rb', line 71

def hierarchical_geographic_subjects
  doc.xpath("/mods:mods/mods:subject/mods:hierarchicalGeographic", NAMESPACE).filter_map do |node|
    entry = HIERARCHICAL_GEOGRAPHIC_LEVELS.to_h { |level| [level, child_text(node, "mods:#{camelize(level)}")] }
    entry if entry.values.any?
  end
end

#keywords ⇒ Object

The free-text set Cerberus's simple form edits.



21
22
23
# File 'lib/neu/mods/projection/subjects.rb', line 21

def keywords
  keyword_subjects.flat_map { |s| texts_under(s, "mods:topic") }
end

#map_data ⇒ Object

subject/cartographics, kept structured: composing it is display policy.



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/neu/mods/projection/subjects.rb', line 79

def map_data
  doc.xpath("/mods:mods/mods:subject/mods:cartographics", NAMESPACE).filter_map do |node|
    entry = {
      scale: child_text(node, "mods:scale"),
      projection: child_text(node, "mods:projection"),
      coordinates: child_text(node, "mods:coordinates")
    }
    # cartographics carries neither attribute; the enclosing subject does.
    entry.merge(qualifiers_of(node.parent)) if entry.values.any?
  end
end

#occupation_subjects ⇒ Object



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

def occupation_subjects = texts_at("/mods:mods/mods:subject/mods:occupation")

#personal_name_subjects ⇒ Object

Composed like #names, so one person reads the same as author and subject.



55
# File 'lib/neu/mods/projection/subjects.rb', line 55

def personal_name_subjects = name_subjects("personal")

#subject_headings ⇒ Object

Every top-level as ONE heading: its parts, the joined string, and the axis of its main term.



37
38
39
40
41
42
43
44
45
46
# File 'lib/neu/mods/projection/subjects.rb', line 37

def subject_headings
  doc.xpath("/mods:mods/mods:subject", NAMESPACE).filter_map do |node|
    axis_node = heading_axis_node(node)
    parts = subject_heading_parts(node)
    next if axis_node.nil? || parts.empty?

    { parts: parts, heading: parts.join(HEADING_SEPARATOR), axis: heading_axis(axis_node),
      **authority_of(axis_node), **qualifiers_of(node) }
  end
end

#temporal_subjects ⇒ Object



52
# File 'lib/neu/mods/projection/subjects.rb', line 52

def temporal_subjects = texts_at("/mods:mods/mods:subject/mods:temporal")

#title_subjects ⇒ Object

Composed like the main title, since a subject work has every titleInfo part.



66
67
68
# File 'lib/neu/mods/projection/subjects.rb', line 66

def title_subjects
  doc.xpath("/mods:mods/mods:subject/mods:titleInfo", NAMESPACE).filter_map { |node| composed_title_of(node) }
end

#topical_subjects ⇒ Object

Every under any top-level , for the access copy.



49
# File 'lib/neu/mods/projection/subjects.rb', line 49

def topical_subjects = texts_at("/mods:mods/mods:subject/mods:topic")