adiwg-mdtranslator 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +170 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb +0 -19
- data/lib/adiwg/mdtranslator/version.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73eae6092a7b290349bf705525fe361c23e79acb
|
|
4
|
+
data.tar.gz: 62aee7493beb9a7a40936c7663ca687bed57100c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 051de9ecbdfab677bdaf7b67333fd1508bf95073127acc1d61c50b9bb11328d3745166482479910f3959729381c0fb1758491db57693380779045493837fa25e
|
|
7
|
+
data.tar.gz: f8b48b38b37bdde164ca8b5b36db6d888450406e6c4565c06b89a0806be667c7d1f5d55af1d58e15b6ed477aa67c5b42bf3536dd82119523dd3235f17d604f5f
|
|
@@ -10,6 +10,7 @@ require_relative 'module_citation'
|
|
|
10
10
|
require_relative 'module_timePeriod'
|
|
11
11
|
require_relative 'module_timeInstant'
|
|
12
12
|
require_relative 'module_spatialDomain'
|
|
13
|
+
require_relative 'module_keyword'
|
|
13
14
|
|
|
14
15
|
module ADIWG
|
|
15
16
|
module Mdtranslator
|
|
@@ -125,6 +126,14 @@ module ADIWG
|
|
|
125
126
|
end
|
|
126
127
|
|
|
127
128
|
# identification information 1.6 (keywords) - keywords
|
|
129
|
+
xKeywords = xIdInfo.xpath('./keywords')
|
|
130
|
+
unless xKeywords.empty?
|
|
131
|
+
Keyword.unpack(xKeywords, hResourceInfo[:keywords], hResponseObj)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# identification information 1.7 (accconst) - access constraints
|
|
135
|
+
# identification information 1.8 (useconst) - use constraints
|
|
136
|
+
|
|
128
137
|
|
|
129
138
|
end
|
|
130
139
|
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Reader - fgdc to internal data structure
|
|
2
|
+
# unpack fgdc keyword
|
|
3
|
+
|
|
4
|
+
# History:
|
|
5
|
+
# Stan Smith 2017-08-24 original script
|
|
6
|
+
|
|
7
|
+
require 'nokogiri'
|
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
|
9
|
+
|
|
10
|
+
module ADIWG
|
|
11
|
+
module Mdtranslator
|
|
12
|
+
module Readers
|
|
13
|
+
module Fgdc
|
|
14
|
+
|
|
15
|
+
module Keyword
|
|
16
|
+
|
|
17
|
+
def self.unpack(xKeywords, aKeywords, hResponseObj)
|
|
18
|
+
|
|
19
|
+
# instance classes needed in script
|
|
20
|
+
intMetadataClass = InternalMetadata.new
|
|
21
|
+
|
|
22
|
+
# kewords 1.6.1 (theme) - thematic keywords {keyword}
|
|
23
|
+
axTheme = xKeywords.xpath('./theme')
|
|
24
|
+
unless axTheme.empty?
|
|
25
|
+
axTheme.each do |xTheme|
|
|
26
|
+
hKeyword = intMetadataClass.newKeyword
|
|
27
|
+
hKeyword[:keywordType] = 'theme'
|
|
28
|
+
|
|
29
|
+
# theme keyword 1.6.1.1 (themekt) - theme keyword thesaurus {citation}
|
|
30
|
+
thesaurus = xTheme.xpath('./themekt').text
|
|
31
|
+
unless thesaurus.empty?
|
|
32
|
+
hCitation = intMetadataClass.newCitation
|
|
33
|
+
hCitation[:title] = thesaurus
|
|
34
|
+
hKeyword[:thesaurus] = hCitation
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# theme keyword 1.6.1.2 (themekey) - theme keyword keyword {keywordObject}
|
|
38
|
+
axKeywords = xTheme.xpath('./themekey')
|
|
39
|
+
unless axKeywords.empty?
|
|
40
|
+
axKeywords.each do |xKeyword|
|
|
41
|
+
keyword = xKeyword.text
|
|
42
|
+
unless keyword.empty?
|
|
43
|
+
hKeywordObj = intMetadataClass.newKeywordObject
|
|
44
|
+
hKeywordObj[:keyword] = keyword
|
|
45
|
+
hKeyword[:keywords] << hKeywordObj
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
unless hKeyword.empty?
|
|
51
|
+
aKeywords << hKeyword
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# kewords 1.6.2 (place) - place keywords {keyword}
|
|
58
|
+
axPlace = xKeywords.xpath('./place')
|
|
59
|
+
unless axPlace.empty?
|
|
60
|
+
axPlace.each do |xPlace|
|
|
61
|
+
hKeyword = intMetadataClass.newKeyword
|
|
62
|
+
hKeyword[:keywordType] = 'place'
|
|
63
|
+
|
|
64
|
+
# theme keyword 1.6.2.1 placekt) - place keyword thesaurus {citation}
|
|
65
|
+
thesaurus = xPlace.xpath('./placekt').text
|
|
66
|
+
unless thesaurus.empty?
|
|
67
|
+
hCitation = intMetadataClass.newCitation
|
|
68
|
+
hCitation[:title] = thesaurus
|
|
69
|
+
hKeyword[:thesaurus] = hCitation
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# theme keyword 1.6.2.2 (placekey) - place keyword keyword {keywordObject}
|
|
73
|
+
axKeywords = xPlace.xpath('./placekey')
|
|
74
|
+
unless axKeywords.empty?
|
|
75
|
+
axKeywords.each do |xKeyword|
|
|
76
|
+
keyword = xKeyword.text
|
|
77
|
+
unless keyword.empty?
|
|
78
|
+
hKeywordObj = intMetadataClass.newKeywordObject
|
|
79
|
+
hKeywordObj[:keyword] = keyword
|
|
80
|
+
hKeyword[:keywords] << hKeywordObj
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
unless hKeyword.empty?
|
|
86
|
+
aKeywords << hKeyword
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# kewords 1.6.3 (stratum) - stratum keywords {keyword}
|
|
93
|
+
axStratum = xKeywords.xpath('./stratum')
|
|
94
|
+
unless axStratum.empty?
|
|
95
|
+
axStratum.each do |xStratum|
|
|
96
|
+
hKeyword = intMetadataClass.newKeyword
|
|
97
|
+
hKeyword[:keywordType] = 'stratum'
|
|
98
|
+
|
|
99
|
+
# theme keyword 1.6.3.1 stratkt) - stratum keyword thesaurus {citation}
|
|
100
|
+
thesaurus = xStratum.xpath('./stratkt').text
|
|
101
|
+
unless thesaurus.empty?
|
|
102
|
+
hCitation = intMetadataClass.newCitation
|
|
103
|
+
hCitation[:title] = thesaurus
|
|
104
|
+
hKeyword[:thesaurus] = hCitation
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# theme keyword 1.6.3.2 (stratkey) - stratum keyword keyword {keywordObject}
|
|
108
|
+
axKeywords = xStratum.xpath('./stratkey')
|
|
109
|
+
unless axKeywords.empty?
|
|
110
|
+
axKeywords.each do |xKeyword|
|
|
111
|
+
keyword = xKeyword.text
|
|
112
|
+
unless keyword.empty?
|
|
113
|
+
hKeywordObj = intMetadataClass.newKeywordObject
|
|
114
|
+
hKeywordObj[:keyword] = keyword
|
|
115
|
+
hKeyword[:keywords] << hKeywordObj
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
unless hKeyword.empty?
|
|
121
|
+
aKeywords << hKeyword
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# kewords 1.6.4 (place) - temporal keywords {keyword}
|
|
128
|
+
axTemporal = xKeywords.xpath('./temporal')
|
|
129
|
+
unless axTemporal.empty?
|
|
130
|
+
axTemporal.each do |xTemporal|
|
|
131
|
+
hKeyword = intMetadataClass.newKeyword
|
|
132
|
+
hKeyword[:keywordType] = 'temporal'
|
|
133
|
+
|
|
134
|
+
# theme keyword 1.6.4.1 tempkt) - temporal keyword thesaurus {citation}
|
|
135
|
+
thesaurus = xTemporal.xpath('./tempkt').text
|
|
136
|
+
unless thesaurus.empty?
|
|
137
|
+
hCitation = intMetadataClass.newCitation
|
|
138
|
+
hCitation[:title] = thesaurus
|
|
139
|
+
hKeyword[:thesaurus] = hCitation
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# theme keyword 1.6.4.2 (tempkey) - temporal keyword keyword {keywordObject}
|
|
143
|
+
axKeywords = xTemporal.xpath('./tempkey')
|
|
144
|
+
unless axKeywords.empty?
|
|
145
|
+
axKeywords.each do |xKeyword|
|
|
146
|
+
keyword = xKeyword.text
|
|
147
|
+
unless keyword.empty?
|
|
148
|
+
hKeywordObj = intMetadataClass.newKeywordObject
|
|
149
|
+
hKeywordObj[:keyword] = keyword
|
|
150
|
+
hKeyword[:keywords] << hKeywordObj
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
unless hKeyword.empty?
|
|
156
|
+
aKeywords << hKeyword
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
return aKeywords
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
@@ -51,8 +51,8 @@ module ADIWG
|
|
|
51
51
|
hSchema = intMetadataClass.newSchema
|
|
52
52
|
|
|
53
53
|
# schema
|
|
54
|
-
hSchema[:name] =
|
|
55
|
-
hSchema[:version] =
|
|
54
|
+
hSchema[:name] = 'sbJson'
|
|
55
|
+
hSchema[:version] = '0.0.0'
|
|
56
56
|
|
|
57
57
|
# titles / alternateTitles
|
|
58
58
|
Title.unpack(hSbJson, hCitation, hResponseObj)
|
|
@@ -32,25 +32,6 @@ module ADIWG
|
|
|
32
32
|
return {}
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# faking the version since sbJson has no version support
|
|
36
|
-
hSbJson['schema'] = {
|
|
37
|
-
'name' => 'sbJson',
|
|
38
|
-
'version' => '0.0.0'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
# schema - current version
|
|
42
|
-
currentVersion = ADIWG::Mdtranslator::Readers::SbJson::VERSION
|
|
43
|
-
hResponseObj[:readerVersionRequested] = hSbJson['schema']['version']
|
|
44
|
-
hResponseObj[:readerVersionUsed] = currentVersion
|
|
45
|
-
unless currentVersion == hSbJson['schema']['version']
|
|
46
|
-
hResponseObj[:readerStructureMessages] << "sbJson schema version '#{hSbJson['version']}' is not supported"
|
|
47
|
-
hResponseObj[:readerStructurePass] = false
|
|
48
|
-
return {}
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# faking the validation since there is no schema definition
|
|
52
|
-
# @hResponseObj[:readerValidationPass] default is true
|
|
53
|
-
|
|
54
35
|
# load sbJson file into internal object
|
|
55
36
|
return SbJson.unpack(hSbJson, hResponseObj)
|
|
56
37
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# adiwg mdTranslator
|
|
2
2
|
|
|
3
3
|
# version 2 history
|
|
4
|
+
# 2.1.2 2017-08-24 remove schema version from sbJson
|
|
4
5
|
# 2.1.0 2017-08-10 revisions to sbJson reader
|
|
5
6
|
# 2.0.0 2017-06-28 added sbJson reader
|
|
6
7
|
# 2.0.0rc13 2017-06-16 apply changes to sbJson writer after fourth review session
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
module ADIWG
|
|
23
24
|
module Mdtranslator
|
|
24
25
|
# current mdtranslator version
|
|
25
|
-
VERSION = "2.1.
|
|
26
|
+
VERSION = "2.1.2"
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: adiwg-mdtranslator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stan Smith
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-08-
|
|
12
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -243,6 +243,7 @@ files:
|
|
|
243
243
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb
|
|
244
244
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb
|
|
245
245
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb
|
|
246
|
+
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb
|
|
246
247
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb
|
|
247
248
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineResource.rb
|
|
248
249
|
- lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb
|
|
@@ -693,7 +694,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
693
694
|
version: '0'
|
|
694
695
|
requirements: []
|
|
695
696
|
rubyforge_project:
|
|
696
|
-
rubygems_version: 2.
|
|
697
|
+
rubygems_version: 2.5.2
|
|
697
698
|
signing_key:
|
|
698
699
|
specification_version: 4
|
|
699
700
|
summary: The mdtranslator (metadata translator) is a tool for translating metadata
|