adiwg-mdtranslator 2.19.0.pre.beta.17 → 2.20.0.pre.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -1
  3. data/DCAT-US.md +67 -0
  4. data/Gemfile.lock +37 -27
  5. data/README.md +21 -0
  6. data/Rakefile +1 -0
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dataQuality.rb +1 -1
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_conformanceResult.rb +0 -5
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageResult.rb +0 -4
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_descriptiveResult.rb +0 -4
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_quantitativeResult.rb +0 -4
  12. data/lib/adiwg/mdtranslator/version.rb +1 -1
  13. data/lib/adiwg/mdtranslator/writers/dcat_us/dcat_us_writer.rb +98 -0
  14. data/lib/adiwg/mdtranslator/writers/dcat_us/readme.md +10 -0
  15. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_level.rb +55 -0
  16. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_url.rb +17 -0
  17. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_accrualPeriodicity.rb +45 -0
  18. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_bureau_code.rb +33 -0
  19. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_contact_point.rb +29 -0
  20. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_dcat_us.rb +104 -0
  21. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by.rb +29 -0
  22. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by_type.rb +33 -0
  23. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_description.rb +19 -0
  24. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_distribution.rb +59 -0
  25. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_download_url.rb +17 -0
  26. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_identifier.rb +29 -0
  27. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_is_part_of.rb +27 -0
  28. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_issued.rb +19 -0
  29. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_keyword.rb +19 -0
  30. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_landing_page.rb +27 -0
  31. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_language.rb +23 -0
  32. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_license.rb +18 -0
  33. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_media_type.rb +17 -0
  34. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_modified.rb +29 -0
  35. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_primaryITInvestmentUII.rb +19 -0
  36. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_program_code.rb +33 -0
  37. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_publisher.rb +74 -0
  38. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_references.rb +50 -0
  39. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_rights.rb +32 -0
  40. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_spatial.rb +32 -0
  41. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_system_of_records.rb +28 -0
  42. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_temporal.rb +40 -0
  43. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_theme.rb +28 -0
  44. data/lib/adiwg/mdtranslator/writers/dcat_us/version.rb +14 -0
  45. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb +1 -1
  46. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +0 -28
  47. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_conformanceResult.rb +5 -6
  48. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coverageResult.rb +0 -1
  49. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_descriptiveResult.rb +0 -1
  50. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_quantitativeResult.rb +5 -6
  51. data/lib/adiwg/mdtranslator_cli.rb +1 -1
  52. metadata +34 -1
@@ -0,0 +1,32 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Rights
6
+
7
+ def self.build(intObj, accessLevel)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ constraints = resourceInfo&.dig(:constraints)
10
+
11
+ if accessLevel && ["restricted public", "non-public"].include?(accessLevel)
12
+ constraints&.each do |constraint|
13
+ if constraint[:type] == "use"
14
+ statement = constraint.dig(:releasability, :statement)
15
+ disseminationConstraints = constraint.dig(:releasability, :disseminationConstraint)
16
+
17
+ if statement && disseminationConstraints
18
+ combinedConstraints = disseminationConstraints.join(" ")
19
+ return "#{statement} #{combinedConstraints}".strip
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ nil
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Spatial
6
+
7
+ def self.build(intObj)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ extent = resourceInfo&.dig(:extents, 0)
10
+ geographicExtent = extent&.dig(:geographicExtents, 0)
11
+ boundingBox = geographicExtent&.dig(:boundingBox)
12
+
13
+ if boundingBox
14
+ return [
15
+ boundingBox[:eastLongitude],
16
+ boundingBox[:southLatitude],
17
+ boundingBox[:westLongitude],
18
+ boundingBox[:northLatitude]
19
+ ].join(',')
20
+ elsif geographicExtent&.dig(:geographicElement, 0, :type) == 'point'
21
+ point = geographicExtent.dig(:geographicElement, 0, :coordinate)
22
+ return "#{point[1]},#{point[0]}" if point&.length == 2
23
+ end
24
+
25
+ nil
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module SystemOfRecords
8
+
9
+ def self.build(intObj)
10
+ associatedResources = intObj.dig(:metadata, :associatedResources)
11
+
12
+ return nil if associatedResources.nil?
13
+
14
+ associatedResources.each do |resource|
15
+ if resource[:initiativeType] == 'sorn'
16
+ onlineResources = resource.dig(:resourceCitation, :onlineResources)
17
+ return onlineResources.first[:olResURI] if onlineResources&.first&.has_key?(:olResURI)
18
+ end
19
+ end
20
+
21
+ return nil
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Temporal
6
+
7
+ def self.build(intObj)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ extent = resourceInfo&.dig(:extents, 0)
10
+ temporalExtents = extent&.dig(:temporalExtents)
11
+
12
+ if temporalExtents
13
+ temporalExtents.each do |temporalExtent|
14
+ timePeriod = temporalExtent&.dig(:timePeriod)
15
+ next unless timePeriod
16
+
17
+ startDateHash = timePeriod[:startDateTime]
18
+ endDateHash = timePeriod[:endDateTime]
19
+
20
+ startDate = startDateHash&.dig(:dateTime)
21
+ endDate = endDateHash&.dig(:dateTime)
22
+
23
+ if startDate && endDate
24
+ return "#{startDate}/#{endDate}"
25
+ elsif startDate
26
+ return startDate
27
+ elsif endDate
28
+ return endDate
29
+ end
30
+ end
31
+ end
32
+
33
+ nil
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,28 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module Theme
8
+
9
+ def self.build(intObj)
10
+ resourceInfo = intObj[:metadata][:resourceInfo]
11
+ keywords_str = []
12
+
13
+ resourceInfo[:keywords].each do |keyword_group|
14
+ if keyword_group[:thesaurus][:title] == "ISO Topic Categories"
15
+ keyword_group[:keywords].each do |keyword_obj|
16
+ keywords_str << keyword_obj[:keyword]
17
+ end
18
+ end
19
+ end
20
+
21
+ return keywords_str.join(" ")
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ # dcat_us version history
2
+ # Johnathan Aspinwall 2023-06-22 created for mdJson/mdTranslator 2.0
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Dcat_us
8
+
9
+ VERSION = '1.0.0'
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -56,7 +56,7 @@ module ADIWG
56
56
 
