Module: Blacklight::Marc::Indexer::Formats::FormatMap
- Defined in:
- lib/blacklight/marc/indexer/formats.rb
Class Method Summary collapse
Class Method Details
.map007(v, vals) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/blacklight/marc/indexer/formats.rb', line 3 def self.map007(v, vals) field007hasC = false v = v.upcase case when (v.start_with? 'A') vals << (v == 'AD' ? 'Atlas' : 'Map') when (v.start_with? 'C') case when (v == "CA") vals << "TapeCartridge" when (v == "CB") vals << "ChipCartridge" when (v == "CC") vals << "DiscCartridge" when (v == "CF") vals << "TapeCassette" when (v == "CH") vals << "TapeReel" when (v == "CJ") vals << "FloppyDisk" when (v == "CM") vals << "CDROM" when (v == "C0") vals << "CDROM" when (v == "CR") # Do not return - this will cause anything with an 856 field to be labeled as "Electronic" field007hasC = true else vals << "Software" end when (v.start_with? 'D') vals << 'Globe' when (v.start_with? 'F') vals << 'Braille' when (v.start_with? 'G') if (v == "GC") vals << "Filmstrip" elsif (v == "GD") vals << "Filmstrip" elsif (v == "GT") vals << "Transparency" else vals << "Slide" end when (v.start_with? 'H') vals << "Microfilm" when (v.start_with? 'K') case when (v == "KC") vals << "Collage" when (v == "KD") vals << "Drawing" when (v == "KE") vals << "Painting" when (v == "KF") vals << "Print" when (v == "KG") vals << "Photonegative" when (v == "KJ") vals << "Print" when (v == "KL") vals << "Drawing" when (v == "K0") vals << "FlashCard" when (v == "KN") vals << "Chart" else vals << "Photo" end when (v.start_with? 'M') if (v == "MF") vals << "VideoCassette" elsif (v == "MR") vals << "Filmstrip" else vals << "MotionPicture" end when (v.start_with? 'O') vals << 'Kit' when (v.start_with? 'Q') vals << 'MusicalScore' when (v.start_with? 'R') vals << 'SensorImage' when (v.start_with? 'S') if (v == "SD") vals << "SoundDisc" elsif (v == "SS") vals << "SoundCassette" else vals << "SoundRecording" end when (v.start_with? 'V') if (v == "VC") vals << "VideoCartridge" elsif (v == "VD") vals << "VideoDisc" elsif (v == "VF") vals << "VideoCassette" elsif (v == "VR") vals << "VideoReel" else vals << "Video" end end field007hasC end |
.map_leader(f_000, field007hasC, vals, record) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/blacklight/marc/indexer/formats.rb', line 110 def self.map_leader(f_000,field007hasC,vals,record) f_000 = f_000.upcase case when (f_000.start_with? 'C') vals << "MusicalScore" when (f_000.start_with? 'D') vals << "MusicalScore" when (f_000.start_with? 'E') vals << "Map" when (f_000.start_with? 'F') vals << "Map" when (f_000.start_with? 'I') vals << "SoundRecording" when (f_000.start_with? 'J') vals << "MusicRecording" when (f_000.start_with? 'K') vals << "Photo" when (f_000.start_with? 'M') vals << "Electronic" when (f_000.start_with? 'O') vals << "Kit" when (f_000.start_with? 'P') vals << "Kit" when (f_000.start_with? 'R') vals << "PhysicalObject" when (f_000.start_with? 'T') vals << "Manuscript" when (f_000.start_with? 'A') if f_000 == 'AM' vals << ((field007hasC) ? "eBook" : "Book") elsif f_000 == 'AS' # Look in 008 to determine what type of Continuing Resource format_code = Traject::Macros::Marc21.extract_marc_from(record, "008[21]", first: true, default: "").first.upcase if format_code == 'N' vals << 'Newspaper' elsif format_code == 'P' vals << 'Journal' else vals << 'Serial' end end end vals end |