adiwg-mdtranslator 2.0.0rc9 → 2.0.0rc10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad510fae06cdf03810393ba683686f22f9fe569e
4
- data.tar.gz: 24acaf6b181b68e723835ab70648b76481abfac3
3
+ metadata.gz: '0934464b5cb7ffa7244aa794417a3bb7ff01c082'
4
+ data.tar.gz: dd47220a7cb46d796d611ea7adc23e9ecb77b976
5
5
  SHA512:
6
- metadata.gz: 9476a3bc114e8c5d5f98fa695f629b857b6a530ecceaa254b60cc9dfb33c1a9628de3c73ed47ea6d233746caa9575cb6c0e1df4c969bda4ab41b7068c7d97029
7
- data.tar.gz: 9f5c4dac97608fc35749ee8e5f407c26deb48c00c7d5dcf885c14b1fb8dd7b81cafe895ec20fc52364a0c9c8640a0598e97b0c1ec44c0b3ff38d6f855cb57d63
6
+ metadata.gz: 4b6e2d96171f64e284fb9810bf8e030eafb2c41dc424b743b3aebc22f25cbefb7d5a6d87be8923cdbdf15a8162bdf2af78aaa887af93ce4a6ad3b1457e395802
7
+ data.tar.gz: de8f49629d78349c068eb6ad4744d3c008ba94600e7d8d953f21dbdd8bf63d865aaf6dcefded23de666a5da9e9d155e57fe2f23863221eea2019e381e8f470d1
@@ -33,7 +33,7 @@ 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.1.2"
36
+ spec.add_runtime_dependency "adiwg-mdjson_schemas", ">= 2.2"
37
37
  spec.add_runtime_dependency "adiwg-mdcodes", "~> 2.1"
38
38
  spec.add_runtime_dependency "jbuilder", "~> 2.5"
39
39
 
@@ -972,6 +972,7 @@ class InternalMetadata
972
972
  def newMetadataRepository
973
973
  {
974
974
  repository: nil,
975
+ citation: {},
975
976
  metadataStandard: nil
976
977
  }
977
978
  end
@@ -2,52 +2,65 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-06-06 add citation to repository
5
6
  # Stan Smith 2017-02-09 original script
6
7
 
8
+ require_relative 'module_citation'
9
+
7
10
  module ADIWG
8
- module Mdtranslator
9
- module Readers
10
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
11
14
 
12
- module MetadataRepository
15
+ module MetadataRepository
13
16
 
14
- def self.unpack(hMdDist, responseObj)
17
+ def self.unpack(hMdDist, responseObj)
15
18
 
16
- # return nil object if input is empty
17
- if hMdDist.empty?
18
- responseObj[:readerExecutionMessages] << 'Metadata Repository object is empty'
19
- responseObj[:readerExecutionPass] = false
20
- return nil
21
- end
19
+ # return nil object if input is empty
20
+ if hMdDist.empty?
21
+ responseObj[:readerExecutionMessages] << 'Metadata Repository object is empty'
22
+ responseObj[:readerExecutionPass] = false
23
+ return nil
24
+ end
22
25
 
23
- # instance classes needed in script
24
- intMetadataClass = InternalMetadata.new
25
- intMdDist = intMetadataClass.newMetadataRepository
26
+ # instance classes needed in script
27
+ intMetadataClass = InternalMetadata.new
28
+ intMdDist = intMetadataClass.newMetadataRepository
26
29
 
27
- # metadata distribution - repository (required)
28
- if hMdDist.has_key?('repository')
29
- intMdDist[:repository] = hMdDist['repository']
30
- end
31
- if intMdDist[:repository].nil? || intMdDist[:repository] == ''
32
- responseObj[:readerExecutionMessages] << 'Metadata Repository repository is missing'
33
- responseObj[:readerExecutionPass] = false
34
- return nil
35
- end
30
+ # metadata distribution - repository (required)
31
+ if hMdDist.has_key?('repository')
32
+ intMdDist[:repository] = hMdDist['repository']
33
+ end
34
+ if intMdDist[:repository].nil? || intMdDist[:repository] == ''
35
+ responseObj[:readerExecutionMessages] << 'Metadata Repository repository is missing'
36
+ responseObj[:readerExecutionPass] = false
37
+ return nil
38
+ end
36
39
 
