Sha256: 54e7627c1fc561e7aff2d4d7eb368326ef47c44a0d23ac49f3686723afca3b47

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

# unpack descriptive keyword
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-09-18 original script
# 	Stan Smith 2013-11-27 modified to process single keyword collection
#   Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
#   Stan Smith 2014-08-21 removed thesaurus link; replaced by onlineResource to citation
#   Stan Smith 2014-08-21 removed extra level of encapsulation "citation" under "thesaurus"

require ADIWG::Mdtranslator.reader_module('module_citation', $response[:readerVersionUsed])

module Adiwg_DescriptiveKeyword

	def self.unpack(hDesKeyword)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		intKeyword = intMetadataClass.newKeyword

		# descriptive keyword - keyword array
		if hDesKeyword.has_key?('keyword')
			aKeywords = hDesKeyword['keyword']
			aKeywords.each do |keyword|
				intKeyword[:keyword] << keyword
			end
		end

		# descriptive keyword - keyType
		if hDesKeyword.has_key?('keywordType')
			s = hDesKeyword['keywordType']
			if s != ''
				intKeyword[:keywordType] = s
			end
		end

		# descriptive keyword - thesaurus
		if hDesKeyword.has_key?('thesaurus')
			hCitation = hDesKeyword['thesaurus']
			unless hCitation.empty?
				intKeyword[:keyTheCitation] = Adiwg_Citation.unpack(hCitation)
			end

		end

		return intKeyword
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_descriptiveKeyword.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_descriptiveKeyword.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_descriptiveKeyword.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_descriptiveKeyword.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_descriptiveKeyword.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_descriptiveKeyword.rb