adiwg-mdtranslator 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +33 -2
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +68 -35
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +66 -0
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +7 -1
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +10 -1
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +38 -19
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +68 -19
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +3 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -2
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +87 -79
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +150 -115
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +184 -113
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +56 -0
  16. data/lib/adiwg/mdtranslator/version.rb +7 -1
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +3 -3
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +6 -6
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +74 -38
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +68 -0
  21. data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +130 -76
  22. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +78 -0
  23. data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +37 -0
  25. data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +229 -0
  26. data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +65 -0
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +19 -1
  28. data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +69 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_address.rb +103 -103
  30. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +185 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +60 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionReference.rb +45 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +107 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +187 -187
  35. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +123 -117
  36. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +155 -141
  37. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_gcoDateTime.rb +48 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +54 -55
  39. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +56 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_series.rb +63 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_attributeGroup.rb +51 -50
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +181 -180
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +96 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_ellipsoidParameters.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +54 -54
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +301 -298
  47. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +53 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +229 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +49 -32
  50. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_domain.rb +5 -2
  51. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entity.rb +7 -1
  52. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +18 -2
  53. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_valueRange.rb +28 -0
  54. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +33 -13
  55. metadata +22 -4
  56. data/lib/adiwg/mdtranslator/readers/mdJson/version.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20d12fe84ddfccbe18ea8ee3a2d4c28aedc471fd
4
- data.tar.gz: 47d8c57d4668555bcf4b15ca67099675a9a8e9f4
3
+ metadata.gz: 8f08c8cabea92742e77f01c30ae68550da7a583d
4
+ data.tar.gz: 8963e33ca95184476f15d4c8e94834b3466c9c08
5
5
  SHA512:
