adiwg-mdtranslator 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/Rakefile +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +10 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +100 -86
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +3 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/readme.md +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +157 -157
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_body.rb +4 -7
- data/lib/adiwg/mdtranslator/version.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +87 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +172 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +164 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +73 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +54 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +49 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +60 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +78 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +54 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +152 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +99 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +73 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +67 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +200 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +63 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +102 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +49 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/readme.md +22 -0
- data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/html/version.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +29 -27
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/mdJson_writer.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/version.rb +3 -5
- data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +21 -9
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +21 -3
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +27 -7
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +17 -4
- data/lib/adiwg/mdtranslator/writers/sbJson/version.rb +1 -4
- data/lib/adiwg/mdtranslator.rb +5 -4
- metadata +24 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
# Writer - internal data structure to FGDC CSDGM FGDC-STD-001-1998
|
2
|
+
|
3
|
+
# History:
|
4
|
+
# Stan Smith 2017-11-16 original script
|
5
|
+
|
6
|
+
require 'builder'
|
7
|
+
require_relative 'version'
|
8
|
+
require_relative 'classes/class_fgdc'
|
9
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Writers
|
13
|
+
module Fgdc
|
14
|
+
|
15
|
+
def self.startWriter(intObj, responseObj, whichDict: 0)
|
16
|
+
|
17
|
+
# make contacts and domains available to the instance
|
18
|
+
@contacts = intObj[:contacts]
|
19
|
+
|
20
|
+
# set the format of the output file based on the writer
|
21
|
+
responseObj[:writerOutputFormat] = 'xml'
|
22
|
+
responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Fgdc::VERSION
|
23
|
+
|
24
|
+
# create new XML document
|
25
|
+
xml = Builder::XmlMarkup.new(indent: 3)
|
26
|
+
|
27
|
+
# start writing the FGDC XML record
|
28
|
+
metadataWriter = Fgdc.new(xml, responseObj)
|
29
|
+
metadata = metadataWriter.writeXML(intObj)
|
30
|
+
|
31
|
+
return metadata
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
# find contact and return the contact hash
|
36
|
+
def self.get_contact(contactId)
|
37
|
+
@contacts.each do |contact|
|
38
|
+
if contact[:contactId] == contactId
|
39
|
+
return contact
|
40
|
+
end
|
41
|
+
end
|
42
|
+
return {}
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
## sbJson
|
3
|
+
|
4
|
+
### Supported versions
|
5
|
+
|
6
|
+
> 1.x (FGDC-STD-001-1998)
|
7
|
+
|
8
|
+
### Writer for Federal Geographic Data Committee's Content Standard for Digital Geospatial Metadata (fgdc)
|
9
|
+
|
10
|
+
Content Standard for Digital Geospatial Metadata (CSDGM), Vers. 2
|
11
|
+
(FGDC-STD-001-1998) is the current version of this FGDC authored and
|
12
|
+
endorsed standard. Executive Order 12906, directed that Federal agencies
|
13
|
+
document geospatial resources using this standard. Since the publication
|
14
|
+
of EO 12906, the FGDC has endorsed several ISO Geospatial Metadata
|
15
|
+
Standards that are now encouraged for use.
|
16
|
+
|
17
|
+
The FGDC CSDGM format standard is fully documented on the
|
18
|
+
[Content Standard for Digital Geospatial Metadata page](https://www.fgdc.gov/metadata/csdgm-standard).
|
19
|
+
|
20
|
+
This FGDC writer extends the FGDC standard by added the Biological Data Profile
|
21
|
+
FGDC-STD-001.1-1999 as defined by the U.S. Geological Survey National Biological
|
22
|
+
Information Infrastructure (NBII).
|
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# html version history
|
2
|
+
# Stan Smith 2.1.0 2017-11-13 added support for spatial reference, geologic time, others
|
2
3
|
# Stan Smith 2.0.0 2017-03-21 refactored for mdTranslator 2.0
|
3
4
|
# Stan Smith 1.1.0 2015-08-28 added support for content coverage information
|
4
5
|
# Stan Smith 1.1.0 2015-07-31 added support for grid information
|
@@ -10,7 +11,7 @@ module ADIWG
|
|
10
11
|
module Html
|
11
12
|
|
12
13
|
# current version of html writer
|
13
|
-
VERSION = '2.
|
14
|
+
VERSION = '2.1.0'
|
14
15
|
|
15
16
|
end
|
16
17
|
end
|
@@ -41,7 +41,7 @@ module ADIWG
|
|
41
41
|
# document head
|
42
42
|
metadata = @xml.instruct! :xml, encoding: 'UTF-8'
|
43
43
|
@xml.comment!('ISO 19110 METADATA')
|
44
|
-
@xml.comment!('
|
44
|
+
@xml.comment!('The following metadata file was constructed using the ADIwg mdTranslator, http://mdtranslator.adiwg.org')
|
45
45
|
@xml.comment!('mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg)')
|
46
46
|
@xml.comment!('mdTranslator and other metadata tools are available at https://github.com/adiwg')
|
47
47
|
@xml.comment!('ADIwg is not responsible for the content of this metadata record')
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# Stan Smith 2014-12-01 original script
|
13
13
|
|
14
14
|
require 'builder'
|
15
|
+
require_relative 'version'
|
15
16
|
require_relative 'classes/class_fcFeatureCatalogue'
|
16
17
|
|
17
18
|
module ADIWG
|
@@ -35,7 +36,8 @@ module ADIWG
|
|
35
36
|
@domains = dictionary[:domains]
|
36
37
|
|
37
38
|
# set the format of the output file based on the writer specified
|
38
|
-
responseObj[:
|
39
|
+
responseObj[:writerOutputFormat] = 'xml'
|
40
|
+
responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Iso19110::VERSION
|
39
41
|
|
40
42
|
# create new XML document
|
41
43
|
xml = Builder::XmlMarkup.new(indent: 3)
|
@@ -90,7 +90,7 @@ module ADIWG
|
|
90
90
|
# document head
|
91
91
|
metadata = @xml.instruct! :xml, encoding: 'UTF-8'
|
92
92
|
@xml.comment!('ISO 19115-2 METADATA')
|
93
|
-
@xml.comment!('
|
93
|
+
@xml.comment!('The following metadata file was constructed using the ADIwg mdTranslator, http://mdtranslator.adiwg.org')
|
94
94
|
@xml.comment!('mdTranslator software is an open-source project of the Alaska Data Integration working group (ADIwg)')
|
95
95
|
@xml.comment!('mdTranslator and other metadata tools are available at https://github.com/adiwg')
|
96
96
|
@xml.comment!('ADIwg is not responsible for the content of this metadata record')
|
@@ -13,45 +13,47 @@
|
|
13
13
|
# Stan Smith 2013-08-10 original script
|
14
14
|
|
15
15
|
require 'builder'
|
16
|
+
require 'adiwg/mdtranslator/writers/iso19115_2/version'
|
16
17
|
require_relative 'classes/class_miMetadata'
|
17
18
|
|
18
19
|
module ADIWG
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19115_2
|
22
23
|
|
23
|
-
|
24
|
+
def self.startWriter(intObj, hResponseObj)
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
# make contact available to the instance
|
27
|
+
@contacts = intObj[:contacts]
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
# set the format of the output file based on the writer specified
|
30
|
+
hResponseObj[:writerOutputFormat] = 'xml'
|
31
|
+
hResponseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Iso19115_2::VERSION
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
+
# create new XML document
|
34
|
+
xml = Builder::XmlMarkup.new(indent: 3)
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
# start writing the ISO 19115-2 XML record
|
37
|
+
metadataWriter = MI_Metadata.new(xml, hResponseObj)
|
38
|
+
metadata = metadataWriter.writeXML(intObj)
|
37
39
|
|
38
|
-
|
40
|
+
return metadata
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
# find contact in contact array and return the contact hash
|
43
|
-
def self.getContact(contactId)
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
return contact
|
48
|
-
end
|
49
|
-
end
|
50
|
-
return {}
|
44
|
+
# find contact in contact array and return the contact hash
|
45
|
+
def self.getContact(contactId)
|
51
46
|
|
52
|
-
|
47
|
+
@contacts.each do |contact|
|
48
|
+
if contact[:contactId] == contactId
|
49
|
+
return contact
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return {}
|
53
53
|
|
54
54
|
end
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
57
59
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# iso19115-2 version history
|
2
|
+
# Stan Smith 2.1.0 2017-11-13 added support for spatial reference, geologic time, others
|
3
|
+
|
4
|
+
module ADIWG
|
5
|
+
module Mdtranslator
|
6
|
+
module Writers
|
7
|
+
module Iso19115_2
|
8
|
+
|
9
|
+
# current version of html writer
|
10
|
+
VERSION = '2.1.0'
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# Josh Bradley original script
|
6
6
|
|
7
7
|
require 'jbuilder'
|
8
|
+
require 'rubygems'
|
8
9
|
require_relative 'version'
|
9
10
|
require_relative 'sections/mdJson_mdJson'
|
10
11
|
|
@@ -21,8 +22,9 @@ module ADIWG
|
|
21
22
|
Jbuilder.ignore_nil(!responseObj[:writerShowTags])
|
22
23
|
|
23
24
|
# set the format of the output file based on the writer specified
|
24
|
-
responseObj[:
|
25
|
-
|
25
|
+
responseObj[:writerOutputFormat] = 'json'
|
26
|
+
schemaVersion = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s
|
27
|
+
responseObj[:writerVersion] = schemaVersion
|
26
28
|
|
27
29
|
# write the mdJson metadata record
|
28
30
|
metadata = MdJson.build(intObj, responseObj)
|
@@ -1,15 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# mdJson version history
|
2
|
+
# Stan Smith 2017-11-13 added support for spatial reference, geologic time, others
|
2
3
|
# Stan Smith 2017-03-10 refactored for mdJson/mdTranslator 2.0
|
3
4
|
|
4
|
-
# History version 1
|
5
|
-
# Josh Bradley
|
6
|
-
|
7
5
|
module ADIWG
|
8
6
|
module Mdtranslator
|
9
7
|
module Writers
|
10
8
|
module MdJson
|
11
9
|
|
12
|
-
VERSION = '2.
|
10
|
+
VERSION = '2.1.0'
|
13
11
|
|
14
12
|
end
|
15
13
|
end
|
@@ -20,7 +20,7 @@ module ADIWG
|
|
20
20
|
Jbuilder.ignore_nil(!responseObj[:writerShowTags])
|
21
21
|
|
22
22
|
# set the format of the output file based on the writer specified
|
23
|
-
responseObj[:
|
23
|
+
responseObj[:writerOutputFormat] = 'json'
|
24
24
|
responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::SbJson::VERSION
|
25
25
|
|
26
26
|
# write the sbJson metadata record
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# sbJson 1.0 writer budget
|
2
2
|
|
3
3
|
# History:
|
4
|
+
# Stan Smith 2017-11-30 add agreement number (allocation[:id])
|
4
5
|
# Stan Smith 2017-06-02 original script
|
5
6
|
|
6
7
|
require_relative 'sbJson_codelists'
|
@@ -17,14 +18,16 @@ module ADIWG
|
|
17
18
|
@Namespace = ADIWG::Mdtranslator::Writers::SbJson
|
18
19
|
|
19
20
|
hBudget = {}
|
20
|
-
hBudget[:
|
21
|
+
hBudget[:parts] = []
|
22
|
+
hBudget[:totalFunds] = 0.0
|
21
23
|
hBudget[:annualBudgets] = []
|
24
|
+
hBudget[:className] = 'gov.sciencebase.catalog.item.facet.BudgetFacet'
|
22
25
|
|
23
26
|
aFunding.each do |hFunding|
|
24
|
-
|
27
|
+
hAnnualBudget = {}
|
25
28
|
|
26
29
|
# funding sources
|
27
|
-
|
30
|
+
aFundingSources = []
|
28
31
|
total = 0.0
|
29
32
|
hFunding[:allocations].each do |hAllocation|
|
30
33
|
hSource = {}
|
@@ -32,6 +35,14 @@ module ADIWG
|
|
32
35
|
total += hAllocation[:amount] unless hAllocation[:amount].nil?
|
33
36
|
hSource[:matching] = hAllocation[:matching].to_s
|
34
37
|
|
38
|
+
# agreement number
|
39
|
+
unless hAllocation[:id].nil?
|
40
|
+
hAgreement = {}
|
41
|
+
hAgreement[:type] = 'Agreement Number'
|
42
|
+
hAgreement[:value] = hAllocation[:id]
|
43
|
+
hBudget[:parts] << hAgreement
|
44
|
+
end
|
45
|
+
|
35
46
|
# recipient id
|
36
47
|
unless hAllocation[:recipientId].nil?
|
37
48
|
hContact = @Namespace.get_contact_by_id(hAllocation[:recipientId])
|
@@ -48,15 +59,16 @@ module ADIWG
|
|
48
59
|
end
|
49
60
|
end
|
50
61
|
|
51
|
-
|
62
|
+
aFundingSources << hSource
|
52
63
|
end
|
53
|
-
unless
|
54
|
-
|
64
|
+
unless aFundingSources.empty?
|
65
|
+
hAnnualBudget[:fundingSources] = aFundingSources
|
55
66
|
end
|
56
67
|
|
57
68
|
# total funds
|
58
69
|
unless total == 0.0
|
59
|
-
|
70
|
+
hAnnualBudget[:totalFunds] = total
|
71
|
+
hBudget[:totalFunds] += total
|
60
72
|
end
|
61
73
|
|
62
74
|
# federal fiscal year
|
@@ -98,10 +110,10 @@ module ADIWG
|
|
98
110
|
if month > 9
|
99
111
|
year += 1
|
100
112
|
end
|
101
|
-
|
113
|
+
hAnnualBudget[:year] = year.to_s
|
102
114
|
end
|
103
115
|
|
104
|
-
hBudget[:annualBudgets] <<
|
116
|
+
hBudget[:annualBudgets] << hAnnualBudget
|
105
117
|
end
|
106
118
|
|
107
119
|
return hBudget
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# sbJson 1.0 writer
|
2
2
|
|
3
3
|
# History:
|
4
|
+
# Stan Smith 2017-11-29 remove summary (short abstract)
|
5
|
+
# Stan Smith 2017-11-29 remove duplicate identifiers
|
4
6
|
# Stan Smith 2017-11-09 add metadata identifier to output identifiers
|
5
7
|
# Stan Smith 2017-11-08 remove identifier which is the primary resource
|
6
8
|
# Stan Smith 2017-05-12 refactored for mdJson/mdTranslator 2.0
|
@@ -45,11 +47,11 @@ module ADIWG
|
|
45
47
|
json.title hCitation[:title] unless hCitation.empty?
|
46
48
|
json.alternateTitles hCitation[:alternateTitles] unless hCitation[:alternateTitles].empty?
|
47
49
|
json.body Abstract.build(resourceInfo[:abstract])
|
48
|
-
json.summary resourceInfo[:shortAbstract]
|
49
50
|
json.citation Citation.build(hCitation) unless hCitation.empty?
|
50
51
|
|
51
52
|
# gather all identifiers
|
52
|
-
# include the metadataIdentifier if it is
|
53
|
+
# include the metadataIdentifier if it is NOT in the 'gov.sciencebase.catalog' namespace
|
54
|
+
# otherwise it would be the resourceId above
|
53
55
|
aIdentifiers = []
|
54
56
|
unless metadataInfo[:metadataIdentifier].empty?
|
55
57
|
unless metadataInfo[:metadataIdentifier][:namespace] == 'gov.sciencebase.catalog'
|
@@ -64,7 +66,23 @@ module ADIWG
|
|
64
66
|
end
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
69
|
+
# eliminate duplicate identifiers
|
70
|
+
# duplicate must match on both ID and schema (namespace)
|
71
|
+
aUniqIds = []
|
72
|
+
aIdentifiers.each do |hIdentifier|
|
73
|
+
foundDup = false
|
74
|
+
aUniqIds.each do |hUniqId|
|
75
|
+
if hIdentifier[:identifier] == hUniqId[:identifier]
|
76
|
+
if hIdentifier[:namespace] == hUniqId[:namespace]
|
77
|
+
foundDup = true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
unless foundDup
|
82
|
+
aUniqIds << hIdentifier
|
83
|
+
end
|
84
|
+
end
|
85
|
+
json.identifiers @Namespace.json_map(aUniqIds, Identifier) unless aIdentifiers.empty?
|
68
86
|
|
69
87
|
json.purpose resourceInfo[:purpose]
|
70
88
|
json.rights Rights.build(resourceInfo[:constraints]) unless resourceInfo[:constraints].empty?
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# sbJson 1.0 writer tags
|
2
2
|
|
3
3
|
# History:
|
4
|
+
# Stan Smith 2017-11-29 handle keywords over 80 characters
|
4
5
|
# Stan Smith 2017-10-12 remove repository name from harvest set tag
|
5
6
|
# Stan Smith 2017-05-31 original script
|
6
7
|
|
@@ -14,6 +15,17 @@ module ADIWG
|
|
14
15
|
|
15
16
|
module Tag
|
16
17
|
|
18
|
+
def self.tag_from_keyword(theme, keyword, namespace)
|
19
|
+
hTag = {}
|
20
|
+
hTag[:type] = theme unless theme.nil?
|
21
|
+
hTag[:name] = keyword
|
22
|
+
hTag[:scheme] = namespace unless namespace.nil?
|
23
|
+
if theme == 'isoTopicCategory'
|
24
|
+
hTag[:type] = hTag[:scheme] = 'ISO 19115 Topic Categories'
|
25
|
+
end
|
26
|
+
return hTag
|
27
|
+
end
|
28
|
+
|
17
29
|
def self.build(intObj)
|
18
30
|
|
19
31
|
hResource = intObj[:metadata][:resourceInfo]
|
@@ -41,14 +53,22 @@ module ADIWG
|
|
41
53
|
end
|
42
54
|
end
|
43
55
|
hThemeSet[:keywords].each do |hKeywordObj|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
keyword = hKeywordObj[:keyword]
|
57
|
+
if keyword.length > 80
|
58
|
+
if keyword.include?('>')
|
59
|
+
aKeyList = keyword.split('>')
|
60
|
+
aKeyList.each do |part|
|
61
|
+
hTag = tag_from_keyword(theme, part, scheme)
|
62
|
+
aTags << hTag
|
63
|
+
end
|
64
|
+
else
|
65
|
+
hTag = tag_from_keyword(theme, keyword[0,76]+'...', scheme)
|
66
|
+
aTags << hTag
|
67
|
+
end
|
68
|
+
else
|
69
|
+
hTag = tag_from_keyword(theme, keyword, scheme)
|
70
|
+
aTags << hTag
|
50
71
|
end
|
51
|
-
aTags << hTag
|
52
72
|
end
|
53
73
|
end
|
54
74
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# sbJson 1.0 writer
|
2
2
|
|
3
3
|
# History:
|
4
|
+
# Stan Smith 2017-11-30 added citation and metadata online resources to webLinks
|
4
5
|
# Stan Smith 2017-05-30 original script
|
5
6
|
|
6
7
|
require 'jbuilder'
|
@@ -16,7 +17,7 @@ module ADIWG
|
|
16
17
|
|
17
18
|
@Namespace = ADIWG::Mdtranslator::Readers::SbJson
|
18
19
|
|
19
|
-
def self.
|
20
|
+
def self.build_webLink(hResource)
|
20
21
|
|
21
22
|
hWebLink = {}
|
22
23
|
|
@@ -48,11 +49,23 @@ module ADIWG
|
|
48
49
|
|
49
50
|
aLinks = []
|
50
51
|
|
52
|
+
# build webLinks from metadataLinkages
|
53
|
+
hMetadata[:metadataInfo][:metadataLinkages].each do |hResource|
|
54
|
+
hWebLink = build_webLink(hResource)
|
55
|
+
aLinks << hWebLink unless hWebLink.empty?
|
56
|
+
end
|
57
|
+
|
58
|
+
# build webLinks from resourceInfo[:citation][:onlineResources]
|
59
|
+
hMetadata[:resourceInfo][:citation][:onlineResources].each do |hResource|
|
60
|
+
hWebLink = build_webLink(hResource)
|
61
|
+
aLinks << hWebLink unless hWebLink.empty?
|
62
|
+
end
|
63
|
+
|
51
64
|
# build webLinks from additionalDocumentation
|
52
65
|
hMetadata[:additionalDocuments].each do |hDocument|
|
53
66
|
hDocument[:citation].each do |hCitation|
|
54
67
|
hCitation[:onlineResources].each do |hResource|
|
55
|
-
hWebLink =
|
68
|
+
hWebLink = build_webLink(hResource)
|
56
69
|
aLinks << hWebLink unless hWebLink.empty?
|
57
70
|
end
|
58
71
|
end
|
@@ -61,7 +74,7 @@ module ADIWG
|
|
61
74
|
# build webLinks from graphic
|
62
75
|
hMetadata[:resourceInfo][:graphicOverviews].each do |hGraphic|
|
63
76
|
hGraphic[:graphicURI].each do |hResource|
|
64
|
-
hWebLink =
|
77
|
+
hWebLink = build_webLink(hResource)
|
65
78
|
aLinks << hWebLink unless hWebLink.empty?
|
66
79
|
end
|
67
80
|
end
|
@@ -71,7 +84,7 @@ module ADIWG
|
|
71
84
|
aDistribution[:distributor].each do |aDistributor|
|
72
85
|
aDistributor[:transferOptions].each do |aOption|
|
73
86
|
aOption[:onlineOptions].each do |hResource|
|
74
|
-
hWebLink =
|
87
|
+
hWebLink = build_webLink(hResource)
|
75
88
|
aLinks << hWebLink unless hWebLink.empty?
|
76
89
|
end
|
77
90
|
end
|
data/lib/adiwg/mdtranslator.rb
CHANGED
@@ -70,10 +70,7 @@ module ADIWG
|
|
70
70
|
# writerRequested: name of the writer requested by the user
|
71
71
|
# - set from the parameter list (writer)
|
72
72
|
# ------------------------------------------------------------------------------------
|
73
|
-
# writerVersion:
|
74
|
-
# - set by the writer
|
75
|
-
# ------------------------------------------------------------------------------------
|
76
|
-
# writerFormat: format of writer output
|
73
|
+
# writerVersion: version of the writer used within mdTranslator
|
77
74
|
# - set by the writer
|
78
75
|
# ------------------------------------------------------------------------------------
|
79
76
|
# writerPass: false if the writer fails to complete creation of output file
|
@@ -82,6 +79,9 @@ module ADIWG
|
|
82
79
|
# writerMessages: an array of writer warning and error messages
|
83
80
|
# - set by the writer
|
84
81
|
# ------------------------------------------------------------------------------------
|
82
|
+
# writerOutputFormat: format of writer output
|
83
|
+
# - set by the writer
|
84
|
+
# ------------------------------------------------------------------------------------
|
85
85
|
# writerOutput: the output file returned by the writer
|
86
86
|
# - set by the writer
|
87
87
|
# ------------------------------------------------------------------------------------
|
@@ -110,6 +110,7 @@ module ADIWG
|
|
110
110
|
readerExecutionPass: true,
|
111
111
|
readerExecutionMessages: [],
|
112
112
|
writerRequested: nil,
|
113
|
+
writerVersion: nil,
|
113
114
|
writerPass: true,
|
114
115
|
writerMessages: [],
|
115
116
|
writerOutputFormat: nil,
|
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.6.
|
4
|
+
version: 2.6.1
|
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-
|
12
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -438,6 +438,26 @@ files:
|
|
438
438
|
- lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
|
439
439
|
- lib/adiwg/mdtranslator/readers/sbJson/version.rb
|
440
440
|
- lib/adiwg/mdtranslator/version.rb
|
441
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb
|
442
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb
|
443
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb
|
444
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb
|
445
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb
|
446
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb
|
447
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb
|
448
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb
|
449
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb
|
450
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb
|
451
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb
|
452
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb
|
453
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb
|
454
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb
|
455
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb
|
456
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb
|
457
|
+
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb
|
458
|
+
- lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb
|
459
|
+
- lib/adiwg/mdtranslator/writers/fgdc/readme.md
|
460
|
+
- lib/adiwg/mdtranslator/writers/fgdc/version.rb
|
441
461
|
- lib/adiwg/mdtranslator/writers/html/html_writer.rb
|
442
462
|
- lib/adiwg/mdtranslator/writers/html/readme.md
|
443
463
|
- lib/adiwg/mdtranslator/writers/html/sections/html_additionalDocumentation.rb
|
@@ -558,6 +578,7 @@ files:
|
|
558
578
|
- lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb
|
559
579
|
- lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb
|
560
580
|
- lib/adiwg/mdtranslator/writers/iso19110/readme.md
|
581
|
+
- lib/adiwg/mdtranslator/writers/iso19110/version.rb
|
561
582
|
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb
|
562
583
|
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb
|
563
584
|
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_attributeGroup.rb
|
@@ -648,6 +669,7 @@ files:
|
|
648
669
|
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb
|
649
670
|
- lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb
|
650
671
|
- lib/adiwg/mdtranslator/writers/iso19115_2/readme.md
|
672
|
+
- lib/adiwg/mdtranslator/writers/iso19115_2/version.rb
|
651
673
|
- lib/adiwg/mdtranslator/writers/mdJson/mdJson_writer.rb
|
652
674
|
- lib/adiwg/mdtranslator/writers/mdJson/readme.md
|
653
675
|
- lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_additionalDocumentation.rb
|