37
- # metadata distribution - metadata format
38
- if hMdDist.has_key?('metadataStandard')
39
- if hMdDist['metadataStandard'] != ''
40
- intMdDist[:metadataStandard] = hMdDist['metadataStandard']
41
- end
40
+ # metadata distribution - citation
41
+ if hMdDist.has_key?('citation')
42
+ unless hMdDist['citation'].empty?
43
+ hReturn = Citation.unpack(hMdDist['citation'], responseObj)
44
+ unless hReturn.nil?
45
+ intMdDist[:citation] = hReturn
42
46
  end
47
+ end
48
+ end
43
49
 
44
- return intMdDist
50
+ # metadata distribution - metadata format
51
+ if hMdDist.has_key?('metadataStandard')
52
+ if hMdDist['metadataStandard'] != ''
53
+ intMdDist[:metadataStandard] = hMdDist['metadataStandard']
54
+ end
55
+ end
45
56
 
46
- end
57
+ return intMdDist
47
58
 
48
- end
59
+ end
49
60
 
50
61
  end
51
- end
52
- end
62
+
63
+ end
64
+ end
65
+ end
53
66
  end
@@ -16,7 +16,7 @@
16
16
  module ADIWG
17
17
  module Mdtranslator
18
18
  # current mdtranslator version
19
- VERSION = "2.0.0rc9"
19
+ VERSION = "2.0.0rc10"
20
20
  end
21
21
  end
22
22
 
@@ -2,8 +2,11 @@
2
2
  # metadata repository
3
3
 
4
4
  # History:
5
+ # Stan Smith 2017-06-06 added metadata repository citation
5
6
  # Stan Smith 2017-04-05 original script
6
7
 
8
+ require_relative 'html_citation'
9
+
7
10
  module ADIWG
8
11
  module Mdtranslator
9
12
  module Writers
@@ -17,6 +20,9 @@ module ADIWG
17
20
 
18
21
  def writeHtml(hRepository)
19
22
 
23
+ # classes used
24
+ citationClass = Html_Citation.new(@html)
25
+
20
26
  # metadata repository - repository
21
27
  unless hRepository[:repository].nil?
22
28
  @html.em('Repository Name: ')
@@ -31,6 +37,16 @@ module ADIWG
31
37
  @html.br
32
38
  end
33
39
 
40
+ # metadata repository - citation
41
+ unless hRepository[:citation].empty?
42
+ @html.details do
43
+ @html.summary('Citation', {'class' => 'h5'})
44
+ @html.section(:class => 'block') do
45
+ citationClass.writeHtml(hRepository[:citation])
46
+ end
47
+ end
48
+ end
49
+
34
50
  end # writeHtml
35
51
  end # Html_Repository
36
52
 
@@ -17,16 +17,15 @@ module ADIWG
17
17
 
18
18
  aCategories = []
19
19
 
20
+ # always include a 'Data' browse category
21
+ aCategories << 'Data'
22
+
20
23
  aTypes.each do |hType|
21
24
  type = hType[:type]
22
25
  sbType = Codelists.codelist_iso_to_sb('iso_sb_scope', :isoCode => type)
23
26
  aCategories << sbType unless sbType.nil?
24
27
  end
25
28
 
26
- if aCategories.empty?
27
- return nil
28
- end
29
-
30
29
  aCategories = aCategories.uniq
31
30
 
32
31
  end
@@ -0,0 +1,33 @@
1
+ # sbJson 1.0 writer geographic extent
2
+
3
+ # History:
4
+ # Stan Smith 2017-06-06 original script
5
+
6
+ module ADIWG
7
+ module Mdtranslator
8
+ module Writers
9
+ module SbJson
10
+
11
+ module GeographicExtent
12
+
13
+ def self.build(aExtents)
14
+
15
+ aGeoExtents = []
16
+
17
+ # gather geographicExtents geoJson blocks
18
+ aExtents.each do |hExtent|
19
+ hExtent[:geographicExtents].each do |hGeoExtent|
20
+ aGeoExtents << hGeoExtent[:nativeGeoJson]
21
+ end
22
+ end
23
+
24
+ aGeoExtents
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,4 +1,4 @@
1
- # sbJson 1.0 writer
1
+ # sbJson 1.0 writer hours
2
2
 
3
3
  # History:
4
4
  # Stan Smith 2017-05-26 original script
