Module: NEU::MODS::Projection::Identifiers

Includes:
Support
Included in:
NEU::MODS::Projection
Defined in:
lib/neu/mods/projection/identifiers.rb

Overview

Identifiers, classification, location and recordInfo: what the record is called elsewhere and where the resource is held. See docs/other-fields.md.

Constant Summary collapse

RECORD_INFO_PARTS =

recordInfo children, read as one value.

{
  content_source: "mods:recordContentSource",
  origin: "mods:recordOrigin",
  description_standard: "mods:descriptionStandard",
  creation_date: "mods:recordCreationDate",
  change_date: "mods:recordChangeDate",
  language_of_cataloging: "mods:languageOfCataloging/mods:languageTerm"
}.freeze

Constants included from Support

Support::AUTHORITY_ATTRIBUTES

Instance Method Summary collapse

Instance Method Details

#classification ⇒ Object

An LCC or DDC call number, not Atlas's classification_ssim.



15
# File 'lib/neu/mods/projection/identifiers.rb', line 15

def classification = labeled_texts_at("/mods:mods/mods:classification")

#identifiers ⇒ Object

Typed, so a display can tell a DOI from an accession number, and flagged when @invalid="yes" marks the identifier dead.



19
20
21
22
23
24
25
26
27
# File 'lib/neu/mods/projection/identifiers.rb', line 19

def identifiers
  doc.xpath("/mods:mods/mods:identifier", NAMESPACE).filter_map do |node|
    value = clean(node.text)
    if value
      { type: clean(node["type"]), value: value, invalid: attr_value(node, "invalid") == "yes",
        **qualifiers_of(node) }
    end
  end
end

#location ⇒ Object

The parts stay apart: a shelf mark and a URL are different kinds. The element is shelfLocator; MODS has no shelfLocation.



40
41
42
43
44
45
46
47
48
49
# File 'lib/neu/mods/projection/identifiers.rb', line 40

def location
  doc.xpath("/mods:mods/mods:location", NAMESPACE).filter_map do |node|
    entry = {
      physical_location: child_text(node, "mods:physicalLocation"),
      shelf_location: child_text(node, "mods:shelfLocator"),
      url: child_text(node, "mods:url")
    }
    entry.merge(qualifiers_of(node)) if entry.values.any?
  end
end

#permanent_url ⇒ Object



29
30
31
# File 'lib/neu/mods/projection/identifiers.rb', line 29

def permanent_url
  clean(handle_node&.text)
end

#permanent_url_display_label ⇒ Object

No href companion: the value is the URL.



34
35
36
# File 'lib/neu/mods/projection/identifiers.rb', line 34

def permanent_url_display_label
  attr_value(handle_node, "displayLabel")
end

#record_info ⇒ Object

Who catalogued the record, to what standard, and when.



62
63
64
65
66
67
68
# File 'lib/neu/mods/projection/identifiers.rb', line 62

def record_info
  node = doc.at_xpath("/mods:mods/mods:recordInfo", NAMESPACE)
  return nil unless node

  entry = RECORD_INFO_PARTS.transform_values { |xpath| child_text(node, xpath) }
  entry if entry.values.any?
end