57
57
  # data quality 2.3 (complete) - completion report (not implemented) (required)
58
58
  completeness_report = hDataQuality[:report].find do |report|
59
- report[:type] == 'CompletenessOmission' &&
59
+ report[:type] == 'Omission' &&
60
60
  !report.dig(:descriptiveResult, 0, :statement).nil?
61
61
  end
62
62
 
@@ -185,13 +185,6 @@ module ADIWG
185
185
  end
186
186
  end
187
187
  end
188
-
189
- # Name
190
- unless result[:name].nil?
191
- @html.em('Name: ')
192
- @html.text!(result[:name])
193
- @html.br
194
- end
195
188
 
196
189
  # Specification (citation)
197
190
  unless result[:specification].empty?
@@ -249,13 +242,6 @@ module ADIWG
249
242
  end
250
243
  end
251
244
 
252
- # Name
253
- unless result[:name].nil?
254
- @html.em('Name: ')
255
- @html.text!(result[:name])
256
- @html.br
257
- end
258
-
259
245
  # SpatialRepresentationType
260
246
  unless result[:spatialRepresentationType].nil?
261
247
  @html.em('Spatial Representation Type: ')
@@ -331,13 +317,6 @@ module ADIWG
331
317
  end
332
318
  end
333
319
  end
334
-
335
- # Name
336
- unless result[:name].nil?
337
- @html.em('Name: ')
338
- @html.text!(result[:name])
339
- @html.br
340
- end
341
320
 
342
321
  # Statement
343
322
  unless result[:statement].nil?
@@ -373,13 +352,6 @@ module ADIWG
373
352
  end
374
353
  end
375
354
  end
376
-
377
- # Name
378
- unless result[:name].nil?
379
- @html.em('Name: ')
380
- @html.text!(result[:name])
381
- @html.br
382
- end
383
355
 
384
356
  # Value
385
357
  unless result[:values].empty?
@@ -10,12 +10,11 @@ module ADIWG
10
10
  module ConformanceResult
11
11
  def self.build(hConformanceResult)
12
12
  Jbuilder.new do |json|
13
- json.dateTime hConformanceResult[:dateTime] unless hConformanceResult[:dateTime].nil?
14
- json.scope Scope.build(hConformanceResult[:scope]) unless hConformanceResult[:scope].empty?
15
- json.name hConformanceResult[:name] unless hConformanceResult[:name].nil?
16
- json.specification Citation.build(hConformanceResult[:specification]) unless hConformanceResult[:specification].empty?
17
- json.explanation hConformanceResult[:explanation] unless hConformanceResult[:explanation].nil?
18
- json.pass hConformanceResult[:pass] unless hConformanceResult[:pass].nil?
13
+ json.dateTime hConformanceResult[:dateTime]
14
+ json.scope Scope.build(hConformanceResult[:scope])
15
+ json.specification Citation.build(hConformanceResult[:specification])
16
+ json.explanation hConformanceResult[:explanation]
17
+ json.pass hConformanceResult[:pass]
19
18
  end
20
19
  end
21
20
  end
@@ -15,7 +15,6 @@ module ADIWG
15
15
  Jbuilder.new do |json|
16
16
  json.dateTime hCoverageResult[:dateTime]
17
17
  json.scope Scope.build(hCoverageResult[:scope]) unless hCoverageResult[:scope].empty?
