adiwg-mdtranslator 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +5 -3
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +6 -6
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +66 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +4 -6
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timeInstant.rb +23 -6
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +87 -24
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +135 -126
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +84 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +80 -68
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +118 -95
  13. data/lib/adiwg/mdtranslator/version.rb +3 -1
  14. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +9 -0
  15. data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +4 -4
  16. data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +6 -6
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_geologicAge.rb +71 -0
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_temporalExtent.rb +20 -21
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_timeInstant.rb +8 -0
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_timePeriod.rb +23 -0
  21. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +5 -3
  22. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geologicAge.rb +34 -0
  23. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_timeInstant.rb +4 -1
  24. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_timePeriod.rb +6 -2
  25. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_id.rb +0 -2
  26. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +23 -2
  27. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f08c8cabea92742e77f01c30ae68550da7a583d
4
- data.tar.gz: 8963e33ca95184476f15d4c8e94834b3466c9c08
3
+ metadata.gz: 237525902d612d3bf3f8c5a81c373a789d27b9c8
4
+ data.tar.gz: caa5edd6722337501c2698e0ea7ee4a61b0eccea
5
5
  SHA512:
6
- metadata.gz: '09dd47945d0989ceaa90dbc46a435af71f4d1f36ce8d54f5e81d02ed57d64ee8a9c75af7dcbded016f9b47fd72b2bf7181c7479a3f06905911051f5b047c866f'
7
- data.tar.gz: 85cba08c6d6dadae7eb549cca69a08d3a2323924ebae6ce4b8faca4483f182484c25b4f5301f855bb21694b5de2868610435c3e4bfad4a9fae7af5ef018eebe3
6
+ metadata.gz: 79a9d0abadec138c139b287b3e306033eee12b9d0467b1ee0ce3e010a121f1aff03b88e4e715f05147ea48e58c277eea536631e88142f430eace7f6e6a37779a
7
+ data.tar.gz: c459062d8d426ac181db0cc1f279811d5567e773c9f1bec809c3487e96920fcb11dad897343a60411ee8f7de31ea2986924953f09a295cf485c7e48bbc65e7e8
data/CHANGELOG.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.5.0](https://github.com/adiwg/mdTranslator/tree/v2.5.0) (2017-11-06)
3
+ ## [v2.6.0](https://github.com/adiwg/mdTranslator/tree/v2.6.0) (2017-11-10)
4
+
5
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.5.0...v2.6.0)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - mdJSON reader version is stale [\#158](https://github.com/adiwg/mdTranslator/issues/158)
4
10
 
11
+ **Merged pull requests:**
12
+
13
+ - Add Geologic Age to timeInstant and timePeriod [\#161](https://github.com/adiwg/mdTranslator/pull/161) ([stansmith907](https://github.com/stansmith907))
14
+
15
+ ## [v2.5.0](https://github.com/adiwg/mdTranslator/tree/v2.5.0) (2017-11-06)
5
16
  [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.4.0...v2.5.0)
6
17
 
7
18
  **Fixed bugs:**
@@ -534,7 +534,8 @@ class InternalMetadata
534
534
  description: nil,
535
535
  identifier: {},
536
536
  instantNames: [],
537
- timeInstant: {}
537
+ timeInstant: {},
538
+ geologicAge: {}
538
539
  }
539
540
  end
540
541
 
@@ -559,7 +560,7 @@ class InternalMetadata
559
560
  ageEstimate: nil,
560
561
  ageUncertainty: nil,
561
562
  ageExplanation: nil,
562
- ageReference: []
563
+ ageReferences: []
563
564
  }
564
565
  end
565
566
 
@@ -712,8 +713,9 @@ class InternalMetadata
712
713
 
713
714
  def newDataDictionary
