Class: ADIWG::Mdtranslator::Writers::Iso19110::FC_FeatureCatalogue
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19110::FC_FeatureCatalogue
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb
Instance Method Summary collapse
-
#initialize(xml, responseObj) ⇒ FC_FeatureCatalogue
constructor
A new instance of FC_FeatureCatalogue.
- #writeXML(hDictionary, embed) ⇒ Object
Constructor Details
#initialize(xml, responseObj) ⇒ FC_FeatureCatalogue
Returns a new instance of FC_FeatureCatalogue.
28 29 30 31 32 |
# File 'lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb', line 28 def initialize(xml, responseObj) @xml = xml @hResponseObj = responseObj @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110 end |
Instance Method Details
#writeXML(hDictionary, embed) ⇒ Object
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 109 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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb', line 34 def writeXML(hDictionary, ) # classes used localeClass = PT_Locale.new(@xml, @hResponseObj) rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj) featureClass = FC_FeatureType.new(@xml, @hResponseObj) hCitation = hDictionary[:citation] aEntities = hDictionary[:entities] version = @hResponseObj[:translatorVersion] # document head = @xml.instruct! :xml, encoding: 'UTF-8' @xml.comment!('ISO 19110 METADATA') @xml.comment!('The following metadata file was constructed using the ADIwg mdTranslator, http://mdtranslator.adiwg.org') @xml.comment!('mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg)') @xml.comment!('mdTranslator and other metadata tools are available at https://github.com/adiwg') @xml.comment!('ADIwg is not responsible for the content of this metadata record') @xml.comment!('This metadata record was generated by mdTranslator ' + version + ' at ' + Time.now.to_s) # schema locations # set to 'remoteSchema' before publishing localSchema = 'C:\Users\StanSmith\Projects\ISO\19115\NOAA\schema\gfc\gfc.xsd' remoteSchema = 'ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/gfc/gfc.xsd' # FC_FeatureCatalogue if attributes = {} else attributes = {'xmlns:gmi' => 'http://www.isotc211.org/2005/gmi', 'xmlns:gmd' => 'http://www.isotc211.org/2005/gmd', 'xmlns:gco' => 'http://www.isotc211.org/2005/gco', 'xmlns:gml' => 'http://www.opengis.net/gml/3.2', 'xmlns:gsr' => 'http://www.isotc211.org/2005/gsr', 'xmlns:gss' => 'http://www.isotc211.org/2005/gss', 'xmlns:gst' => 'http://www.isotc211.org/2005/gst', 'xmlns:gmx' => 'http://www.isotc211.org/2005/gmx', 'xmlns:gfc' => 'http://www.isotc211.org/2005/gfc', 'xmlns:xlink' => 'http://www.w3.org/1999/xlink', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => "http://www.isotc211.org/2005/gfc #{remoteSchema}"} end @xml.tag!('gfc:FC_FeatureCatalogue', attributes) do # feature catalogue - name, version, version date are # are taken from citation name = hCitation[:title] version = hCitation[:edition] hDate = {} aDates = hCitation[:dates] unless aDates.empty? hDate = aDates[0] end # feature catalogue - name (required) unless name.nil? @xml.tag!('gmx:name') do @xml.tag!('gco:CharacterString', name) end end if name.nil? @NameSpace.issueWarning(40, 'gmx:name') end # feature catalogue - scope (required) [] aScopes = hDictionary[:subjects] aScopes.each do |scope| @xml.tag!('gmx:scope') do @xml.tag!('gco:CharacterString', scope) end end if aScopes.empty? @NameSpace.issueWarning(41, 'gmx:scope') end # feature catalogue - field of application [] aUses = hDictionary[:recommendedUses] aUses.each do |use| @xml.tag!('gmx:fieldOfApplication') do @xml.tag!('gco:CharacterString', use) end end if aUses.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmx:fieldOfApplication') end # feature catalogue - version number (required) unless version.nil? @xml.tag!('gmx:versionNumber') do @xml.tag!('gco:CharacterString', version) end end if version.nil? @NameSpace.issueWarning(42, 'gmx:versionNumber') end # feature catalogue - version date (required) sDate = nil unless hDate.empty? dateTime = hDate[:date] dateRes = hDate[:dateResolution] unless dateTime.nil? sDate = AdiwgDateTimeFun.stringDateFromDateTime(dateTime, dateRes) end end unless sDate.nil? @xml.tag!('gmx:versionDate') do @xml.tag!('gco:Date', sDate) end end if sDate.nil? @NameSpace.issueWarning(43, 'gmx:versionDate') end # feature catalogue - locale [] aLocales = hDictionary[:locales] aLocales.each do |hLocale| unless hLocale.empty? @xml.tag!('gmx:locale') do localeClass.writeXML(hLocale) end end end if aLocales.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmx:locale') end # feature catalogue - producer (required) {CI_ResponsibleParty} hParty = hDictionary[:responsibleParty] unless hParty.empty? role = hParty[:roleName] aParties = hParty[:parties] unless aParties.empty? party = aParties[0] @xml.tag!('gfc:producer') do rPartyClass.writeXML(role, party) end end end if hParty.empty? @NameSpace.issueWarning(44, 'gfc:producer') end # feature catalogue - functional language s = hDictionary[:dictionaryFunctionalLanguage] unless s.nil? @xml.tag!('gfc:functionalLanguage') do @xml.tag!('gco:CharacterString', s) end end if s.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gfc:functionalLanguage') end # feature catalogue - feature type [] (required) # use feature type to represent date entities unless aEntities.empty? aEntities.each do |hEntity| @xml.tag!('gfc:featureType') do featureClass.writeXML(hEntity) end end end if aEntities.empty? @NameSpace.issueWarning(45, 'gfc:featureType') end return end end |