Sha256: 35ce51bd7c404fd19062885bb8a37bf161c0735a95bf22941726fc601989aa66

Contents?: true

Size: 1.34 KB

Versions: 1

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 Md_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] = Md_Citation.unpack(hCitation)
			end

		end

		return intKeyword
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.10.2 lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_descriptiveKeyword.rb