714
715
  {
715
- citation: {},
716
+ description: nil,
716
717
  subjects: [],
718
+ citation: {},
717
719
  recommendedUses: [],
718
720
  locales: [],
719
721
  responsibleParty: {},
@@ -23,7 +23,7 @@ module ADIWG
23
23
  hDateTime = intMetadataClass.newDateTime
24
24
 
25
25
  if date.nil? || date == ''
26
- hResponseObj[:readerExecutionMessages] << 'date string is missing from dateTime conversion'
26
+ hResponseObj[:readerExecutionMessages] << 'date string is missing from dateTime'
27
27
  hResponseObj[:readerExecutionPass] = false
28
28
  return nil
29
29
  end
@@ -74,12 +74,12 @@ module ADIWG
74
74
  else
75
75
  timeOffset = Time.now.gmt_offset
76
76
  aOffset = timeOffset.divmod(3600)
77
- hOffset = aOffset[0]
78
- mOffset = aOffset[1] * 60
79
- if hOffset >= 0
80
- zone = '+' + '%02d' % hOffset + ':' + '%02d' % mOffset
77
+ hourOff = aOffset[0]
78
+ minOff = aOffset[1] * 60
79
+ if hourOff >= 0
80
+ zone = '+' + '%02d' % hourOff + ':' + '%02d' % minOff
81
81
  else
82
- zone = '%03d' % hOffset + ':' + '%02d' % mOffset
82
+ zone = '%03d' % hourOff + ':' + '%02d' % minOff
83
83
  end
84
84
  dtIn = dtIn + zone
85
85
  end
@@ -0,0 +1,66 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc bio geologic age
3
+
4
+ # History:
5
+ # Stan Smith 2017-11-06 original script
6
+
7
+ require 'nokogiri'
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+ require_relative 'module_citation'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Readers
14
+ module Fgdc
15
+
16
+ module GeologicAge
17
+
18
+ def self.unpack(xGeoAge, hResponseObj)
19
+
20
+ # instance classes needed in script
21
+ intMetadataClass = InternalMetadata.new
22
+ intGeoAge = intMetadataClass.newGeologicAge
23
+
24
+ # geologic age bio (geolscal) - time scale (required)
25
+ scale = xGeoAge.xpath('./geolscal').text
26
+ unless scale.empty?
27
+ intGeoAge[:ageTimeScale] = scale
28
+ end
29
+
30
+ # geologic age bio (geolest) - age estimate (required)
31
+ estimate = xGeoAge.xpath('./geolest').text
32
+ unless estimate.empty?
33
+ intGeoAge[:ageEstimate] = estimate
34
+ end
35
+
36
+ # geologic age bio (geolun) - age estimate uncertainty
37
+ uncertain = xGeoAge.xpath('./geolun').text
38
+ unless uncertain.empty?
39
+ intGeoAge[:ageUncertainty] = uncertain
40
+ end
41
+
42
+ # geologic age bio (geolexpl) - explanation
43
+ explain = xGeoAge.xpath('./geolexpl').text
44
+ unless explain.empty?
45
+ intGeoAge[:ageExplanation] = explain
46
+ end
47
+
48
+ # geologic age bio (geolcit) - age references [] {citation}
49
+ axReferences = xGeoAge.xpath('./geolcit')
50
+ unless axReferences.empty?
51
+ axReferences.each do |xCitation|
52
+ hCitation = Citation.unpack(xCitation, hResponseObj)
53
+ intGeoAge[:ageReferences] << hCitation unless hCitation.nil?
54
+ end
55
+ end
56
+
57
+ return intGeoAge
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -60,20 +60,18 @@ module ADIWG
60
60
  xTimePeriod = xIdInfo.xpath('./timeperd')
61
61
  unless xTimePeriod.empty?
62
62
 
63
- # time period for single date and date range
63
+ # time period for single date, multi-date, and date range {resource timePeriod}
64
64
  hTimePeriod = TimePeriod.unpack(xTimePeriod, hResponseObj)
65
65
  hResourceInfo[:timePeriod] = hTimePeriod unless hTimePeriod.nil?
66
66
 
67
- # time period multiple date time pairs 9.1.2 (mdattim)
67
+ # time period multi-date also placed in temporalExtent
68
68
  axMultiple = xTimePeriod.xpath('./timeinfo/mdattim/sngdate')
69
69
  unless axMultiple.empty?
70
70
  current = xTimePeriod.xpath('./current').text
71
71
  hExtent = intMetadataClass.newExtent
72
- hExtent[:description] = 'FGDC resource time period multiple date/times'
72
+ hExtent[:description] = 'FGDC resource time period for multiple date/times/geological age'
73
73
  axMultiple.each do |xDateTime|
74
- date = xDateTime.xpath('./caldate').text
75
- time = xDateTime.xpath('./time').text
76
- hInstant = TimeInstant.unpack(date, time, hResponseObj)
74
+ hInstant = TimeInstant.unpack(xDateTime, hResponseObj)
77
75
  unless hInstant.nil?
78
76
  hTempExtent = intMetadataClass.newTemporalExtent
79
77
  hInstant[:description] = current
@@ -2,11 +2,13 @@
2
2
  # unpack fgdc time instant
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-07 add geologic age
5
6
  # Stan Smith 2017-08-21 original script
6
7
 
7
8
  require 'nokogiri'
8
9
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
10
  require_relative 'module_dateTime'
11
+ require_relative 'module_geologicAge'
10
12
 
11
13
  module ADIWG
12
14
  module Mdtranslator
@@ -15,17 +17,32 @@ module ADIWG
15
17
 
16
18
  module TimeInstant
17
19
 
18
- def self.unpack(date, time, hResponseObj)
20
+ def self.unpack(xDateTime, hResponseObj)
19
21
 
20
22
  # instance classes needed in script
21
23
  intMetadataClass = InternalMetadata.new
22
24
  hTimeInstant = intMetadataClass.newTimeInstant
23
25
 
24
- # time instant
25
- hDateTime = DateTime.unpack(date, time, hResponseObj)
26
- unless hDateTime.nil?
27
- hTimeInstant[:timeInstant] = hDateTime
28
- return hTimeInstant
26
+ date = xDateTime.xpath('./caldate').text
27
+ time = xDateTime.xpath('./time').text
28
+ xGeoAge = xDateTime.xpath('./geolage')
29
+
30
+ # time instant - date-time
31
+ unless date.empty?
32
+ hDateTime = DateTime.unpack(date, time, hResponseObj)
33
+ unless hDateTime.nil?
34
+ hTimeInstant[:timeInstant] = hDateTime
35
+ return hTimeInstant
36
+ end
37
+ end
38
+
39
+ # time instant - geological age
40
+ unless xGeoAge.empty?
41
+ hGeoAge = GeologicAge.unpack(xGeoAge, hResponseObj)
42
+ unless hGeoAge.nil?
43
+ hTimeInstant[:geologicAge] = hGeoAge
44
+ return hTimeInstant
45
+ end
29
46
  end
30
47
 
31
48
  return nil
@@ -2,11 +2,13 @@
2
2
  # unpack fgdc time period
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-11-06 add geologic time
5
6
  # Stan Smith 2017-08-17 original script
6
7
 
7
8
  require 'nokogiri'
8
9
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
10
  require_relative 'module_dateTime'
11
+ require_relative 'module_geologicAge'
10
12
 
11
13
  module ADIWG
12
14
  module Mdtranslator
@@ -25,13 +27,12 @@ module ADIWG
25
27
  xTimeInfo = xTimePeriod.xpath('./timeinfo')
26
28
 
27
29
  # current may have different element tags depending on timePeriod source
28
- current = nil?
29
- xFoundIt = xTimePeriod.at('./current')
30
- if xFoundIt.nil?
31
- xFoundIt = xTimePeriod.at('./srccurr')
30
+ xCurrent = xTimePeriod.at('./current')
31
+ if xCurrent.nil?
32
+ xCurrent = xTimePeriod.at('./srccurr')
32
33
  end
33
- unless xFoundIt.nil?
34
- current = xFoundIt.text
34
+ unless xCurrent.nil?
35
+ hTimePeriod[:description] = xCurrent.text
35
36
  end
36
37
 
37
38
  unless xTimeInfo.empty?
@@ -43,36 +44,80 @@ module ADIWG
43
44
  # single date 9.1.1/9.1.2 (caldate/time) - single date/time {date} (required) {time}
44
45
  date = xSingle.xpath('./caldate').text
45
46
  time = xSingle.xpath('./time').text
46
- hDateTime = DateTime.unpack(date, time, hResponseObj)
47
- unless hDateTime.nil?
48
- hTimePeriod[:endDateTime] = hDateTime
47
+ unless date.empty?
48
+ hDateTime = DateTime.unpack(date, time, hResponseObj)
49
+ unless hDateTime.nil?
50
+ hTimePeriod[:endDateTime] = hDateTime
51
+ return hTimePeriod
52
+ end
49
53
  end
50
- hTimePeriod[:description] = current
51
54
 
52
- return hTimePeriod
55
+ # or bio extension's geologic age
56
+ xGeoAge = xSingle.xpath('./geolage')
57
+ unless xGeoAge.empty?
58
+ hGeoAge = GeologicAge.unpack(xGeoAge, hResponseObj)
59
+ unless hGeoAge.nil?
60
+ hTimePeriod[:endGeologicAge] = hGeoAge
61
+ return hTimePeriod
62
+ end
63
+ end
53
64
 
54
65
  end
55
66
 
56
67
  # time period 9.2 (mdattim) - multiple date times
57
- # take first date
58
68
  xMulti = xTimeInfo.xpath('./mdattim')
59
69
  unless xMulti.empty?
60
- axSingle = xMulti.xpath('./sngdate')
61
70
 
62
- # use first occurrence of the multiple date times
63
- unless axSingle.empty?
64
- xSingle = axSingle[0]
65
- date = xSingle.xpath('./caldate').text
66
- time = xSingle.xpath('./time').text
67
- hDateTime = DateTime.unpack(date, time, hResponseObj)
68
- unless hDateTime.nil?
69
- hTimePeriod[:startDateTime] = hDateTime
71
+ # use first occurrence of the multiple date-times as start date
72
+ xStart = xMulti.xpath('//sngdate').first
73
+ startDate = xStart.xpath('./caldate').text
74
+ startTime = xStart.xpath('./time').text
75
+ unless startDate.empty?
76
+ hStartDateTime = DateTime.unpack(startDate, startTime, hResponseObj)
77
+ unless hStartDateTime.nil?
78
+ hTimePeriod[:startDateTime] = hStartDateTime
79
+ end
80
+ end
81
+
82
+ # use last occurrence of the multiple date-times as end date
83
+ xEnd = xMulti.xpath('//sngdate').last
84
+ endDate = xEnd.xpath('./caldate').text
85
+ endTime = xEnd.xpath('./time').text
86
+ unless endDate.empty?
87
+ hEndDateTime = DateTime.unpack(endDate, endTime, hResponseObj)
88
+ unless hEndDateTime.nil?
89
+ hTimePeriod[:endDateTime] = hEndDateTime
90
+ end
91
+ end
92
+
93
+ # and/or bio extension's geologic age
94
+ axGeoAge = xMulti.xpath('//geolage')
95
+ unless axGeoAge.empty?
96
+
97
+ # use first occurrence of the multiple geologic age as start age
98
+ xGeoAge = axGeoAge.xpath('//geolage').first
99
+ unless xGeoAge.nil?
100
+ hGeoAge = GeologicAge.unpack(xGeoAge, hResponseObj)
101
+ unless hGeoAge.nil?
102
+ hTimePeriod[:startGeologicAge] = hGeoAge
103
+ end
70
104
  end
71
- hTimePeriod[:description] = current
72
105
 
73
- return hTimePeriod
106
+ # use lase occurrence of the multiple geologic age as end age
107
+ if axGeoAge.length > 1
108
+ xGeoAge = axGeoAge.xpath('//geolage').last
109
+ unless xGeoAge.nil?
110
+ hGeoAge = GeologicAge.unpack(xGeoAge, hResponseObj)
111
+ unless hGeoAge.nil?
112
+ hTimePeriod[:endGeologicAge] = hGeoAge
113
+ end
114
+ end
115
+ end
74
116
 
75
117
  end
118
+
119
+ return hTimePeriod
120
+
76
121
  end
77
122
 
78
123
  # time period 9.3 (rngdates) - range of dates
@@ -96,7 +141,25 @@ module ADIWG
96
141
  unless hDateTime.nil?
97
142
  hTimePeriod[:endDateTime] = hDateTime
98
143
  end
99
- hTimePeriod[:description] = current
144
+
145
+ # and/or bio extension's geologic age
146
+ # start geologic age
147
+ xBegGeoAge = xRange.xpath('./beggeol')
148
+ unless xBegGeoAge.empty?
149
+ hGeoAge = GeologicAge.unpack(xBegGeoAge, hResponseObj)
150
+ unless hGeoAge.nil?
151
+ hTimePeriod[:startGeologicAge] = hGeoAge
152
+ end
153
+ end
154
+
155
+ # end geologic age
156
+ xEndGeoAge = xRange.xpath('./endgeol')
157
+ unless xEndGeoAge.empty?
158
+ hGeoAge = GeologicAge.unpack(xEndGeoAge, hResponseObj)
159
+ unless hGeoAge.nil?
160
+ hTimePeriod[:endGeologicAge] = hGeoAge
161
+ end
162
+ end
100
163
 
101
164
  return hTimePeriod
102
165
 
@@ -2,10 +2,11 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
6
- # Stan Smith 2015-07-14 refactored to remove global namespace constants
7
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
8
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
5
+ # Stan Smith 2017-11-09 add dictionary description
6
+ # Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
7
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
8
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
9
10
  # Stan Smith 2014-12-01 original script
10
11
 
11
12
  require_relative 'module_citation'
@@ -15,137 +16,145 @@ require_relative 'module_locale'
15
16
  require_relative 'module_responsibleParty'
16
17
 
17
18
  module ADIWG
18
- module Mdtranslator
19
- module Readers
20
- module MdJson
21
-
22
- module DataDictionary
23
-
24
- def self.unpack(hDictionary, responseObj)
25
-
26
- # return nil object if input is empty
27
- if hDictionary.empty?
28
- responseObj[:readerExecutionMessages] << 'Data Dictionary object is empty'
29
- responseObj[:readerExecutionPass] = false
30
- return nil
31
- end
32
-
33
- # instance classes needed in script
34
- intMetadataClass = InternalMetadata.new
35
- intDictionary = intMetadataClass.newDataDictionary
36
-
37
- # dictionary - citation (required by mdJson) {citation}
38
- if hDictionary.has_key?('citation')
39
- hCitation = hDictionary['citation']
40
- unless hCitation.empty?
41
- hReturn = Citation.unpack(hCitation, responseObj)
42
- unless hReturn.nil?
43
- intDictionary[:citation] = hReturn
44
- end
45
- end
46
- end
47
- if intDictionary[:citation].empty?
48
- responseObj[:readerExecutionMessages] << 'Data Dictionary citation is empty'
49
- responseObj[:readerExecutionPass] = false
50
- return nil
51
- end
52
-
53
- # dictionary - subject [] (required)
54
- if hDictionary.has_key?('subject')
55
- aSubjects = hDictionary['subject']
56
- aSubjects.each do |item|
57
- if item != ''
58
- intDictionary[:subjects] << item
59
- end
60
- end
61
- end
62
- if intDictionary[:subjects].empty?
63
- responseObj[:readerExecutionMessages] << 'Data Dictionary subject is missing'
64
- responseObj[:readerExecutionPass] = false
65
- return nil
66
- end
67
-
68
- # dictionary - recommended use []
69
- if hDictionary.has_key?('recommendedUse')
70
- aUses = hDictionary['recommendedUse']
71
- aUses.each do |item|
72
- if item != ''
73
- intDictionary[:recommendedUses] << item
74
- end
75
- end
19
+ module Mdtranslator
20
+ module Readers
21
+ module MdJson
22
+
23
+ module DataDictionary
24
+
25
+ def self.unpack(hDictionary, responseObj)
26
+
27
+ # return nil object if input is empty
28
+ if hDictionary.empty?
29
+ responseObj[:readerExecutionMessages] << 'Data Dictionary object is empty'
30
+ responseObj[:readerExecutionPass] = false
31
+ return nil
32
+ end
33
+
34
+ # instance classes needed in script
35
+ intMetadataClass = InternalMetadata.new
36
+ intDictionary = intMetadataClass.newDataDictionary
37
+
38
+ # dictionary - description
39
+ if hDictionary.has_key?('description')
40
+ s = hDictionary['description']
41
+ unless s == ''
42
+ intDictionary[:description] = s
43
+ end
44
+ end
45
+
46
+ # dictionary - citation (required by mdJson) {citation}
47
+ if hDictionary.has_key?('citation')
48
+ hCitation = hDictionary['citation']
49
+ unless hCitation.empty?
50
+ hReturn = Citation.unpack(hCitation, responseObj)
51
+ unless hReturn.nil?
52
+ intDictionary[:citation] = hReturn
76
53
  end
77
-
78
- # dictionary - locale [] {locale}
79
- if hDictionary.has_key?('locale')
80
- aLocales = hDictionary['locale']
81
- aLocales.each do |hItem|
82
- hReturn = Locale.unpack(hItem, responseObj)
83
- unless hReturn.nil?
84
- intDictionary[:locales] << hReturn
85
- end
86
- end
54
+ end
55
+ end
56
+ if intDictionary[:citation].empty?
57
+ responseObj[:readerExecutionMessages] << 'Data Dictionary citation is empty'
58
+ responseObj[:readerExecutionPass] = false
59
+ return nil
60
+ end
61
+
62
+ # dictionary - subject [] (required)
63
+ if hDictionary.has_key?('subject')
64
+ aSubjects = hDictionary['subject']
65
+ aSubjects.each do |item|
66
+ if item != ''
67
+ intDictionary[:subjects] << item
87
68
  end
88
-
89
- # dictionary - responsible party (required) {responsibleParty}
90
- if hDictionary.has_key?('responsibleParty')
91
- hRParty = hDictionary['responsibleParty']
92
- unless hRParty.empty?
93
- hReturn = ResponsibleParty.unpack(hRParty, responseObj)
94
- unless hReturn.nil?
95
- intDictionary[:responsibleParty] = hReturn
96
- end
97
- end
69
+ end
70
+ end
71
+ if intDictionary[:subjects].empty?
72
+ responseObj[:readerExecutionMessages] << 'Data Dictionary subject is missing'
73
+ responseObj[:readerExecutionPass] = false
74
+ return nil
75
+ end
76
+
77
+ # dictionary - recommended use []
78
+ if hDictionary.has_key?('recommendedUse')
79
+ aUses = hDictionary['recommendedUse']
80
+ aUses.each do |item|
81
+ if item != ''
82
+ intDictionary[:recommendedUses] << item
98
83
  end
99
- if intDictionary[:responsibleParty].empty?
100
- responseObj[:readerExecutionMessages] << 'Data Dictionary responsible party is empty'
101
- responseObj[:readerExecutionPass] = false
102
- return nil
103
- end
104
-
105
- # dictionary - dictionary format
106
- if hDictionary.has_key?('dictionaryFormat')
107
- s = hDictionary['dictionaryFormat']
108
- unless s == ''
109
- intDictionary[:dictionaryFormat] = s
110
- end
84
+ end
85
+ end
86
+
87
+ # dictionary - locale [] {locale}
88
+ if hDictionary.has_key?('locale')
89
+ aLocales = hDictionary['locale']
90
+ aLocales.each do |hItem|
91
+ hReturn = Locale.unpack(hItem, responseObj)
92
+ unless hReturn.nil?
93
+ intDictionary[:locales] << hReturn
111
94
  end
112
-
113
- # dictionary - dictionary included with resource
114
- if hDictionary.has_key?('dictionaryIncludedWithResource')
115
- if hDictionary['dictionaryIncludedWithResource'] === true
116
- intDictionary[:includedWithDataset] = hDictionary['dictionaryIncludedWithResource']
117
- end
95
+ end
96
+ end
97
+
98
+ # dictionary - responsible party (required) {responsibleParty}
99
+ if hDictionary.has_key?('responsibleParty')
100
+ hRParty = hDictionary['responsibleParty']
101
+ unless hRParty.empty?
102
+ hReturn = ResponsibleParty.unpack(hRParty, responseObj)
103
+ unless hReturn.nil?
104
+ intDictionary[:responsibleParty] = hReturn
118
105
  end
119
-
120
- # dictionary - domains [] {domain}
121
- if hDictionary.has_key?('domain')
122
- aDomains = hDictionary['domain']
123
- aDomains.each do |hItem|
124
- hReturn = Domain.unpack(hItem, responseObj)
125
- unless hReturn.nil?
126
- intDictionary[:domains] << hReturn
127
- end
128
- end
106
+ end
107
+ end
108
+ if intDictionary[:responsibleParty].empty?
109
+ responseObj[:readerExecutionMessages] << 'Data Dictionary responsible party is empty'
110
+ responseObj[:readerExecutionPass] = false
111
+ return nil
112
+ end
113
+
114
+ # dictionary - dictionary format
115
+ if hDictionary.has_key?('dictionaryFormat')
116
+ s = hDictionary['dictionaryFormat']
117
+ unless s == ''
118
+ intDictionary[:dictionaryFormat] = s
119
+ end
120
+ end
121
+
122
+ # dictionary - dictionary included with resource
123
+ if hDictionary.has_key?('dictionaryIncludedWithResource')
124
+ if hDictionary['dictionaryIncludedWithResource'] === true
125
+ intDictionary[:includedWithDataset] = hDictionary['dictionaryIncludedWithResource']
126
+ end
127
+ end
128
+
129
+ # dictionary - domains [] {domain}
130
+ if hDictionary.has_key?('domain')
131
+ aDomains = hDictionary['domain']
132
+ aDomains.each do |hItem|
133
+ hReturn = Domain.unpack(hItem, responseObj)
134
+ unless hReturn.nil?
135
+ intDictionary[:domains] << hReturn
129
136
  end
130
-
131
- # dictionary - entity [] {entity}
132
- if hDictionary.has_key?('entity')
133
- aEntities = hDictionary['entity']
134
- aEntities.each do |hItem|
135
- hReturn = Entity.unpack(hItem, responseObj)
136
- unless hReturn.nil?
137
- intDictionary[:entities] << hReturn
138
- end
139
- end
137
+ end
138
+ end
139
+
140
+ # dictionary - entity [] {entity}
141
+ if hDictionary.has_key?('entity')
142
+ aEntities = hDictionary['entity']
143
+ aEntities.each do |hItem|
144
+ hReturn = Entity.unpack(hItem, responseObj)
145
+ unless hReturn.nil?
146
+ intDictionary[:entities] << hReturn
140
147
  end
148
+ end
149
+ end
141
150
 
142
- return intDictionary
151
+ return intDictionary
143
152
 
144
- end
145
-
146
- end
153
+ end
147
154
 
148
155
  end
149
- end
150
- end
156
+
157
+ end
158
+ end
159
+ end
151
160
  end