lib/traject/extract_language.rb
# Transform field 008 into an iso639-2 URI
Transform field 008 into an iso639-2 URI
Transform field 008 into an iso639 - 2 URI
def extract_language
    lang_extractor = Traject::MarcExtractor.new("008[35-37]")
    lambda do |record, accumulator|
      abbrev = lang_extractor.extract(record).compact.first
      return if /\s/ =~ abbrev
      accumulator << { _rdf: ["http://id.loc.gov/vocabulary/iso639-2/#{abbrev}"] }
    end
  end
def extract_language lang_extractor = Traject :: MarcExtractor . new ( "008[35-37]" ) lambda do | record , accumulator | abbrev = lang_extractor . extract ( record ) . compact . first return if / \s / =~ abbrev accumulator << { _rdf : [ "http://id.loc.gov/vocabulary/iso639-2/#{abbrev}" ] } end end
Transform field 008 into an iso639-2 URI
Transform field 008 into an iso639 - 2 URI
# Check for empty strings