@@ -0,0 +1,44 @@
1
+ # sbJson 1.0 writer metadata repository
2
+
3
+ # History:
4
+ # Stan Smith 2017-06-06 original script
5
+
6
+ module ADIWG
7
+ module Mdtranslator
8
+ module Writers
9
+ module SbJson
10
+
11
+ module Repository
12
+
13
+ def self.build(aRepositories)
14
+
15
+ repository = {}
16
+
17
+ aRepositories.each do |hRepo|
18
+ if hRepo[:repository] == 'data.gov'
19
+ repository[:repository] = hRepo[:repository]
20
+ repository[:title] = 'Data.gov'
21
+ unless hRepo[:citation].empty?
22
+ unless hRepo[:citation][:identifiers].empty?
23
+ repository[:identifier] = hRepo[:citation][:identifiers][0][:identifier]
24
+ end
25
+ end
26
+ repository[:metadataStandard] = hRepo[:metadataStandard]
27
+ break
28
+ end
29
+ end
30
+
31
+ if repository.empty?
32
+ return nil
33
+ end
34
+
35
+ repository
36
+
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
@@ -19,10 +19,12 @@ module ADIWG
19
19
  hResource[:resourceTypes].each do |hResourceType|
20
20
  if hResourceType[:type] == 'project'
21
21
  hProject[:className] = 'gov.sciencebase.catalog.item.facet.ProjectFacet'
22
- unless hResource[:status].empty?
23
- status = hResource[:status][0]
22
+ hResource[:status].each do |status|
24
23
  sbStatus = Codelists.codelist_iso_to_sb('iso_sb_progress', :isoCode => status)
25
- hProject[:projectStatus] = sbStatus
24
+ unless sbStatus.nil?
25
+ hProject[:projectStatus] = sbStatus
26
+ break
27
+ end
26
28
  end
27
29
  unless hResource[:shortAbstract].nil?
28
30
  hProject[:parts] = [
@@ -19,6 +19,8 @@ require_relative 'sbJson_tag'
19
19
  require_relative 'sbJson_date'
20
20
  require_relative 'sbJson_spatial'
21
21
  require_relative 'sbJson_facet'
22
+ require_relative 'sbJson_metadataRepository'
23
+ require_relative 'sbJson_geographicExtent'
22
24
 
23
25
  module ADIWG
24
26
  module Mdtranslator
@@ -56,6 +58,8 @@ module ADIWG
56
58
  json.dates Date.build(hCitation) unless hCitation.empty?
57
59
  json.spatial Spatial.build(resourceInfo[:extents]) unless resourceInfo[:extents].empty?
58
60
  json.facets Facet.build(intObj[:metadata])
61
+ json.metadataRepository Repository.build(intObj[:metadataRepositories]) unless intObj[:metadataRepositories].empty?
62
+ json.geographicExtents GeographicExtent.build(resourceInfo[:extents]) unless resourceInfo[:extents].empty?
59
63
 
60
64
  end
61
65
 
@@ -50,20 +50,12 @@ module ADIWG
50
50
  end
51
51
  end
52
52
 
53
- # tags for projects
54
- hResource[:resourceTypes].each do |hType|
55
- type = hType[:type]
56
- if type == 'project'
57
- hResource[:status].each do |status|
58
- sbStatus = Codelists.codelist_iso_to_sb('iso_sb_progress', :isoCode => status)
59
- unless sbStatus.nil?
60
- hTag = {}
61
- hTag[:type] = 'Project Status'
62
- hTag[:name] = sbStatus
63
- aTags << hTag
64
- end
65
- end
66
- end
53
+ # tags for status
54
+ hResource[:status].each do |status|
55
+ hTag = {}
56
+ hTag[:type] = 'Status'
57
+ hTag[:name] = status
58
+ aTags << hTag
67
59
  end
68
60
 
69
61
  if aTags.empty?
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.0.0rc9
4
+ version: 2.0.0rc10
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-06-06 00:00:00.000000000 Z
12
+ date: 2017-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -129,14 +129,14 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 2.1.2
132
+ version: '2.2'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.1.2
139
+ version: '2.2'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: adiwg-mdcodes
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -587,10 +587,12 @@ files:
587
587
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb
588
588
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_date.rb
589
589
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_facet.rb
590
+ - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_geographicExtent.rb
590
591
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_hours.rb
591
592
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_id.rb
592
593
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_identifier.rb
593
594
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_materialRequest.rb
595
+ - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_metadataRepository.rb
594
596
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_parentId.rb
595
597
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_project.rb
596
598
  - lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_provenance.rb