class DiscoveryIndexer::GeneralMapper

Attributes

druid[R]

Public Class Methods

new(druid) click to toggle source

Initializes an instance from IndexMapper @param [String] druid e.g. ab123cd4567

# File lib/discovery-indexer/general_mapper.rb, line 8
def initialize(druid)
  @druid = druid
end

Public Instance Methods

collection_data() click to toggle source

@return [DiscoveryIndexer::Collection] for each collection druid, or [] if no collection druids

# File lib/discovery-indexer/general_mapper.rb, line 22
def collection_data
  @collection_data ||= collection_druids.map do |cdruid|
    DiscoveryIndexer::Collection.new(cdruid)
  end
end
collection_druids() click to toggle source

@return [Array<String>] Array of bare druids from rels-ext isMemberOfCollection in public xml (e.g. ['oo000oo0000'])

# File lib/discovery-indexer/general_mapper.rb, line 29
def collection_druids
  purlxml.collection_druids
end
constituent_data() click to toggle source

@return [DiscoveryIndexer::Collection] for each constituent druid, or [] if no constituent druids

# File lib/discovery-indexer/general_mapper.rb, line 34
def constituent_data
  @constituent_data ||= constituent_druids.map do |cdruid|
    DiscoveryIndexer::Collection.new(cdruid)
  end
end
constituent_druids() click to toggle source

@return [Array<String>] Array of bare druids from rels-ext isConstituentOf in public xml (e.g. ['oo000oo0000'])

# File lib/discovery-indexer/general_mapper.rb, line 41
def constituent_druids
  purlxml.constituent_druids
end
convert_to_solr_doc() click to toggle source

Create a Hash representing a Solr doc, with all MODS related fields populated. @return [Hash] Hash representing the Solr document

# File lib/discovery-indexer/general_mapper.rb, line 14
def convert_to_solr_doc
  solr_doc = {}
  solr_doc[:id] = druid
  solr_doc[:title] = modsxml.sw_full_title
  solr_doc
end
modsxml() click to toggle source

@return [Stanford::Mods::Record] the MODS xml for the druid

# File lib/discovery-indexer/general_mapper.rb, line 46
def modsxml
  @modsxml ||= DiscoveryIndexer::InputXml::Modsxml.new(druid).load
end
purlxml() click to toggle source

@return [DiscoveryIndexer::Reader::PurlxmlModel] the purlxml model

# File lib/discovery-indexer/general_mapper.rb, line 51
def purlxml
  @purlxml ||= DiscoveryIndexer::InputXml::Purlxml.new(druid).load
end