6
- metadata.gz: a3b11672f637c332273913e9d88005b88427c98cec0dc5d96275ec6f6823f5ceaffd0a1940988a14829ccec53476d19d6936fe68f65fde25af8dbc8e2a9d127f
7
- data.tar.gz: d00a5b73bd938e76f396e996eca3ddf0a555b3cdb806950f50d8d29e127ce292a40dcb646721643cb1b64019f65603d00724a337780575a5e666c16de6ea0fd4
6
+ metadata.gz: '09dd47945d0989ceaa90dbc46a435af71f4d1f36ce8d54f5e81d02ed57d64ee8a9c75af7dcbded016f9b47fd72b2bf7181c7479a3f06905911051f5b047c866f'
7
+ data.tar.gz: 85cba08c6d6dadae7eb549cca69a08d3a2323924ebae6ce4b8faca4483f182484c25b4f5301f855bb21694b5de2868610435c3e4bfad4a9fae7af5ef018eebe3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,57 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.3.3](https://github.com/adiwg/mdTranslator/tree/v2.3.3) (2017-10-11)
3
+ ## [v2.5.0](https://github.com/adiwg/mdTranslator/tree/v2.5.0) (2017-11-06)
4
+
5
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.4.0...v2.5.0)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Tests failing with seed 30538 [\#157](https://github.com/adiwg/mdTranslator/issues/157)
10
+ - sbJSON writer should only write parentId with proper namespace [\#154](https://github.com/adiwg/mdTranslator/issues/154)
11
+
12
+ **Closed issues:**
13
+
14
+ - fgdc spatial reference - resolution [\#147](https://github.com/adiwg/mdTranslator/issues/147)
15
+ - fgdc bio ASCII file format [\#143](https://github.com/adiwg/mdTranslator/issues/143)
16
+ - fgdc bio bounding box altitude [\#140](https://github.com/adiwg/mdTranslator/issues/140)
17
+ - fgdc entity-attribute multiple domain definitions [\#130](https://github.com/adiwg/mdTranslator/issues/130)
18
+ - fgdc entity-attribute information not supported by mdJson/mdTranslator [\#129](https://github.com/adiwg/mdTranslator/issues/129)
19
+ - fgdc spatial reference information [\#127](https://github.com/adiwg/mdTranslator/issues/127)
20
+ - fgdc lineage source datasets [\#122](https://github.com/adiwg/mdTranslator/issues/122)
21
+ - fgdc bio Spatial Domain geographic description [\#115](https://github.com/adiwg/mdTranslator/issues/115)
22
+
23
+ **Merged pull requests:**
24
+
25
+ - Add test to verify mdJson reader version is compatible with schema version [\#159](https://github.com/adiwg/mdTranslator/pull/159) ([stansmith907](https://github.com/stansmith907))
26
+ - Fix computation of federal fiscal year in sbJson budget writer [\#156](https://github.com/adiwg/mdTranslator/pull/156) ([stansmith907](https://github.com/stansmith907))
27
+
28
+ ## [v2.4.0](https://github.com/adiwg/mdTranslator/tree/v2.4.0) (2017-10-25)
29
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.5...v2.4.0)
30
+
31
+ **Fixed bugs:**
4
32
 
33
+ - Error in html writer when topologyLevel is null [\#152](https://github.com/adiwg/mdTranslator/issues/152)
34
+ - Harvest Set tag for sbJSON should include the title only [\#150](https://github.com/adiwg/mdTranslator/issues/150)
35
+
36
+ **Merged pull requests:**
37
+
38
+ - Fix bug that returns first identifier as parentId when no SB namespace is found [\#155](https://github.com/adiwg/mdTranslator/pull/155) ([stansmith907](https://github.com/stansmith907))
39
+
40
+ ## [v2.3.5](https://github.com/adiwg/mdTranslator/tree/v2.3.5) (2017-10-18)
41
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.4...v2.3.5)
42
+
43
+ **Merged pull requests:**
44
+
45
+ - Trap missing topology level in html writer vectorRepresentation modul… [\#153](https://github.com/adiwg/mdTranslator/pull/153) ([stansmith907](https://github.com/stansmith907))
46
+
47
+ ## [v2.3.4](https://github.com/adiwg/mdTranslator/tree/v2.3.4) (2017-10-13)
48
+ [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.3...v2.3.4)
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Remove repository name from harvest set tag in sbJson writer. [\#151](https://github.com/adiwg/mdTranslator/pull/151) ([stansmith907](https://github.com/stansmith907))
53
+
54
+ ## [v2.3.3](https://github.com/adiwg/mdTranslator/tree/v2.3.3) (2017-10-11)
5
55
  [Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.2...v2.3.3)
6
56
 
7
57
  **Fixed bugs:**
@@ -546,11 +546,23 @@ class InternalMetadata
546
546
  periodNames: [],
547
547
  startDateTime: {},
548
548
  endDateTime: {},
549
+ startGeologicAge: {},
550
+ endGeologicAge: {},
549
551
  timeInterval: {},
550
552
  duration: {}
551
553
  }
552
554
  end
553
555
 
556
+ def newGeologicAge
557
+ {
558
+ ageTimeScale: nil,
559
+ ageEstimate: nil,
560
+ ageUncertainty: nil,
561
+ ageExplanation: nil,
562
+ ageReference: []
563
+ }
564
+ end
565
+
554
566
  def newDuration
555
567
  {
556
568
  years: nil,
@@ -718,6 +730,7 @@ class InternalMetadata
718
730
  domainName: nil,
719
731
  domainCode: nil,
720
732
  domainDescription: nil,
733
+ domainReference: {},
721
734
  domainItems: []
722
735
  }
723
736
  end
@@ -737,10 +750,14 @@ class InternalMetadata
737
750
  entityCode: nil,
738
751
  entityAlias: [],
739
752
  entityDefinition: nil,
753
+ entityReferences: [],
740
754
  primaryKey: [],
741
755
  indexes: [],
742
756
  attributes: [],
743
- foreignKeys: []
757
+ foreignKeys: [],
758
+ fieldSeparatorCharacter: nil,
759
+ numberOfHeaderLines: nil,
760
+ quoteCharacter: nil
744
761
  }
745
762
  end
746
763
 
@@ -758,13 +775,27 @@ class InternalMetadata
758
775
  attributeCode: nil,
759
776
  attributeAlias: [],
760
777
  attributeDefinition: nil,
778
+ attributeReference: {},
761
779
  dataType: nil,
762
780
  allowNull: false,
763
781
  allowMany: false,
764
782
  unitOfMeasure: nil,
783
+ measureResolution: nil,
784
+ isCaseSensitive: false,
785
+ fieldWidth: nil,
786
+ missingValue: nil,
765
787
  domainId: nil,
766
788
  minValue: nil,
767
- maxValue: nil
789
+ maxValue: nil,
790
+ rangeOfValues: [],
791
+ timePeriodOfValues: []
792
+ }
793
+ end
794
+
795
+ def newValueRange
796
+ {
797
+ minRangeValue: nil,
798
+ maxRangeValue: nil
768
799
  }
769
800
  end
770
801
 
@@ -2,13 +2,15 @@
2
2
  # unpack fgdc entity attribute
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-10-30 added timePeriodOfValues
5
6
  # Stan Smith 2017-09-06 original script
6
7
 
7
- require 'uuidtools'
8
8
  require 'nokogiri'
9
9
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
10
10
  require_relative 'module_enumerated'
11
11
  require_relative 'module_range'
12
+ require_relative 'module_codeSet'
13
+ require_relative 'module_dateTime'
12
14
 
13
15
  module ADIWG
14
16
  module Mdtranslator
@@ -39,56 +41,84 @@ module ADIWG
39
41
  end
40
42
 
41
43
  # entity attribute 5.1.2.3 (attrdefs) - attribute definition source
42
- # -> not mapped
44
+ # -> dataDictionary.entities.attributes.attributeReference.title
45
+ reference = xAttribute.xpath('./attrdefs').text
46
+ unless reference.empty?
47
+ hCitation = intMetadataClass.newCitation
48
+ hCitation[:title] = reference
49
+ hAttribute[:attributeReference] = hCitation
50
+ end
43
51
 
44
52
  # entity attribute 5.1.2.4 (attrdomv) - attribute domain value
45
53
  axDomain = xAttribute.xpath('./attrdomv')
46
54
  unless axDomain.empty?
47
- hDomain = intMetadataClass.newDictionaryDomain
48
- hDomain[:domainId] = UUIDTools::UUID.random_create.to_s
49
- hDomain[:domainCode] = code
50
- hDomain[:domainDescription] = 'FGDC enumerated domain'
51
-
52
- axDomain.each do |xDomain|
53
-
54
- # entity attribute 5.1.2.4.1 (edom) - enumerated domain
55
- xEnumeration = xDomain.xpath('./edom')
56
- unless xEnumeration.empty?
57
- hItem = Enumerated.unpack(xEnumeration, hResponseObj)
58
- hDomain[:domainItems] << hItem
59
- end
60
55
 
61
- # entity attribute 5.1.2.4.2 (rdom) - range domain
62
- xRange = xDomain.xpath('./rdom')
63
- unless xRange.empty?
64
- Range.unpack(xRange, hAttribute, hResponseObj)
56
+ # entity attribute 5.1.2.4.1 (edom) - enumerated domain
57
+ unless axDomain.empty?
58
+ hDomain = Enumerated.unpack(axDomain, code, hResponseObj)
59
+ unless hDomain.nil?
60
+ hDictionary[:domains] << hDomain
65
61
  end
62
+ end
66
63
 
67
- # entity attribute 5.1.2.4.3 (codesetd) - codeset domain
68
-
69
- # entity attribute 5.1.2.4.3.1 (codesetn) - codeset name
70
- # -> not mapped
71
-
72
- # entity attribute 5.1.2.4.3.2 (codesets) - codeset source
73
- # -> not mapped
74
-
75
- # entity attribute 5.1.2.4.4 (udom) - unrepresentable domain
76
- # -> not mapped
64
+ # entity attribute 5.1.2.4.2 (rdom) - range domain
65
+ unless axDomain.empty?
66
+ Range.unpack(axDomain, hAttribute, hResponseObj)
67
+ end
77
68
 
69
+ # entity attribute 5.1.2.4.3 (codesetd) - codeset domain
70
+ unless axDomain.empty?
71
+ aDomains = CodeSet.unpack(axDomain, code, hResponseObj)
72
+ hDictionary[:domains].concat aDomains
78
73
  end
79
74
 
80
- unless hDomain[:domainItems].empty?
81
- hAttribute[:domainId] = hDomain[:domainId]
82
- hDictionary[:domains] << hDomain
75
+ # entity attribute 5.1.2.4.4 (udom) - unrepresentable domain
76
+ # -> dataDictionary.domains.domainDescription
77
+ axUnRep = axDomain.xpath('./udom')
78
+ axUnRep.each do |xUnRep|
79
+ unRep = xUnRep.text
80
+ unless unRep.empty?
81
+ hDomain = intMetadataClass.newDictionaryDomain
82
+ hDomain[:domainId] = UUIDTools::UUID.random_create.to_s
83
+ hDomain[:domainName] = code
84
+ hDomain[:domainCode] = code
85
+ hDomain[:domainDescription] = unRep
86
+ hDictionary[:domains] << hDomain
87
+ end
83
88
  end
84
89
 
85
90
  end
86
91
 
87
- # entity attribute 5.1.2.5 (begdatea) - beginning date of attribute values
88
- # -> not mapped
92
+ # add domainId to attribute
93
+ # fgdc allows multiple domain definitions
94
+ # mdJson allows only one domain definition for an attribute
95
+ # take the first, if this is a problem the user will need to fix in the editor
96
+ unless hDictionary[:domains].empty?
97
+ hAttribute[:domainId] = hDictionary[:domains][0][:domainId]
98
+ end
89
99
 
100
+ axBegin = xAttribute.xpath('./begdatea')
101
+ # entity attribute 5.1.2.5 (begdatea) - beginning date of attribute values
90
102
  # entity attribute 5.1.2.6 (enddatea) - ending date of attribute values
91
- # -> not mapped
103
+ # -> dataDictionary.entities.attributes.timePeriodOfValues.startDateTime
104
+ # -> dataDictionary.entities.attributes.timePeriodOfValues.endDateTime
105
+ axBegin.each_with_index do |xBegin, index|
106
+ beginDate = xBegin.text
107
+ unless beginDate.empty?
108
+ hTimePeriod = intMetadataClass.newTimePeriod
109
+ hDateTime = DateTime.unpack(beginDate, nil, hResponseObj)
110
+ unless hDateTime.nil?
111
+ hTimePeriod[:startDateTime] = hDateTime
112
+ end
113
+ endDate = xAttribute.xpath("./enddatea[#{index+1}]").text
114
+ hDateTime = DateTime.unpack(endDate, nil, hResponseObj)
115
+ unless hDateTime.nil?
116
+ hTimePeriod[:endDateTime] = hDateTime
117
+ end
118
+ hTimePeriod[:description] = 'attribute date range'
119
+ hAttribute[:timePeriodOfValues] << hTimePeriod
120
+ end
121
+ end
92
122
 
93
123
  # entity attribute 5.1.2.7 (attrvai) - attribute value accuracy information
94
124
 
@@ -98,6 +128,9 @@ module ADIWG
98
128
  # entity attribute 5.1.2.7.2 (attrvae) - attribute value accuracy explanation
99
129
  # -> not mapped
100
130
 
131
+ # entity attribute 5.1.2.8 (attrmfrq) - attribute measurement frequency
132
+ # -> not mapped; same as resource maintenance but at attribute level
133
+
101
134
  hAttribute
102
135
 
103
136
  end
@@ -0,0 +1,66 @@
1
+ # Reader - fgdc to internal data structure
2
+ # unpack fgdc entity codeSet domain
3
+
4
+ # History:
5
+ # Stan Smith 2017-10-31 original script
6
+
7
+ require 'uuidtools'
8
+ require 'nokogiri'
9
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Readers
14
+ module Fgdc
15
+
16
+ module CodeSet
17
+
18
+ def self.unpack(axDomains, code, hResponseObj)
19
+
20
+ # instance classes needed in script
21
+ intMetadataClass = InternalMetadata.new
22
+
23
+ aDomains = []
24
+
25
+ axCodeSets = axDomains.xpath('./codesetd')
26
+ unless axCodeSets.empty?
27
+ axCodeSets.each do |xCodeSet|
28
+
29
+ hDomain = intMetadataClass.newDictionaryDomain
30
+ hDomain[:domainId] = UUIDTools::UUID.random_create.to_s
31
+ hDomain[:domainCode] = code
32
+ hDomain[:domainDescription] = 'FGDC codeSet domain'
33
+
34
+
35
+ # entity attribute 5.1.2.4.3.1 (codesetn) - codeset name
36
+ # -> dataDictionary.domains.commonName
37
+ name = xCodeSet.xpath('./codesetn').text
38
+ unless name.empty?
39
+ hDomain[:domainName] = name
40
+ end
41
+
42
+ # entity attribute 5.1.2.4.3.2 (codesets) - codeset source {citation}
43
+ # -> dataDictionary.domains.domainReference.title
44
+ hCitation = intMetadataClass.newCitation
45
+ title = xCodeSet.xpath('./codesets').text
46
+ unless title.empty?
47
+ hCitation[:title] = title
48
+ hDomain[:domainReference] = hCitation
49
+ end
50
+
51
+ aDomains << hDomain
52
+
53
+ end
54
+
55
+ end
56
+
57
+ return aDomains
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
@@ -47,7 +47,13 @@ module ADIWG
47
47
  end
48
48
 
49
49
  # entity attribute 5.1.1.3 (enttypds) - entity definition source
50
- # -> not mapped
50
+ # -> dataDictionary.entities.entityReference.title
51
+ reference = xEntity.xpath('./enttypds').text
52
+ unless reference.empty?
53
+ hCitation = intMetadataClass.newCitation
54
+ hCitation[:title] = reference
55
+ hEntity[:entityReferences] << hCitation
56
+ end
51
57
 
52
58
  # entity attribute 5.1.2 (attr) - characteristics of an attribute
53
59
  axAttribute = xDetail.xpath('./attr')
@@ -31,7 +31,16 @@ module ADIWG
31
31
  end
32
32
 
33
33
  # entity attribute 5.2.2 (eadetcit) - entity attribute detail citation []
34
- # -> not mapped
34
+ # -> dataDictionary.entities.entityReference.title
35
+ axReference = xOverview.xpath('./eadetcit')
36
+ axReference.each do |xReference|
37
+ reference = xReference.text
38
+ unless reference.empty?
39
+ hCitation = intMetadataClass.newCitation
40
+ hCitation[:title] = reference
41
+ hEntity[:entityReferences] << hCitation
42
+ end
43
+ end
35
44
 
36
45
  return hEntity
37
46
 
@@ -4,6 +4,7 @@
4
4
  # History:
5
5
  # Stan Smith 2017-09-06 original script
6
6
 
7
+ require 'uuidtools'
7
8
  require 'nokogiri'
8
9
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
10
 
@@ -14,31 +15,49 @@ module ADIWG
14
15
 
15
16
  module Enumerated
16
17
 
17
- def self.unpack(xEnumeration, hResponseObj)
18
+ def self.unpack(axDomains, code, hResponseObj)
18
19
 
19
20
  # instance classes needed in script
20
21
  intMetadataClass = InternalMetadata.new
21
- hItem = intMetadataClass.newDomainItem
22
-
23
- # entity attribute 5.1.2.4.1.1 (edomv) - enumerated domain value
24
- # -> dataDictionary.domainItems.itemValue
25
- value = xEnumeration.xpath('./edomv').text
26
- unless value.empty?
27
- hItem[:itemName] = value
28
- hItem[:itemValue] = value
29
- end
30
22
 
31
- # entity attribute 5.1.2.4.1.2 (edomvd) - enumerated domain value definition
32
- # -> dataDictionary.domainItems.itemDefinition
33
- definition = xEnumeration.xpath('./edomvd').text
34
- unless definition.empty?
35
- hItem[:itemDefinition] = definition
36
- end
23
+ hDomain = intMetadataClass.newDictionaryDomain
24
+ hDomain[:domainId] = UUIDTools::UUID.random_create.to_s
25
+ hDomain[:domainName] = code
26
+ hDomain[:domainCode] = code
27
+ hDomain[:domainDescription] = 'FGDC enumerated domain'
28
+
29
+ axValues = axDomains.xpath('./edom')
30
+ unless axValues.empty?
31
+ axValues.each do |xValue|
32
+ hItem = intMetadataClass.newDomainItem
33
+
34
+ # entity attribute 5.1.2.4.1.1 (edomv) - enumerated domain value
35
+ # -> dataDictionary.domainItems.itemValue
36
+ value = xValue.xpath('./edomv').text
37
+ unless value.empty?
38
+ hItem[:itemName] = value
39
+ hItem[:itemValue] = value
40
+ end
41
+
42
+ # entity attribute 5.1.2.4.1.2 (edomvd) - enumerated domain value definition
43
+ # -> dataDictionary.domainItems.itemDefinition
44
+ definition = xValue.xpath('./edomvd').text
45
+ unless definition.empty?
46
+ hItem[:itemDefinition] = definition
47
+ end
37
48
 
38
- # entity attribute 5.1.2.4.1.3 (edomvds) - enumerated domain value definition source
39
- # -> not mapped
49
+ # entity attribute 5.1.2.4.1.3 (edomvds) - enumerated domain value definition source
50
+ # -> not mapped
51
+
52
+ hDomain[:domainItems] << hItem
53
+
54
+ end
55
+
56
+ return hDomain
57
+
58
+ end
40
59
 
41
- return hItem
60
+ return nil
42
61
 
43
62
  end
44
63