adiwg-mdtranslator 2.15.0 → 2.18.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +29 -2
- data/Rakefile +9 -12
- data/adiwg-mdtranslator.gemspec +2 -2
- data/lib/adiwg/mdtranslator/internal/acquisition.json +108 -0
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +278 -18
- data/lib/adiwg/mdtranslator/internal/qualityReport.json +64 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +6 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +11 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +15 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_algorithm.rb +65 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +18 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +10 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +7 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_nominalResolution.rb +78 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +25 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +9 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processReport.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +35 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb +103 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb +38 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +27 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +10 -0
- data/lib/adiwg/mdtranslator/version.rb +6 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_algorithm.rb +48 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_georectifiedRepresentation.rb +12 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_georeferenceableRepresentation.rb +13 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_gridRepresentation.rb +13 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_nominalResolution.rb +51 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_onlineResource.rb +14 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processReport.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +35 -8
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processing.rb +89 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +27 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_vectorRepresentation.rb +13 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +20 -15
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_algorithm.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCatalog.rb +53 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +9 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +10 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +11 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +21 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leProcessStep.rb +167 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leSource.rb +150 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liProcessStep.rb +130 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liSource.rb +126 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +18 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_nominalResolution.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +19 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +23 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_partyIdentifier.rb +92 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processReport.rb +66 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +22 -101
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processing.rb +110 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeElementDescription.rb +45 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +8 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +19 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +9 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +11 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_algorithm.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leProcessStep.rb +153 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leSource.rb +134 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb +126 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liSource.rb +114 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +13 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_nominalResolution.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +26 -20
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processReport.rb +66 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +22 -96
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processing.rb +110 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +20 -82
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +9 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_algorithm.rb +31 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_attribute.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_contact.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georectifiedRepresentation.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georeferenceableRepresentation.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_gridRepresentation.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_nominalResolution.rb +31 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_onlineResource.rb +6 -3
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processReport.rb +31 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +5 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processing.rb +37 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_source.rb +7 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_vectorRepresentation.rb +1 -0
- data/lib/adiwg/mdtranslator_cli.rb +1 -1
- metadata +45 -12
@@ -2,6 +2,7 @@
|
|
2
2
|
# source
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2019-09-24 add support for LE_Source
|
5
6
|
# Stan Smith 2017-04-03 refactored for mdTranslator 2.0
|
6
7
|
# Stan Smith 2015-07-16 refactored to remove global namespace $HtmlNS
|
7
8
|
# Stan Smith 2015-03-27 original script
|
@@ -11,6 +12,8 @@ require_relative 'html_spatialResolution'
|
|
11
12
|
require_relative 'html_spatialReference'
|
12
13
|
require_relative 'html_processStep'
|
13
14
|
require_relative 'html_scope'
|
15
|
+
require_relative 'html_identifier'
|
16
|
+
require_relative 'html_nominalResolution'
|
14
17
|
|
15
18
|
module ADIWG
|
16
19
|
module Mdtranslator
|
@@ -31,6 +34,8 @@ module ADIWG
|
|
31
34
|
referenceClass = Html_SpatialReference.new(@html)
|
32
35
|
stepClass = Html_ProcessStep.new(@html)
|
33
36
|
scopeClass = Html_Scope.new(@html)
|
37
|
+
identifierClass = Html_Identifier.new(@html)
|
38
|
+
nominalClass = Html_NominalResolution.new(@html)
|
34
39
|
|
35
40
|
# source - source ID
|
36
41
|
unless hSource[:sourceId].nil?
|
@@ -58,11 +63,11 @@ module ADIWG
|
|
58
63
|
end
|
59
64
|
|
60
65
|
# source - metadata citation [] {citation}
|
61
|
-
unless hSource[:
|
66
|
+
unless hSource[:metadataCitations].empty?
|
62
67
|
@html.details do
|
63
68
|
@html.summary('Metadata Citations', {'class' => 'h5'})
|
64
69
|
@html.section(:class => 'block') do
|
65
|
-
hSource[:
|
70
|
+
hSource[:metadataCitations].each do |hCitation|
|
66
71
|
@html.details do
|
67
72
|
@html.summary(hCitation[:title], {'class' => 'h5'})
|
68
73
|
@html.section(:class => 'block') do
|
@@ -121,6 +126,26 @@ module ADIWG
|
|
121
126
|
end
|
122
127
|
end
|
123
128
|
|
129
|
+
# source - processed level {identifier}
|
130
|
+
unless hSource[:processedLevel].empty?
|
131
|
+
@html.details do
|
132
|
+
@html.summary('Processed Level', {'class' => 'h5'})
|
133
|
+
@html.section(:class => 'block') do
|
134
|
+
identifierClass.writeHtml(hSource[:processedLevel])
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# source - resolution {nominal resolution}
|
140
|
+
unless hSource[:resolution].empty?
|
141
|
+
@html.details do
|
142
|
+
@html.summary('Nominal Resolution', {'class' => 'h5'})
|
143
|
+
@html.section(:class => 'block') do
|
144
|
+
nominalClass.writeHtml(hSource[:resolution])
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
124
149
|
end # writeHtml
|
125
150
|
end # Html_Source
|
126
151
|
|
@@ -6,6 +6,7 @@
|
|
6
6
|
# Stan Smith 2017-03-28 original script
|
7
7
|
|
8
8
|
require_relative 'html_vectorObject'
|
9
|
+
require_relative 'html_scope'
|
9
10
|
|
10
11
|
module ADIWG
|
11
12
|
module Mdtranslator
|
@@ -22,6 +23,18 @@ module ADIWG
|
|
22
23
|
|
23
24
|
# classes used
|
24
25
|
objectClass = Html_VectorObject.new(@html)
|
26
|
+
scopeClass = Html_Scope.new(@html)
|
27
|
+
|
28
|
+
# vector representation - scope
|
29
|
+
hVector[:scope].each do |scope|
|
30
|
+
@html.details do
|
31
|
+
@html.summary('Scope ', 'class' => 'h5')
|
32
|
+
@html.section(:class => 'block') do
|
33
|
+
scopeClass.writeHtml(hVector[:scope])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
25
38
|
|
26
39
|
# vector representation - topology level
|
27
40
|
unless hVector[:topologyLevel].nil?
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2019-09-17 handle namespace setup for dictionary embedded in 19115
|
5
6
|
# Stan Smith 2018-05-03 add variable for changing XSD location
|
6
7
|
# Stan Smith 2018-04-03 refactored error and warning messaging
|
7
8
|
# Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
|
@@ -30,14 +31,13 @@ module ADIWG
|
|
30
31
|
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
|
31
32
|
end
|
32
33
|
|
33
|
-
def writeXML(
|
34
|
+
def writeXML(hDictionary, embed)
|
34
35
|
|
35
36
|
# classes used
|
36
37
|
localeClass = PT_Locale.new(@xml, @hResponseObj)
|
37
38
|
rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
|
38
39
|
featureClass = FC_FeatureType.new(@xml, @hResponseObj)
|
39
40
|
|
40
|
-
hDictionary = intObj[:dataDictionaries][0]
|
41
41
|
hCitation = hDictionary[:citation]
|
42
42
|
aEntities = hDictionary[:entities]
|
43
43
|
version = @hResponseObj[:translatorVersion]
|
@@ -57,19 +57,24 @@ module ADIWG
|
|
57
57
|
remoteSchema = 'ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/gfc/gfc.xsd'
|
58
58
|
|
59
59
|
# FC_FeatureCatalogue
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
60
|
+
if embed
|
61
|
+
attributes = {}
|
62
|
+
else
|
63
|
+
attributes = {'xmlns:gmi' => 'http://www.isotc211.org/2005/gmi',
|
64
|
+
'xmlns:gmd' => 'http://www.isotc211.org/2005/gmd',
|
65
|
+
'xmlns:gco' => 'http://www.isotc211.org/2005/gco',
|
66
|
+
'xmlns:gml' => 'http://www.opengis.net/gml/3.2',
|
67
|
+
'xmlns:gsr' => 'http://www.isotc211.org/2005/gsr',
|
68
|
+
'xmlns:gss' => 'http://www.isotc211.org/2005/gss',
|
69
|
+
'xmlns:gst' => 'http://www.isotc211.org/2005/gst',
|
70
|
+
'xmlns:gmx' => 'http://www.isotc211.org/2005/gmx',
|
71
|
+
'xmlns:gfc' => 'http://www.isotc211.org/2005/gfc',
|
72
|
+
'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
|
73
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
74
|
+
'xsi:schemaLocation' => "http://www.isotc211.org/2005/gfc #{remoteSchema}"}
|
75
|
+
end
|
76
|
+
|
77
|
+
@xml.tag!('gfc:FC_FeatureCatalogue', attributes) do
|
73
78
|
|
74
79
|
# feature catalogue - name, version, version date are
|
75
80
|
# are taken from citation
|
@@ -21,7 +21,7 @@ module ADIWG
|
|
21
21
|
module Writers
|
22
22
|
module Iso19110
|
23
23
|
|
24
|
-
def self.startWriter(intObj, hResponseObj, whichDict = 0)
|
24
|
+
def self.startWriter(intObj, hResponseObj, whichDict = 0, embed = false)
|
25
25
|
|
26
26
|
# load error message array
|
27
27
|
file = File.join(File.dirname(__FILE__), 'iso19110_writer_messages_eng') + '.yml'
|
@@ -41,8 +41,8 @@ module ADIWG
|
|
41
41
|
issueNotice(111)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
@domains =
|
44
|
+
hDictionary = intObj[:dataDictionaries][whichDict]
|
45
|
+
@domains = hDictionary[:domains]
|
46
46
|
|
47
47
|
# set the format of the output file based on the writer specified
|
48
48
|
hResponseObj[:writerOutputFormat] = 'xml'
|
@@ -53,7 +53,7 @@ module ADIWG
|
|
53
53
|
|
54
54
|
# start writing the ISO 19110 XML record
|
55
55
|
metadataWriter = FC_FeatureCatalogue.new(@xml, hResponseObj)
|
56
|
-
metadata = metadataWriter.writeXML(
|
56
|
+
metadata = metadataWriter.writeXML(hDictionary, embed)
|
57
57
|
|
58
58
|
return metadata
|
59
59
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# ISO <<Class>> LE_Algorithm
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 201-09-27 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_1_writer'
|
8
|
+
require_relative 'class_citation'
|
9
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Writers
|
13
|
+
module Iso19115_1
|
14
|
+
|
15
|
+
class LE_Algorithm
|
16
|
+
|
17
|
+
def initialize(xml, hResponseObj)
|
18
|
+
@xml = xml
|
19
|
+
@hResponseObj = hResponseObj
|
20
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(hAlgorithm, inContext = nil)
|
24
|
+
|
25
|
+
# classes used
|
26
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
27
|
+
|
28
|
+
outContext = 'algorithm'
|
29
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
30
|
+
|
31
|
+
@xml.tag!('mrl:LE_Algorithm') do
|
32
|
+
|
33
|
+
# algorithm - citation {CI_Citation} (required)
|
34
|
+
hCitation = hAlgorithm[:citation]
|
35
|
+
unless hCitation.empty?
|
36
|
+
@xml.tag!('mrl:citation') do
|
37
|
+
citationClass.writeXML(hCitation, outContext)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
if hCitation.empty?
|
41
|
+
@NameSpace.issueWarning(420, 'mrl:citation', outContext)
|
42
|
+
end
|
43
|
+
|
44
|
+
# algorithm - description (required)
|
45
|
+
unless hAlgorithm[:description].nil?
|
46
|
+
@xml.tag!('mrl:description') do
|
47
|
+
@xml.tag!('gco:CharacterString', hAlgorithm[:description])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if hAlgorithm[:description].nil?
|
51
|
+
@NameSpace.issueWarning(421, 'mrl:description', outContext)
|
52
|
+
end
|
53
|
+
|
54
|
+
end # mrl:LE_Algorithm tag
|
55
|
+
end # writeXML
|
56
|
+
end # LE_Algorithm class
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# ISO <<abstract class>> MD_FeatureCatalogue
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-08-20 original script.
|
6
|
+
|
7
|
+
require_relative '../../iso19110/iso19110_writer'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Iso19115_1
|
13
|
+
|
14
|
+
class MD_FeatureCatalogue
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
20
|
+
end
|
21
|
+
|
22
|
+
def writeXML(intObj,whichDict)
|
23
|
+
|
24
|
+
# set up iso19110 writer namespace
|
25
|
+
nameSpace19110 = ADIWG::Mdtranslator::Writers::Iso19110
|
26
|
+
|
27
|
+
# write 19110 record
|
28
|
+
fcCatalogClass = nameSpace19110.startWriter(intObj, @hResponseObj, whichDict, true)
|
29
|
+
|
30
|
+
# strip first line
|
31
|
+
first_line = fcCatalogClass.index("\n")
|
32
|
+
fcCatalogClass.slice!(0, first_line + 1)
|
33
|
+
|
34
|
+
outContext = 'feature catalog'
|
35
|
+
|
36
|
+
unless fcCatalogClass.empty?
|
37
|
+
@xml.tag!('mrc:MD_FeatureCatalogue') do
|
38
|
+
@xml.tag!('mrc:featureCatalogue') do
|
39
|
+
|
40
|
+
# data dictionary
|
41
|
+
@xml << fcCatalogClass
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end # writeXML
|
48
|
+
end # MD_FeatureCatalogue class
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -7,6 +7,7 @@
|
|
7
7
|
require_relative '../iso19115_1_writer'
|
8
8
|
require_relative 'class_grid'
|
9
9
|
require_relative 'class_point'
|
10
|
+
require_relative 'class_scope'
|
10
11
|
|
11
12
|
module ADIWG
|
12
13
|
module Mdtranslator
|
@@ -26,12 +27,20 @@ module ADIWG
|
|
26
27
|
# classes used
|
27
28
|
gridClass = Grid.new(@xml, @hResponseObj)
|
28
29
|
pointClass = Point.new(@xml, @hResponseObj)
|
30
|
+
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
31
|
+
|
29
32
|
|
30
33
|
outContext = 'georectified representation'
|
31
34
|
outContext = inContext + ' georectified representation' unless inContext.nil?
|
32
35
|
|
33
36
|
@xml.tag!('msr:MD_Georectified') do
|
34
37
|
|
38
|
+
hGeoRec[:scope].each do |scope|
|
39
|
+
@xml.tag!('msr:scope') do
|
40
|
+
scopeClass.writeXML(scope, inContext)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
35
44
|
# georectified - add grid info
|
36
45
|
hGrid = hGeoRec[:gridRepresentation]
|
37
46
|
gridClass.writeXML(hGrid, outContext)
|
@@ -7,6 +7,7 @@
|
|
7
7
|
require_relative '../iso19115_1_writer'
|
8
8
|
require_relative 'class_grid'
|
9
9
|
require_relative 'class_citation'
|
10
|
+
require_relative 'class_scope'
|
10
11
|
|
11
12
|
module ADIWG
|
12
13
|
module Mdtranslator
|
@@ -26,12 +27,21 @@ module ADIWG
|
|
26
27
|
# classes used
|
27
28
|
gridClass = Grid.new(@xml, @hResponseObj)
|
28
29
|
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
30
|
+
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
31
|
+
|
29
32
|
|
30
33
|
outContext = 'georeferenceable representation'
|
31
34
|
outContext = inContext + ' georeferenceable representation' unless inContext.nil?
|
32
35
|
|
33
36
|
@xml.tag!('msr:MD_Georeferenceable') do
|
34
37
|
|
38
|
+
# georeferenceable - scope
|
39
|
+
hGeoRef[:scope].each do |scope|
|
40
|
+
@xml.tag!('msr:scope') do
|
41
|
+
scopeClass.writeXML(scope, inContext)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
35
45
|
# georeferenceable - add grid info (required)
|
36
46
|
hGrid = hGeoRef[:gridRepresentation]
|
37
47
|
gridClass.writeXML(hGrid, outContext)
|
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
require_relative '../iso19115_1_writer'
|
8
8
|
require_relative 'class_dimension'
|
9
|
+
require_relative 'class_scope'
|
9
10
|
|
10
11
|
module ADIWG
|
11
12
|
module Mdtranslator
|
@@ -25,7 +26,15 @@ module ADIWG
|
|
25
26
|
# classes used
|
26
27
|
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
27
28
|
dimensionClass = MD_Dimension.new(@xml, @hResponseObj)
|
28
|
-
|
29
|
+
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
30
|
+
|
31
|
+
# grid - scope
|
32
|
+
hGrid[:scope].each do |scope|
|
33
|
+
@xml.tag!('msr:scope') do
|
34
|
+
scopeClass.writeXML(scope, inContext)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
29
38
|
# grid - number of dimensions (required)
|
30
39
|
unless hGrid[:numberOfDimensions].nil?
|
31
40
|
@xml.tag!('msr:numberOfDimensions') do
|
@@ -62,6 +71,7 @@ module ADIWG
|
|
62
71
|
@xml.tag!('gco:Boolean', hGrid[:transformationParameterAvailable])
|
63
72
|
end
|
64
73
|
|
74
|
+
|
65
75
|
end # writeXML
|
66
76
|
end # Grid class
|
67
77
|
|
@@ -32,12 +32,12 @@ module ADIWG
|
|
32
32
|
|
33
33
|
# identifier - authority {CI_Citation}
|
34
34
|
hCitation = hIdentifier[:citation]
|
35
|
-
unless hCitation.empty?
|
35
|
+
unless hCitation.nil? || hCitation.empty?
|
36
36
|
@xml.tag!('mcc:authority') do
|
37
37
|
citationClass.writeXML(hCitation, outContext)
|
38
38
|
end
|
39
39
|
end
|
40
|
-
if hCitation.empty? && @hResponseObj[:writerShowTags]
|
40
|
+
if hCitation.nil? || hCitation.empty? && @hResponseObj[:writerShowTags]
|
41
41
|
@xml.tag!('mcc:authority')
|
42
42
|
end
|
43
43
|
|
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
require_relative '../iso19115_1_writer'
|
8
8
|
require_relative 'class_contact'
|
9
|
+
require_relative 'class_partyIdentifier'
|
9
10
|
|
10
11
|
module ADIWG
|
11
12
|
module Mdtranslator
|
@@ -24,6 +25,7 @@ module ADIWG
|
|
24
25
|
|
25
26
|
# classes used
|
26
27
|
contactClass = CI_Contact.new(@xml, @hResponseObj)
|
28
|
+
identifierClass = MD_PartyIdentifier.new(@xml, @hResponseObj)
|
27
29
|
|
28
30
|
outContext = 'individual contact'
|
29
31
|
outContext = inContext + ' individual contact' unless inContext.nil?
|
@@ -70,6 +72,25 @@ module ADIWG
|
|
70
72
|
@xml.tag!('cit:positionName')
|
71
73
|
end
|
72
74
|
|
75
|
+
if hContact[:externalIdentifiers] && hContact[:externalIdentifiers].length > 0
|
76
|
+
hContact[:externalIdentifiers].each do |identifier|
|
77
|
+
@xml.tag!('cit:partyIdentifier') do
|
78
|
+
identifierClass.writeXML(identifier);
|
79
|
+
end
|
80
|
+
end
|
81
|
+
else
|
82
|
+
if hContact[:contactId] &&
|
83
|
+
hContact[:contactId].is_a?(Hash)
|
84
|
+
@xml.tag!('cit:partyIdentifier') do
|
85
|
+
identifierClass.writeXML(hContact[:contactId]);
|
86
|
+
end
|
87
|
+
elsif hContact[:contactId].is_a?(String)
|
88
|
+
@xml.tag!('cit:partyIdentifier') do
|
89
|
+
identifierClass.writeXML({ identifier: hContact[:contactId] })
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
73
94
|
end
|
74
95
|
end
|
75
96
|
if hContact.empty?
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# ISO <<Class>> LE_ProcessStep
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-09-27 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_1_writer'
|
8
|
+
require_relative 'class_responsibility'
|
9
|
+
require_relative 'class_source'
|
10
|
+
require_relative 'class_timePeriod'
|
11
|
+
require_relative 'class_citation'
|
12
|
+
require_relative 'class_scope'
|
13
|
+
require_relative 'class_processing'
|
14
|
+
require_relative 'class_processReport'
|
15
|
+
|
16
|
+
module ADIWG
|
17
|
+
module Mdtranslator
|
18
|
+
module Writers
|
19
|
+
module Iso19115_1
|
20
|
+
|
21
|
+
class LE_ProcessStep
|
22
|
+
|
23
|
+
def initialize(xml, hResponseObj)
|
24
|
+
@xml = xml
|
25
|
+
@hResponseObj = hResponseObj
|
26
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
27
|
+
end
|
28
|
+
|
29
|
+
def writeXML(hStep, inContext = nil)
|
30
|
+
|
31
|
+
# classes used
|
32
|
+
responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
|
33
|
+
sourceClass = Source.new(@xml, @hResponseObj)
|
34
|
+
periodClass = TimePeriod.new(@xml, @hResponseObj)
|
35
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
36
|
+
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
37
|
+
processingClass = LE_Processing.new(@xml, @hResponseObj)
|
38
|
+
reportClass = LE_ProcessStepReport.new(@xml, @hResponseObj)
|
39
|
+
|
40
|
+
outContext = 'process step'
|
41
|
+
outContext = inContext + ' process step' unless inContext.nil?
|
42
|
+
outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
|
43
|
+
|
44
|
+
# process step - id
|
45
|
+
attributes = {}
|
46
|
+
s = hStep[:stepId]
|
47
|
+
unless s.nil?
|
48
|
+
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
49
|
+
end
|
50
|
+
|
51
|
+
@xml.tag!('mrl:LE_ProcessStep', attributes) do
|
52
|
+
|
53
|
+
# process step - description (required)
|
54
|
+
unless hStep[:description].nil?
|
55
|
+
@xml.tag!('mrl:description') do
|
56
|
+
@xml.tag!('gco:CharacterString', hStep[:description])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
if hStep[:description].nil?
|
60
|
+
@NameSpace.issueWarning(260, 'mrl:description')
|
61
|
+
end
|
62
|
+
|
63
|
+
# process step - rationale
|
64
|
+
unless hStep[:rationale].nil?
|
65
|
+
@xml.tag!('mrl:rationale') do
|
66
|
+
@xml.tag!('gco:CharacterString', hStep[:rationale])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if hStep[:rationale].nil? && @hResponseObj[:writerShowTags]
|
70
|
+
@xml.tag!('mrl:rationale')
|
71
|
+
end
|
72
|
+
|
73
|
+
# process step - step datetime {TimePeriod}
|
74
|
+
# {TimeInstant} - not implemented
|
75
|
+
unless hStep[:timePeriod].empty?
|
76
|
+
@xml.tag!('mrl:stepDateTime') do
|
77
|
+
periodClass.writeXML(hStep[:timePeriod])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
if hStep[:timePeriod].empty? && @hResponseObj[:writerShowTags]
|
81
|
+
@xml.tag!('mrl:stepDateTime')
|
82
|
+
end
|
83
|
+
|
84
|
+
# process step - processor [] {CI_Responsibility}
|
85
|
+
aProcessors = hStep[:processors]
|
86
|
+
aProcessors.each do |hProcessor|
|
87
|
+
@xml.tag!('mrl:processor') do
|
88
|
+
responsibilityClass.writeXML(hProcessor, outContext)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
if aProcessors.empty? && @hResponseObj[:writerShowTags]
|
92
|
+
@xml.tag!('mrl:processor')
|
93
|
+
end
|
94
|
+
|
95
|
+
# process step - reference [] {CI_Citation}
|
96
|
+
aReferences = hStep[:references]
|
97
|
+
aReferences.each do |hCitation|
|
98
|
+
@xml.tag!('mrl:reference') do
|
99
|
+
citationClass.writeXML(hCitation, outContext)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
if aReferences.empty? && @hResponseObj[:writerShowTags]
|
103
|
+
@xml.tag!('mrl:reference')
|
104
|
+
end
|
105
|
+
|
106
|
+
# process step - scope {MD_Scope}
|
107
|
+
unless hStep[:scope].empty?
|
108
|
+
@xml.tag!('mrl:scope') do
|
109
|
+
scopeClass.writeXML(hStep[:scope], outContext)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
if hStep[:scope].empty? && @hResponseObj[:writerShowTags]
|
113
|
+
@xml.tag!('mrl:scope')
|
114
|
+
end
|
115
|
+
|
116
|
+
# process step - source [] {Source}
|
117
|
+
aSources = hStep[:stepSources]
|
118
|
+
aSources.each do |hSource|
|
119
|
+
@xml.tag!('mrl:source') do
|
120
|
+
sourceClass.writeXML(hSource)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
if aSources.empty? && @hResponseObj[:writerShowTags]
|
124
|
+
@xml.tag!('mrl:source')
|
125
|
+
end
|
126
|
+
|
127
|
+
# process step - processing information {LE_Processing}
|
128
|
+
hProcessing = hStep[:processingInformation]
|
129
|
+
unless hProcessing.empty?
|
130
|
+
@xml.tag!('mrl:processingInformation') do
|
131
|
+
processingClass.writeXML(hProcessing, outContext)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
if hProcessing.empty? && @hResponseObj[:writerShowTags]
|
135
|
+
@xml.tag!('mrl:processingInformation')
|
136
|
+
end
|
137
|
+
|
138
|
+
# process step - report [] {LE_ProcessStepReport}
|
139
|
+
aReports = hStep[:reports]
|
140
|
+
aReports.each do |hReport|
|
141
|
+
@xml.tag!('mrl:report') do
|
142
|
+
reportClass.writeXML(hReport)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
if aReports.empty? && @hResponseObj[:writerShowTags]
|
146
|
+
@xml.tag!('mrl:report')
|
147
|
+
end
|
148
|
+
|
149
|
+
# process step - output [] {Source}
|
150
|
+
aOutput = hStep[:stepProducts]
|
151
|
+
aOutput.each do |hSource|
|
152
|
+
@xml.tag!('mrl:output') do
|
153
|
+
sourceClass.writeXML(hSource)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
if aOutput.empty? && @hResponseObj[:writerShowTags]
|
157
|
+
@xml.tag!('mrl:output')
|
158
|
+
end
|
159
|
+
|
160
|
+
end # mrl:LI_ProcessStep tag
|
161
|
+
end # writeXML
|
162
|
+
end # LI_ProcessStep class
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|