adiwg-mdtranslator 2.15.0 → 2.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +8 -12
  3. data/adiwg-mdtranslator.gemspec +2 -2
  4. data/lib/adiwg/mdtranslator/internal/acquisition.json +108 -0
  5. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +267 -12
  6. data/lib/adiwg/mdtranslator/internal/qualityReport.json +64 -0
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +11 -1
  9. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +15 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_algorithm.rb +65 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_nominalResolution.rb +78 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +25 -10
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processReport.rb +66 -0
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +46 -9
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb +104 -0
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +27 -2
  17. data/lib/adiwg/mdtranslator/version.rb +4 -1
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_onlineResource.rb +14 -0
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +2 -2
  20. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +20 -15
  21. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +4 -4
  22. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCatalog.rb +53 -0
  23. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +18 -3
  24. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +19 -2
  25. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +1 -1
  26. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +26 -20
  27. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_algorithm.rb +31 -0
  28. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_nominalResolution.rb +31 -0
  29. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_onlineResource.rb +6 -3
  30. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processReport.rb +31 -0
  31. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +6 -0
  32. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processing.rb +37 -0
  33. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_source.rb +7 -2
  34. data/lib/adiwg/mdtranslator_cli.rb +1 -1
  35. metadata +18 -8
@@ -0,0 +1,64 @@
1
+ {
2
+ "dataQuality": [
3
+ {
4
+ "scope": {},
5
+ "standaloneQualityReport": {
6
+ "reportReference": {},
7
+ "abstract": "stand alone abstract",
8
+ "elementReport": []
9
+ },
10
+ "report": [
11
+ {
12
+ "type": "quality report type - enumerated",
13
+ "dateTime": ["2019-06-11T08:10:00"],
14
+ "standaloneQualityReportDetails": "standalone details",
15
+ "qualityMeasure": {
16
+ "identifier": {},
17
+ "name": ["name of measure"],
18
+ "description": "measure description"
19
+ },
20
+ "evaluationMethod": {
21
+ "type": "evaluation method type - enumerated",
22
+ "dateTime": ["2019-06-11T08:35:00"],
23
+ "methodDescription": "evaluation method description",
24
+ "evaluationProcedure": {},
25
+ "referenceDocument": [],
26
+ "evaluationMethodType": "DQ_EvaluationMethodTypeCode",
27
+ "deductiveSource": "deductive source",
28
+ "samplingScheme": "sampling scheme",
29
+ "lotDescription": "lot description",
30
+ "samplingRatio": "sampling ratio"
31
+ },
32
+ "quantitativeResult": [
33
+ {
34
+ "dateTime": "2019-06-11T09:00:00",
35
+ "scope": {},
36
+ "value": [9.99, 9.0],
37
+ "valueUnits": "value units",
38
+ "valueRecordType": "value record type"
39
+ }
40
+ ],
41
+ "descriptiveResult": [
42
+ {
43
+ "dateTime": "2019-06-11T09:00:00",
44
+ "scope": {},
45
+ "statement": "descriptive result statement"
46
+ }
47
+ ],
48
+ "conformanceResult": [
49
+ {
50
+ "dateTime": "2019-06-11T09:00:00",
51
+ "scope": {},
52
+ "specification": {},
53
+ "explanation": "conformance result explanation",
54
+ "pass": false
55
+ }
56
+ ],
57
+ "coverageResult": ["drop this class"],
58
+ "derivedElementReport": [],
59
+ "relatedElementReport": []
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
@@ -2,6 +2,7 @@
2
2
  # unpack fgdc entity and attribute
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-09-19 add citation title to dictionary name
5
6
  # Stan Smith 2017-08-15 original script
6
7
 
7
8
  require 'nokogiri'
@@ -16,15 +17,17 @@ module ADIWG
16
17
 
17
18
  module EntityAttribute
18
19
 
19
- def self.unpack(xEntity, hResponseObj)
20
+ def self.unpack(xEntity, title, hResponseObj)
20
21
 
21
22
  # instance classes needed in script
22
23
  intMetadataClass = InternalMetadata.new
23
24
  hDictionary = intMetadataClass.newDataDictionary
24
25
  hCitation = intMetadataClass.newCitation
25
- hCitation[:title] = 'FGDC EntityAttribute Section 5'
26
26
  hDictionary[:citation] = hCitation
27
27
 
28
+ # add dictionary title
29
+ hCitation[:title] = 'Data Dictionary for: ' + title
30
+
28
31
  # entity attribute 5.1 (detailed) - entity attribute detailed description
29
32
  axDetail = xEntity.xpath('./detailed')
30
33
  unless axDetail.empty?
@@ -2,6 +2,7 @@
2
2
  # unpack fgdc metadata
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-09-19 add citation title to dictionary name
5
6
  # Stan Smith 2017-08-10 original script
6
7
 
7
8
  require 'nokogiri'
@@ -48,9 +49,18 @@ module ADIWG
48
49
  @intObj[:schema] = hSchema
49
50
 
50
51
  # metadata (idinfo 1) - identification information (required)
52
+ title = ''
51
53
  xIdInfo = xMetadata.xpath('./idinfo')
52
54
  unless xIdInfo.empty?
53
55
  Identification.unpack(xIdInfo, intObj, hResponseObj)
56
+ xCitation = xIdInfo.xpath('./citation')
57
+ unless xCitation.empty?
58
+ xCiteInfo = xCitation.xpath('./citeinfo')
59
+ unless xCiteInfo.empty?
60
+ title = xCiteInfo.xpath('./title').text
61
+ end
62
+ end
63
+
54
64
  end
55
65
  if xIdInfo.empty?
56
66
  hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: identification information section (idinfo) missing'
@@ -77,7 +87,7 @@ module ADIWG
77
87
  # metadata (eainfo 5) - entity and attribute
78
88
  xEntity = xMetadata.xpath('./eainfo')
79
89
  unless xEntity.empty?
80
- hDictionary = EntityAttribute.unpack(xEntity, hResponseObj)
90
+ hDictionary = EntityAttribute.unpack(xEntity, title, hResponseObj)
81
91
  unless hDictionary.nil?
82
92
  @intObj[:dataDictionaries] << hDictionary
83
93
  end
@@ -390,3 +390,18 @@ messageList:
390
390
  - {id: 942, message: "voucher repository is missing"}
391
391
 
392
392
  - {id: 950, message: "local projection object is empty"}
393
+
394
+ - {id: 960, message: "nominal resolution object is empty"}
395
+ - {id: 961, message: "nominal resolution object is missing required elements"}
396
+ - {id: 962, message: "nominal resolution cannot be both scanning and ground resolutions"}
397
+
398
+ - {id: 970, message: "algorithm object is empty"}
399
+ - {id: 971, message: "algorithm citation is missing"}
400
+ - {id: 972, message: "algorithm description is missing"}
401
+
402
+ - {id: 980, message: "process step report object is empty"}
403
+ - {id: 981, message: "process step report name is missing"}
404
+
405
+ - {id: 990, message: "processing object is empty"}
406
+ - {id: 991, message: "processing identifier is missing"}
407
+
@@ -0,0 +1,65 @@
1
+ # unpack algorithm
2
+ # Reader - ADIwg JSON to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2019-09-23 original script
6
+
7
+ require_relative 'module_citation'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Readers
12
+ module MdJson
13
+
14
+ module Algorithm
15
+
16
+ def self.unpack(hAlgorithm, responseObj, inContext = nil)
17
+
18
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
19
+
20
+ # return nil object if input is empty
21
+ if hAlgorithm.empty?
22
+ @MessagePath.issueWarning(970, responseObj, inContext)
23
+ return nil
24
+ end
25
+
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ intAlgorithm = intMetadataClass.newAlgorithm
29
+
30
+ outContext = 'algorithm'
31
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
32
+
33
+ # algorithm - citation (required)
34
+ if hAlgorithm.has_key?('citation')
35
+ unless hAlgorithm['citation'].empty?
36
+ hReturn = Citation.unpack(hAlgorithm['citation'], responseObj, outContext)
37
+ unless hReturn.nil?
38
+ intAlgorithm[:citation] = hReturn
39
+ end
40
+ end
41
+ end
42
+ if intAlgorithm[:citation].empty?
43
+ @MessagePath.issueWarning(971, responseObj, inContext)
44
+ end
45
+
46
+ # algorithm - description (required)
47
+ if hAlgorithm.has_key?('description')
48
+ unless hAlgorithm['description'] == ''
49
+ intAlgorithm[:description] = hAlgorithm['description']
50
+ end
51
+ end
52
+ if intAlgorithm[:description].nil?
53
+ @MessagePath.issueWarning(972, responseObj, inContext)
54
+ end
55
+
56
+ return intAlgorithm
57
+
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,78 @@
1
+ # unpack nominal resolution
2
+ # Reader - ADIwg JSON to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2019-09-22 original script
6
+
7
+ require_relative 'module_measure'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Readers
12
+ module MdJson
13
+
14
+ module NominalResolution
15
+
16
+ def self.unpack(hResolution, responseObj, inContext = nil)
17
+
18
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
19
+
20
+ # return nil object if input is empty
21
+ if hResolution.empty?
22
+ @MessagePath.issueWarning(960, responseObj, inContext)
23
+ return nil
24
+ end
25
+
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ intResolution = intMetadataClass.newNominalResolution
29
+
30
+ outContext = 'nominal resolution'
31
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
32
+
33
+ haveRequired = 0
34
+
35
+ # nominal resolution - scanning resolution (required if)
36
+ if hResolution.has_key?('scanningResolution')
37
+ hMeasure = hResolution['scanningResolution']
38
+ unless hMeasure.empty?
39
+ hMeasure['type'] = 'distance'
40
+ hReturn = Measure.unpack(hMeasure, responseObj, outContext)
41
+ unless hReturn.nil?
42
+ intResolution[:scanningResolution] = hReturn
43
+ haveRequired += 1
44
+ end
45
+ end
46
+ end
47
+
48
+ # nominal resolution - ground resolution (required if)
49
+ if hResolution.has_key?('groundResolution')
50
+ hMeasure = hResolution['groundResolution']
51
+ unless hMeasure.empty?
52
+ hMeasure['type'] = 'distance'
53
+ hReturn = Measure.unpack(hMeasure, responseObj, outContext)
54
+ unless hReturn.nil?
55
+ intResolution[:groundResolution] = hReturn
56
+ haveRequired += 1
57
+ end
58
+ end
59
+ end
60
+
61
+ unless haveRequired > 0
62
+ @MessagePath.issueError(961, responseObj, inContext)
63
+ end
64
+
65
+ if haveRequired == 2
66
+ @MessagePath.issueError(962, responseObj, inContext)
67
+ end
68
+
69
+ return intResolution
70
+
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+ end
77
+ end
78
+ end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON V1 to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-09-18 add applicationProfile and protocolRequest
5
6
  # Stan Smith 2018-06-22 refactored error and warning messaging
6
7
  # Stan Smith 2016-10-03 original script
7
8
  # Stan Smith 2015-07-14 refactored to remove global namespace constants
@@ -42,34 +43,48 @@ module ADIWG
42
43
  @MessagePath.issueError(601, responseObj, inContext)
43
44
  end
44
45
 
45
- # resource - web link protocol
46
- if hOnlineRes.has_key?('protocol')
47
- unless hOnlineRes['protocol'] == ''
48
- intOLRes[:olResProtocol] = hOnlineRes['protocol']
49
- end
50
- end
51
-
52
- # resource - web link name
46
+ # resource - name
53
47
  if hOnlineRes.has_key?('name')
54
48
  unless hOnlineRes['name'] == ''
55
49
  intOLRes[:olResName] = hOnlineRes['name']
56
50
  end
57
51
  end
58
52
 
59
- # resource - web link description
53
+ # resource - description
60
54
  if hOnlineRes.has_key?('description')
61
55
  unless hOnlineRes['description'] == ''
62
56
  intOLRes[:olResDesc] = hOnlineRes['description']
63
57
  end
64
58
  end
65
59
 
66
- # resource - web link function
60
+ # resource - unction
67
61
  if hOnlineRes.has_key?('function')
68
62
  unless hOnlineRes['function'] == ''
69
63
  intOLRes[:olResFunction] = hOnlineRes['function']
70
64
  end
71
65
  end
72
66
 
67
+ # resource - application profile
68
+ if hOnlineRes.has_key?('applicationProfile')
69
+ unless hOnlineRes['applicationProfile'] == ''
70
+ intOLRes[:olResApplicationProfile] = hOnlineRes['applicationProfile']
71
+ end
72
+ end
73
+
74
+ # resource - protocol
75
+ if hOnlineRes.has_key?('protocol')
76
+ unless hOnlineRes['protocol'] == ''
77
+ intOLRes[:olResProtocol] = hOnlineRes['protocol']
78
+ end
79
+ end
80
+
81
+ # resource - protocol request
82
+ if hOnlineRes.has_key?('protocolRequest')
83
+ unless hOnlineRes['protocolRequest'] == ''
84
+ intOLRes[:olResProtocolRequest] = hOnlineRes['protocolRequest']
85
+ end
86
+ end
87
+
73
88
  return intOLRes
74
89
  end
75
90
 
@@ -0,0 +1,66 @@
1
+ # unpack process step report
2
+ # Reader - ADIwg JSON to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2019-09-23 original script
6
+
7
+ require_relative 'module_citation'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Readers
12
+ module MdJson
13
+
14
+ module ProcessStepReport
15
+
16
+ def self.unpack(hReport, responseObj, inContext = nil)
17
+
18
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
19
+
20
+ # return nil object if input is empty
21
+ if hReport.empty?
22
+ @MessagePath.issueWarning(980, responseObj, inContext)
23
+ return nil
24
+ end
25
+
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ intProcessReport = intMetadataClass.newProcessStepReport
29
+
30
+ outContext = 'process step report'
31
+ outContext = inContext + ' > ' + outContext unless inContext.nil?
32
+
33
+ # process step report - name (required)
34
+ if hReport.has_key?('name')
35
+ unless hReport['name'] == ''
36
+ intProcessReport[:name] = hReport['name']
37
+ end
38
+ end
39
+ if intProcessReport[:name].nil?
40
+ @MessagePath.issueWarning(981, responseObj, inContext)
41
+ end
42
+
43
+ # process step report - description
44
+ if hReport.has_key?('description')
45
+ unless hReport['description'] == ''
46
+ intProcessReport[:description] = hReport['description']
47
+ end
48
+ end
49
+
50
+ # process step report - file type
51
+ if hReport.has_key?('fileType')
52
+ unless hReport['fileType'] == ''
53
+ intProcessReport[:fileType] = hReport['fileType']
54
+ end
55
+ end
56
+
57
+ return intProcessReport
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-09-23 add LE_Source elements
5
6
  # Stan Smith 2018-06-22 refactored error and warning messaging
6
7
  # Stan Smith 2017-08-30 added support for process step sources
7
8
  # Stan Smith 2016-10-15 refactored for mdJson 2.0
@@ -14,6 +15,9 @@ require_relative 'module_timePeriod'
14
15
  require_relative 'module_responsibleParty'
15
16
  require_relative 'module_citation'
16
17
  require_relative 'module_scope'
18
+ require_relative 'module_source'
19
+ require_relative 'module_processing'
20
+ require_relative 'module_processReport'
17
21
 
18
22
  module ADIWG
19
23
  module Mdtranslator
@@ -48,9 +52,11 @@ module ADIWG
48
52
 
49
53
  # process step - description - (required)
50
54
  if hProcStep.has_key?('description')
51
- intProcStep[:description] = hProcStep['description']
55
+ unless hProcStep['description'] == ''
56
+ intProcStep[:description] = hProcStep['description']
57
+ end
52
58
  end
53
- if intProcStep[:description].nil? || intProcStep[:description] == ''
59
+ if intProcStep[:description].nil?
54
60
  @MessagePath.issueError(641, responseObj, inContext)
55
61
  end
56
62
 
@@ -63,16 +69,15 @@ module ADIWG
63
69
 
64
70
  # process step - time period
65
71
  if hProcStep.has_key?('timePeriod')
66
- hObject = hProcStep['timePeriod']
67
- unless hObject.empty?
68
- hReturn = TimePeriod.unpack(hObject, responseObj, outContext)
72
+ unless hProcStep['timePeriod'].empty?
73
+ hReturn = TimePeriod.unpack(hProcStep['timePeriod'], responseObj, outContext)
69
74
  unless hReturn.nil?
70
75
  intProcStep[:timePeriod] = hReturn
71
76
  end
72
77
  end
73
78
  end
74
79
 
75
- # process step - step processors [responsible party]
80
+ # process step - step processors [] {responsibility}
76
81
  if hProcStep.has_key?('processor')
77
82
  aProc = hProcStep['processor']
78
83
  aProc.each do |item|
@@ -83,7 +88,7 @@ module ADIWG
83
88
  end
84
89
  end
85
90
 
86
- # process step - reference [citation]
91
+ # process step - reference [] {citation}
87
92
  if hProcStep.has_key?('reference')
88
93
  aReference = hProcStep['reference']
89
94
  aReference.each do |item|
@@ -94,7 +99,7 @@ module ADIWG
94
99
  end
95
100
  end
96
101
 
97
- # process step - step sources [source]
102
+ # process step - step sources [] {source}
98
103
  if hProcStep.has_key?('stepSource')
99
104
  aSources = hProcStep['stepSource']
100
105
  aSources.each do |item|
@@ -105,7 +110,7 @@ module ADIWG
105
110
  end
106
111
  end
107
112
 
108
- # process step - step products [source]
113
+ # process step - step products [] {source}
109
114
  if hProcStep.has_key?('stepProduct')
110
115
  aSources = hProcStep['stepProduct']
111
116
  aSources.each do |item|
@@ -127,6 +132,38 @@ module ADIWG
127
132
  end
128
133
  end
129
134
 
135
+ # process step - output [] {source}
136
+ if hProcStep.has_key?('output')
137
+ aSources = hProcStep['output']
138
+ aSources.each do |item|
139
+ hSource = Source.unpack(item, responseObj, outContext)
140
+ unless hSource.nil?
141
+ intProcStep[:output] << hSource
142
+ end
143
+ end
144
+ end
145
+
146
+ # process step - processing information {processing}
147
+ if hProcStep.has_key?('processingInformation')
148
+ unless hProcStep['processingInformation'].empty?
149
+ hReturn = Processing.unpack(hProcStep['processingInformation'], responseObj, outContext)
150
+ unless hReturn.nil?
151
+ intProcStep[:processingInformation] = hReturn
152
+ end
153
+ end
154
+ end
155
+
156
+ # process step - report [] {processReport}
157
+ if hProcStep.has_key?('report')
158
+ aReports = hProcStep['report']
159
+ aReports.each do |item|
160
+ hReport = ProcessStepReport.unpack(item, responseObj, outContext)
161
+ unless hReport.nil?
162
+ intProcStep[:reports] << hReport
163
+ end
164
+ end
165
+ end
166
+
130
167
  return intProcStep
131
168
 
132
169
  end