18
- json.name hCoverageResult[:name] unless hCoverageResult[:name].nil?
19
18
  json.spatialRepresentationType hCoverageResult[:spatialRepresentationType]
20
19
  json.spatialRepresentation SpatialRepresentation.build(hCoverageResult[:spatialRepresentation]) unless hCoverageResult[:spatialRepresentation].empty?
21
20
  json.resultContentDescription CoverageDescription.build(hCoverageResult[:resultContentDescription]) unless hCoverageResult[:resultContentDescription].empty?
@@ -11,7 +11,6 @@ module ADIWG
11
11
  Jbuilder.new do |json|
12
12
  json.dateTime hResult[:dateTime] unless hResult[:dateTime].nil?
13
13
  json.scope Scope.build(hResult[:scope]) unless hResult[:scope].empty?
14
- json.name hResult[:name] unless hResult[:name].nil?
15
14
  json.statement hResult[:statement] unless hResult[:statement].nil?
16
15
  end
17
16
  end
@@ -9,12 +9,11 @@ module ADIWG
9
9
  module QuantitativeResult
10
10
  def self.build(hResult)
11
11
  Jbuilder.new do |json|
12
- json.dateTime hResult[:dateTime] unless hResult[:dateTime].nil?
13
- json.scope Scope.build(hResult[:scope]) unless hResult[:scope].empty?
14
- json.name hResult[:name] unless hResult[:name].nil?
15
- json.value hResult[:values] unless hResult[:values].empty?
16
- json.valueUnits hResult[:valueUnits] unless hResult[:valueUnits].nil?
17
- json.valueRecordType hResult[:valueRecordType] unless hResult[:valueRecordType].nil?
12
+ json.dateTime hResult[:dateTime]
13
+ json.scope Scope.build(hResult[:scope]) if hResult[:scope]
14
+ json.value hResult[:values]
15
+ json.valueUnits hResult[:valueUnits]
16
+ json.valueRecordType hResult[:valueRecordType]
18
17
  end
19
18
  end
20
19
  end
@@ -39,7 +39,7 @@ and to choose the level of validation for mdJson input files.
39
39
  :enum => %w{mdJson sbJson fgdc}, :required => true
40
40
  method_option :writer, :aliases => '-w',
41
41
  :desc => 'Writer to create your output metadata file, leave blank to validate input only',
42
- :enum => %w{fgdc html iso19110 iso19115_1 iso19115_2 iso19115_3 mdJson sbJson simple_html }
42
+ :enum => %w{fgdc html iso19110 iso19115_1 iso19115_2 iso19115_3 mdJson sbJson simple_html dcat_us}
43
43
  method_option :validate, :aliases => '-v', :desc => 'Specify level of validation to be performed',
44
44
  :enum => %w{none normal strict}, :default => 'normal'
45
45
  method_option :forceValid, :aliases => '-f', :desc => 'Insert tags for required elements missing from input',
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.19.0.pre.beta.17
4
+ version: 2.20.0.pre.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
@@ -232,6 +232,7 @@ files:
232
232
  - ".jsbeautifyrc"
233
233
  - ".travis.yml"
234
234
  - CHANGELOG.md
235
+ - DCAT-US.md
235
236
  - Gemfile
236
237
  - Gemfile.lock
237
238
  - LICENSE.txt
@@ -474,6 +475,38 @@ files:
474
475
  - lib/adiwg/mdtranslator/readers/sbJson/sbJson_reader.rb
475
476
  - lib/adiwg/mdtranslator/readers/sbJson/version.rb
476
477
  - lib/adiwg/mdtranslator/version.rb
478
+ - lib/adiwg/mdtranslator/writers/dcat_us/dcat_us_writer.rb
479
+ - lib/adiwg/mdtranslator/writers/dcat_us/readme.md
480
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_level.rb
481
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_url.rb
482
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_accrualPeriodicity.rb
483
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_bureau_code.rb
484
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_contact_point.rb
485
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_dcat_us.rb
486
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by.rb
487
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by_type.rb
488
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_description.rb
489
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_distribution.rb
490
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_download_url.rb
491
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_identifier.rb
492
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_is_part_of.rb
493
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_issued.rb
494
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_keyword.rb
495
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_landing_page.rb
496
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_language.rb
497
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_license.rb
498
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_media_type.rb
499
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_modified.rb
500
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_primaryITInvestmentUII.rb
501
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_program_code.rb
502
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_publisher.rb
503
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_references.rb
504
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_rights.rb
505
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_spatial.rb
506
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_system_of_records.rb
507
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_temporal.rb
508
+ - lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_theme.rb
509
+ - lib/adiwg/mdtranslator/writers/dcat_us/version.rb
477
510
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb
478
511
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb
479
512
  - lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb