adiwg-mdtranslator 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -1
- data/adiwg-mdtranslator.gemspec +2 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +66 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +7 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +21 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +70 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +132 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +65 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +116 -86
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +91 -83
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_codelists.rb +22 -12
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_contact.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_extent.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_relatedItem.rb +24 -13
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkDocument.rb +4 -5
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkGraphic.rb +3 -4
- data/lib/adiwg/mdtranslator/version.rb +2 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_boundingBox.rb +22 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicExtent.rb +8 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_boundingBox.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +2 -0
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b01bd71de44e1d9934de048dbbc7d5114008ffc4
|
4
|
+
data.tar.gz: 52e0b337ed813cea08aaea1a9937b57adbde5425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2850af4c2cd5a3f7c0e58aa6f263d012e0bd1a60d4d5ecacbbea72d676059c147698c340d0b727df7c48a4bafd9e7c27259a81e1e081c871ed55f5afc18a1d6
|
7
|
+
data.tar.gz: ecf8b2296690191018fe639eb3d5695bbf06e61072fafb4fae76a89ef6c8710c227595ccb974873a1c92d84b47694f42e38d870be753ea5facfc9d4e9bc8fc10
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,64 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v2.
|
3
|
+
## [v2.3.3](https://github.com/adiwg/mdTranslator/tree/v2.3.3) (2017-10-11)
|
4
4
|
|
5
|
+
[Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.2...v2.3.3)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- sbJSON association mapping error [\#149](https://github.com/adiwg/mdTranslator/issues/149)
|
10
|
+
- sbJson reader execution fail tests [\#146](https://github.com/adiwg/mdTranslator/issues/146)
|
11
|
+
|
12
|
+
**Closed issues:**
|
13
|
+
|
14
|
+
- fgdc ISO 19115 Topic Category [\#123](https://github.com/adiwg/mdTranslator/issues/123)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Fix issue of invalid/incomplete sbJson records terminating import [\#148](https://github.com/adiwg/mdTranslator/pull/148) ([stansmith907](https://github.com/stansmith907))
|
19
|
+
|
20
|
+
## [v2.3.2](https://github.com/adiwg/mdTranslator/tree/v2.3.2) (2017-09-15)
|
21
|
+
[Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.1...v2.3.2)
|
22
|
+
|
23
|
+
**Implemented enhancements:**
|
24
|
+
|
25
|
+
- sbJson add all contacts as citation responsible parties [\#138](https://github.com/adiwg/mdTranslator/issues/138)
|
26
|
+
- sbJSON data.gov [\#83](https://github.com/adiwg/mdTranslator/issues/83)
|
27
|
+
|
28
|
+
**Fixed bugs:**
|
29
|
+
|
30
|
+
- sbJSON itemLink associationType not translated [\#137](https://github.com/adiwg/mdTranslator/issues/137)
|
31
|
+
- Too many identifiers created when reading itemLinks from ScienceBase [\#126](https://github.com/adiwg/mdTranslator/issues/126)
|
32
|
+
- sbJSON data.gov [\#83](https://github.com/adiwg/mdTranslator/issues/83)
|
33
|
+
|
34
|
+
**Closed issues:**
|
35
|
+
|
36
|
+
- sbJson 2.0 relatedItems [\#81](https://github.com/adiwg/mdTranslator/issues/81)
|
37
|
+
|
38
|
+
**Merged pull requests:**
|
39
|
+
|
40
|
+
- Minor patches and enhancements [\#139](https://github.com/adiwg/mdTranslator/pull/139) ([stansmith907](https://github.com/stansmith907))
|
41
|
+
|
42
|
+
## [v2.3.1](https://github.com/adiwg/mdTranslator/tree/v2.3.1) (2017-09-14)
|
43
|
+
[Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.3.0...v2.3.1)
|
44
|
+
|
45
|
+
**Fixed bugs:**
|
46
|
+
|
47
|
+
- nil error in HTML writer \(allocation\) [\#135](https://github.com/adiwg/mdTranslator/issues/135)
|
48
|
+
- GeoJSON for geographicElement is parsed as a string or not at all [\#133](https://github.com/adiwg/mdTranslator/issues/133)
|
49
|
+
|
50
|
+
**Merged pull requests:**
|
51
|
+
|
52
|
+
- Minor bug fixes and patches [\#136](https://github.com/adiwg/mdTranslator/pull/136) ([stansmith907](https://github.com/stansmith907))
|
53
|
+
|
54
|
+
## [v2.3.0](https://github.com/adiwg/mdTranslator/tree/v2.3.0) (2017-09-12)
|
55
|
+
[Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.2.0...v2.3.0)
|
56
|
+
|
57
|
+
**Merged pull requests:**
|
58
|
+
|
59
|
+
- Add FGDC CSDGM 1998 reader [\#131](https://github.com/adiwg/mdTranslator/pull/131) ([stansmith907](https://github.com/stansmith907))
|
60
|
+
|
61
|
+
## [v2.2.0](https://github.com/adiwg/mdTranslator/tree/v2.2.0) (2017-08-31)
|
5
62
|
[Full Changelog](https://github.com/adiwg/mdTranslator/compare/v2.1.2...v2.2.0)
|
6
63
|
|
7
64
|
**Fixed bugs:**
|
data/adiwg-mdtranslator.gemspec
CHANGED
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
34
34
|
spec.add_runtime_dependency "uuidtools", "~> 2.1"
|
35
35
|
spec.add_runtime_dependency "json-schema", "~> 2.7"
|
36
|
-
spec.add_runtime_dependency "adiwg-mdjson_schemas", ">= 2.3"
|
37
|
-
spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.3"
|
36
|
+
spec.add_runtime_dependency "adiwg-mdjson_schemas", ">= 2.3.2"
|
37
|
+
spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.3.2"
|
38
38
|
spec.add_runtime_dependency "jbuilder", "~> 2.5"
|
39
39
|
spec.add_runtime_dependency "kramdown", "~> 1.13"
|
40
40
|
spec.add_runtime_dependency "coderay", "~> 1.1"
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
# History:
|
4
4
|
# version 2
|
5
|
+
# Stan Smith 2017-09-28 add altitude to bounding box for fgdc
|
6
|
+
# Stan Smith 2017-09-28 add description to geographicExtent for fgdc
|
5
7
|
# Stan Smith 2017-04-22 removed 'intObj = ' from new object definitions
|
6
8
|
# Stan Smith 2017-02-15 added newResourceType
|
7
9
|
# Stan Smith 2017-02-09 added newMetadataRepository
|
@@ -447,6 +449,7 @@ class InternalMetadata
|
|
447
449
|
|
448
450
|
def newGeographicExtent
|
449
451
|
{
|
452
|
+
description: nil,
|
450
453
|
containsData: true,
|
451
454
|
identifier: {},
|
452
455
|
boundingBox: {},
|
@@ -461,7 +464,10 @@ class InternalMetadata
|
|
461
464
|
westLongitude: nil,
|
462
465
|
eastLongitude: nil,
|
463
466
|
southLatitude: nil,
|
464
|
-
northLatitude: nil
|
467
|
+
northLatitude: nil,
|
468
|
+
minimumAltitude: nil,
|
469
|
+
maximumAltitude: nil,
|
470
|
+
unitsOfAltitude: nil
|
465
471
|
}
|
466
472
|
end
|
467
473
|
|
@@ -773,7 +779,56 @@ class InternalMetadata
|
|
773
779
|
def newSpatialReferenceSystem
|
774
780
|
{
|
775
781
|
systemType: nil,
|
776
|
-
systemIdentifier: {}
|
782
|
+
systemIdentifier: {},
|
783
|
+
systemParameters: {}
|
784
|
+
}
|
785
|
+
end
|
786
|
+
|
787
|
+
def newReferenceSystemParameters
|
788
|
+
{
|
789
|
+
projection: {},
|
790
|
+
ellipsoid: {},
|
791
|
+
datumIdentifier: {}
|
792
|
+
}
|
793
|
+
end
|
794
|
+
|
795
|
+
def newProjection
|
796
|
+
{
|
797
|
+
projectionIdentifier: {},
|
798
|
+
zone: nil,
|
799
|
+
standardParallel1: nil,
|
800
|
+
standardParallel2: nil,
|
801
|
+
longitudeOfCentralMeridian: nil,
|
802
|
+
latitudeOfProjectionOrigin: nil,
|
803
|
+
falseEasting: nil,
|
804
|
+
falseNorthing: nil,
|
805
|
+
falseEastingNorthingUnits: nil,
|
806
|
+
scaleFactorAtEquator: nil,
|
807
|
+
heightOfProspectivePointAboveSurface: nil,
|
808
|
+
longitudeOfProjectionCenter: nil,
|
809
|
+
latitudeOfProjectionCenter: nil,
|
810
|
+
scaleFactorAtCenterLine: nil,
|
811
|
+
straightVerticalLongitudeFromPole: nil,
|
812
|
+
scaleFactorAtProjectionOrigin: nil,
|
813
|
+
azimuthAngle: nil,
|
814
|
+
azimuthMeasurePointLongitude: nil,
|
815
|
+
obliqueLinePoint: []
|
816
|
+
}
|
817
|
+
end
|
818
|
+
|
819
|
+
def newObliqueLinePoint
|
820
|
+
{
|
821
|
+
azimuthLineLatitude: nil,
|
822
|
+
azimuthLineLongitude: nil
|
823
|
+
}
|
824
|
+
end
|
825
|
+
|
826
|
+
def newEllipsoid
|
827
|
+
{
|
828
|
+
ellipsoidIdentifier: {},
|
829
|
+
semiMajorAxis: nil,
|
830
|
+
axisUnits: nil,
|
831
|
+
denominatorOfFlatteningRatio: nil
|
777
832
|
}
|
778
833
|
end
|
779
834
|
|
@@ -781,6 +836,7 @@ class InternalMetadata
|
|
781
836
|
{
|
782
837
|
scaleFactor: nil,
|
783
838
|
measure: {},
|
839
|
+
geographicMeasure: {},
|
784
840
|
levelOfDetail: nil
|
785
841
|
}
|
786
842
|
end
|
@@ -793,6 +849,14 @@ class InternalMetadata
|
|
793
849
|
}
|
794
850
|
end
|
795
851
|
|
852
|
+
def newGeographicMeasure
|
853
|
+
{
|
854
|
+
latitudeMeasure: nil,
|
855
|
+
longitudeMeasure: nil,
|
856
|
+
unitOfMeasure: nil
|
857
|
+
}
|
858
|
+
end
|
859
|
+
|
796
860
|
def newSpatialRepresentation
|
797
861
|
{
|
798
862
|
gridRepresentation: {},
|
@@ -13,6 +13,7 @@ require_relative 'module_spatialDomain'
|
|
13
13
|
require_relative 'module_keyword'
|
14
14
|
require_relative 'module_contact'
|
15
15
|
require_relative 'module_security'
|
16
|
+
require_relative 'module_taxonomy'
|
16
17
|
|
17
18
|
module ADIWG
|
18
19
|
module Mdtranslator
|
@@ -116,6 +117,12 @@ module ADIWG
|
|
116
117
|
Keyword.unpack(xKeywords, hResourceInfo, hResponseObj)
|
117
118
|
end
|
118
119
|
|
120
|
+
# identification information bio (taxonomy) - taxonomic information
|
121
|
+
xTaxonomy = xIdInfo.xpath('./taxonomy')
|
122
|
+
unless xTaxonomy.empty?
|
123
|
+
Taxonomy.unpack(xTaxonomy, hResourceInfo, hResponseObj)
|
124
|
+
end
|
125
|
+
|
119
126
|
# identification information 1.7 (accconst) - access constraints
|
120
127
|
# identification information 1.8 (useconst) - use constraints
|
121
128
|
accessCon = xIdInfo.xpath('./accconst').text
|
@@ -72,7 +72,7 @@ module ADIWG
|
|
72
72
|
hKeyword = intMetadataClass.newKeyword
|
73
73
|
hKeyword[:keywordType] = 'place'
|
74
74
|
|
75
|
-
# theme keyword 1.6.2.1 placekt) - place keyword thesaurus {citation}
|
75
|
+
# theme keyword 1.6.2.1 (placekt) - place keyword thesaurus {citation}
|
76
76
|
thesaurus = xPlace.xpath('./placekt').text
|
77
77
|
unless thesaurus.empty?
|
78
78
|
hCitation = intMetadataClass.newCitation
|
@@ -107,7 +107,7 @@ module ADIWG
|
|
107
107
|
hKeyword = intMetadataClass.newKeyword
|
108
108
|
hKeyword[:keywordType] = 'stratum'
|
109
109
|
|
110
|
-
# theme keyword 1.6.3.1 stratkt) - stratum keyword thesaurus {citation}
|
110
|
+
# theme keyword 1.6.3.1 (stratkt) - stratum keyword thesaurus {citation}
|
111
111
|
thesaurus = xStratum.xpath('./stratkt').text
|
112
112
|
unless thesaurus.empty?
|
113
113
|
hCitation = intMetadataClass.newCitation
|
@@ -142,7 +142,7 @@ module ADIWG
|
|
142
142
|
hKeyword = intMetadataClass.newKeyword
|
143
143
|
hKeyword[:keywordType] = 'temporal'
|
144
144
|
|
145
|
-
# theme keyword 1.6.4.1 tempkt) - temporal keyword thesaurus {citation}
|
145
|
+
# theme keyword 1.6.4.1 (tempkt) - temporal keyword thesaurus {citation}
|
146
146
|
thesaurus = xTemporal.xpath('./tempkt').text
|
147
147
|
unless thesaurus.empty?
|
148
148
|
hCitation = intMetadataClass.newCitation
|
@@ -170,6 +170,39 @@ module ADIWG
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
+
# kewords bio (keywtax) - taxonomy keywords {keyword}
|
174
|
+
nodeName = xKeywords.xpath('./*').first.name
|
175
|
+
if nodeName == 'keywtax'
|
176
|
+
hKeyword = intMetadataClass.newKeyword
|
177
|
+
hKeyword[:keywordType] = 'taxon'
|
178
|
+
|
179
|
+
# theme bio.1.1 (taxonkt) - taxonomy keyword thesaurus {citation}
|
180
|
+
thesaurus = xKeywords.xpath('./taxonkt').text
|
181
|
+
unless thesaurus.empty?
|
182
|
+
hCitation = intMetadataClass.newCitation
|
183
|
+
hCitation[:title] = thesaurus
|
184
|
+
hKeyword[:thesaurus] = hCitation
|
185
|
+
end
|
186
|
+
|
187
|
+
# theme keyword bio.1.2 (taxonkey) - taxonomy keyword keywords {keywordObject}
|
188
|
+
axKeywords = xKeywords.xpath('./taxonkey')
|
189
|
+
unless axKeywords.empty?
|
190
|
+
axKeywords.each do |xKeyword|
|
191
|
+
keyword = xKeyword.text
|
192
|
+
unless keyword.empty?
|
193
|
+
hKeywordObj = intMetadataClass.newKeywordObject
|
194
|
+
hKeywordObj[:keyword] = keyword
|
195
|
+
hKeyword[:keywords] << hKeywordObj
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
unless hKeyword.empty?
|
201
|
+
aKeywords << hKeyword
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
173
206
|
return aKeywords
|
174
207
|
|
175
208
|
end
|
@@ -63,6 +63,12 @@ module ADIWG
|
|
63
63
|
hGeoExtent = intMetadataClass.newGeographicExtent
|
64
64
|
hExtent[:geographicExtents] << hGeoExtent
|
65
65
|
|
66
|
+
# spatial domain bio (descgeog) - geographic description
|
67
|
+
description = xDomain.xpath('./descgeog').text
|
68
|
+
unless description.empty?
|
69
|
+
hGeoExtent[:description] = description
|
70
|
+
end
|
71
|
+
|
66
72
|
# spatial domain 1.5.1 (bounding) - bounding box
|
67
73
|
xBbox = xDomain.xpath('./bounding')
|
68
74
|
unless xBbox.empty?
|
@@ -80,6 +86,21 @@ module ADIWG
|
|
80
86
|
# bounding box 1.5.1.4 (southbc) - south coordinate
|
81
87
|
hBbox[:southLatitude] = xBbox.xpath('./southbc').text.to_f
|
82
88
|
|
89
|
+
# bounding box bio (boundalt) - altitude
|
90
|
+
xAltitude = xBbox.xpath('./boundalt')
|
91
|
+
unless xAltitude.empty?
|
92
|
+
|
93
|
+
# bounding box bio (altmin) - minimum altitude
|
94
|
+
hBbox[:minimumAltitude] = xAltitude.xpath('./altmin').text.to_f
|
95
|
+
|
96
|
+
# bounding box bio (altmax) - maximum altitude
|
97
|
+
hBbox[:maximumAltitude] = xAltitude.xpath('./altmax').text.to_f
|
98
|
+
|
99
|
+
# bounding box bio (altunit) - altitude unit of measure
|
100
|
+
hBbox[:unitsOfAltitude] = xAltitude.xpath('./altunit').text
|
101
|
+
|
102
|
+
end
|
103
|
+
|
83
104
|
hGeoExtent[:boundingBox] = hBbox
|
84
105
|
end
|
85
106
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc taxonomy classification
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-09-21 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_taxonClass'
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module Fgdc
|
15
|
+
|
16
|
+
module TaxonClass
|
17
|
+
|
18
|
+
def self.unpack(xTaxonClass, hResponseObj)
|
19
|
+
|
20
|
+
# instance classes needed in script
|
21
|
+
intMetadataClass = InternalMetadata.new
|
22
|
+
hTaxonClass = intMetadataClass.newTaxonClass
|
23
|
+
|
24
|
+
# taxonomy bio.4.1 (taxonrn) - taxon rank name
|
25
|
+
# -> resourceInfo.taxonomy.taxonClass.taxonRank
|
26
|
+
rankName = xTaxonClass.xpath('./taxonrn').text
|
27
|
+
unless rankName.empty?
|
28
|
+
hTaxonClass[:taxonRank] = rankName
|
29
|
+
end
|
30
|
+
|
31
|
+
# taxonomy bio.4.2 (taxonrv) - taxon rank value
|
32
|
+
# -> resourceInfo.taxonomy.taxonClass.taxonValue
|
33
|
+
rankValue = xTaxonClass.xpath('./taxonrv').text
|
34
|
+
unless rankValue.empty?
|
35
|
+
hTaxonClass[:taxonValue] = rankValue
|
36
|
+
end
|
37
|
+
|
38
|
+
# taxonomy bio.4.3 (common) - taxon common name []
|
39
|
+
# -> resourceInfo.taxonomy.taxonClass.commonNames
|
40
|
+
axCommonNames = xTaxonClass.xpath('./common')
|
41
|
+
unless axCommonNames.empty?
|
42
|
+
axCommonNames.each do |xCommon|
|
43
|
+
common = xCommon.text
|
44
|
+
unless common.empty?
|
45
|
+
hTaxonClass[:commonNames] << common
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# taxonomy bio.4.4 (taxoncl) - taxonomic classification []
|
51
|
+
# -> resourceInfo.taxonomy.taxonClass.taxonClass
|
52
|
+
axSubClass = xTaxonClass.xpath('./taxoncl')
|
53
|
+
unless axSubClass.empty?
|
54
|
+
axSubClass.each do |xSubClass|
|
55
|
+
hClass = TaxonClass.unpack(xSubClass, hResponseObj)
|
56
|
+
unless hClass.nil?
|
57
|
+
hTaxonClass[:subClasses] << hClass
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
return hTaxonClass
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc taxonomy system
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-09-20 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_citation'
|
10
|
+
require_relative 'module_contact'
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module Fgdc
|
16
|
+
|
17
|
+
module TaxonSystem
|
18
|
+
|
19
|
+
def self.unpack(xSystem, hTaxonomy, hResponseObj)
|
20
|
+
|
21
|
+
# instance classes needed in script
|
22
|
+
intMetadataClass = InternalMetadata.new
|
23
|
+
|
24
|
+
# taxonomy bio.2.1 (classsys) - taxonomic classification authority []
|
25
|
+
# -> resourceInfo.taxonomy.taxonSystem
|
26
|
+
axTaxClass = xSystem.xpath('./classsys')
|
27
|
+
unless axTaxClass.empty?
|
28
|
+
axTaxClass.each do |xTaxClass|
|
29
|
+
|
30
|
+
hTaxonSystem = intMetadataClass.newTaxonSystem
|
31
|
+
|
32
|
+
# taxonomy bio.2.1.1 (classcit) - taxonomic classification citation {citation}
|
33
|
+
# -> resourceInfo.taxonomy.taxonSystem.citation
|
34
|
+
xCitation = xTaxClass.xpath('./classcit')
|
35
|
+
unless xCitation.empty?
|
36
|
+
hCitation = Citation.unpack(xCitation, hResponseObj)
|
37
|
+
unless hCitation.nil?
|
38
|
+
hTaxonSystem[:citation] = hCitation
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# taxonomy bio.2.1.2 (classmod) - taxonomic classification modifications
|
43
|
+
# -> resourceInfo.taxonomy.taxonSystem.modifications
|
44
|
+
modifications = xTaxClass.xpath('./classmod').text
|
45
|
+
unless modifications.empty?
|
46
|
+
hTaxonSystem[:modifications] = modifications
|
47
|
+
end
|
48
|
+
|
49
|
+
hTaxonomy[:taxonSystem] << hTaxonSystem
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# taxonomy bio.2.2 (idref) - taxonomic identification reference [] {citation}
|
55
|
+
# -> resourceInfo.taxonomy.idReferences.citation
|
56
|
+
axTaxRef = xSystem.xpath('./idref')
|
57
|
+
unless axTaxRef.empty?
|
58
|
+
axTaxRef.each do |xTaxRef|
|
59
|
+
hCitation = Citation.unpack(xTaxRef, hResponseObj)
|
60
|
+
unless hCitation.nil?
|
61
|
+
hTaxonomy[:idReferences] << hCitation
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# taxonomy bio.2.3 (ider) - taxonomic identifier [] {contact}
|
67
|
+
# -> resourceInfo.taxonomy.observers.responsibility
|
68
|
+
axObserver = xSystem.xpath('./ider')
|
69
|
+
unless axObserver.empty?
|
70
|
+
axObserver.each do |xObserver|
|
71
|
+
hResponsibility = Contact.unpack(xObserver, hResponseObj)
|
72
|
+
unless hResponsibility.nil?
|
73
|
+
hResponsibility[:roleName] = 'observer'
|
74
|
+
hTaxonomy[:observers] << hResponsibility
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# taxonomy bio.2.4 (taxonpro) - taxonomic procedures
|
80
|
+
# -> resourceInfo.taxonomy.idProcedure
|
81
|
+
procedures = xSystem.xpath('./taxonpro').text
|
82
|
+
unless procedures.empty?
|
83
|
+
hTaxonomy[:idProcedure] = procedures
|
84
|
+
end
|
85
|
+
|
86
|
+
# taxonomy bio.2.5 (taxoncom) - taxonomic completeness
|
87
|
+
# -> resourceInfo.taxonomy.idCompleteness
|
88
|
+
completeness = xSystem.xpath('./taxoncom').text
|
89
|
+
unless completeness.empty?
|
90
|
+
hTaxonomy[:idCompleteness] = completeness
|
91
|
+
end
|
92
|
+
|
93
|
+
# taxonomy bio.2.6 (vouchers) - vouchers []
|
94
|
+
# -> resourceInfo.taxonomy.vouchers
|
95
|
+
axVoucher = xSystem.xpath('./vouchers')
|
96
|
+
unless axVoucher.empty?
|
97
|
+
axVoucher.each do |xVoucher|
|
98
|
+
|
99
|
+
hVoucher = intMetadataClass.newTaxonVoucher
|
100
|
+
|
101
|
+
# taxonomy bio.2.6.1 (specimen) - specimen
|
102
|
+
# -> resourceInfo.taxonomy.vouchers.specimen
|
103
|
+
specimen = xVoucher.xpath('./specimen').text
|
104
|
+
unless specimen.empty?
|
105
|
+
hVoucher[:specimen] = specimen
|
106
|
+
end
|
107
|
+
|
108
|
+
# taxonomy bio.2.6.2 (reposit) - repository {contact}
|
109
|
+
# -> resourceInfo.taxonomy.vouchers.repository
|
110
|
+
xRepository = xVoucher.xpath('./reposit')
|
111
|
+
unless xRepository.empty?
|
112
|
+
hResponsibility = Contact.unpack(xRepository, hResponseObj)
|
113
|
+
unless hResponsibility.nil?
|
114
|
+
hResponsibility[:roleName] = 'curator'
|
115
|
+
hVoucher[:repository] = hResponsibility
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
hTaxonomy[:vouchers] << hVoucher
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
return hTaxonomy
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|