adiwg-mdtranslator 2.19.0.pre.beta.25 → 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 (62) 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 +41 -31
  5. data/README.md +21 -0
  6. data/Rakefile +1 -0
  7. data/adiwg-mdtranslator.gemspec +2 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dataQuality.rb +59 -103
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_conformanceResult.rb +0 -5
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageResult.rb +0 -4
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQuality.rb +0 -7
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_descriptiveResult.rb +0 -4
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_quantitativeResult.rb +0 -4
  14. data/lib/adiwg/mdtranslator/version.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/dcat_us/dcat_us_writer.rb +98 -0
  16. data/lib/adiwg/mdtranslator/writers/dcat_us/readme.md +10 -0
  17. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_level.rb +55 -0
  18. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_url.rb +17 -0
  19. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_accrualPeriodicity.rb +45 -0
  20. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_bureau_code.rb +33 -0
  21. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_contact_point.rb +29 -0
  22. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_dcat_us.rb +104 -0
  23. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by.rb +29 -0
  24. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by_type.rb +33 -0
  25. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_description.rb +19 -0
  26. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_distribution.rb +59 -0
  27. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_download_url.rb +17 -0
  28. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_identifier.rb +29 -0
  29. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_is_part_of.rb +27 -0
  30. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_issued.rb +19 -0
  31. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_keyword.rb +19 -0
  32. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_landing_page.rb +27 -0
  33. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_language.rb +23 -0
  34. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_license.rb +18 -0
  35. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_media_type.rb +17 -0
  36. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_modified.rb +29 -0
  37. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_primaryITInvestmentUII.rb +19 -0
  38. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_program_code.rb +33 -0
  39. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_publisher.rb +74 -0
  40. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_references.rb +50 -0
  41. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_rights.rb +32 -0
  42. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_spatial.rb +32 -0
  43. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_system_of_records.rb +28 -0
  44. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_temporal.rb +40 -0
  45. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_theme.rb +28 -0
  46. data/lib/adiwg/mdtranslator/writers/dcat_us/version.rb +14 -0
  47. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb +31 -101
  48. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb +1 -17
  49. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +0 -28
  50. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_dataIdentification.rb +0 -29
  51. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_dataQualityReport.rb +1 -1
  52. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb +1 -10
  53. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_conformanceResult.rb +5 -6
  54. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coverageResult.rb +0 -1
  55. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_descriptiveResult.rb +0 -1
  56. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_onlineResource.rb +1 -1
  57. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_quantitativeResult.rb +5 -6
  58. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_resourceInfo.rb +1 -1
  59. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +26 -9
  60. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb +1 -1
  61. data/lib/adiwg/mdtranslator_cli.rb +1 -1
  62. metadata +39 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76dc9aee9edc270d77ac87fe2d62e5ee3cd865eb293e7d4cd46d4d2a6383f690
4
- data.tar.gz: ecd99be9dc4e95ae96baed221ecb1b4596aa2767845280e0faa50d3a561561cd
3
+ metadata.gz: ec23318ef18dc9729c5aaa6c608b55c856234d8e31a893b6c011f02494f75718
4
+ data.tar.gz: d28e618a12660f940c9fbc4d3ea380c1109cdc2c7756a32872c2f2e84b4e2c64
5
5
  SHA512:
6
- metadata.gz: a8663b6ce6fc458fe31a8a75f9116f555220f25a88fcd61475de21c28f41bec30f82123a3efbd869542dafb8c0de215bb64eec47532b96ca9f59b4a29f94fc80
7
- data.tar.gz: 504ef5e35eec5e4fe23e507c73fe8754f0670d24be44be42458a6a57e8d8bdb73c64bef894d489d719160fed7cafd05ba1a8e51fc8f71e0d6326d1a7f165a5d5
6
+ metadata.gz: 6c81ced313a48931ef23b337d408f512932836b81368c535eb197dc0950795b8510deea40f5a130b4372b3110f1d9020fb943d7537de8e80184dc88b25fe8994
7
+ data.tar.gz: 0566ba79a6004232a532bd7eda527bb60a90191ea0a0ba47baf38764efa014341074a31418cdc798f82a2fe5a5860f13d9f8a3e9dce8d170389edea39392a47d
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - uses: actions/checkout@v4
10
- - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
10
+ - uses: ruby/setup-ruby@v1
11
11
  with:
12
12
  ruby-version: "3.1" # Not needed with a .ruby-version file
13
13
  - run: bundle install
data/DCAT-US.md ADDED
@@ -0,0 +1,67 @@
1
+ # DCAT-US - mdTranslator proposed mappings
2
+ ## Quick references
3
+ - DCAT-US [element definitions](https://resources.data.gov/resources/dcat-us/)
4
+ - DCAT-US v1.1 [catalog.json schema](https://resources.data.gov/schemas/dcat-us/v1.1/schema/catalog.json)
5
+ - DCAT-US v1.1 [dataset.json schema](https://resources.data.gov/schemas/dcat-us/v1.1/schema/dataset.json)
6
+ - DCAT-US v1.1 [JSON-LD catalog.json schema](https://resources.data.gov/schemas/dcat-us/v1.1/schema/catalog.jsonld)
7
+ - [Element crosswalks](https://resources.data.gov/resources/podm-field-mapping/#field-mappings) to other standards
8
+
9
+ ## DCAT-US - mdTranslator
10
+
11
+ ### Always (always required)
12
+
13
+ | Field Name | DCAT Name | Condition | mdJson Source |
14
+ | --- | --- | --- | --- |
15
+ | Title | title | exists | citation.title |
16
+ | Description | description | exists | resourceInfo.abstract |
17
+ | Tags | keyword | exists | [resourceInfo.keyword.keyword[0, n] *flatten*] |
18
+ | Last Update | modified | if resourceInfo.citation.date[any].dateType = "lastUpdated" or "lastRevised" or "revision" | resourceInfo.citation.date[most recent] |
19
+ | Publisher | publisher{name} | if citation.responsibleParty.[any].role = "publisher" | contactId -> contact.name where isOrganization IS TRUE |
20
+ | | | if exists resourceDistribution.distributor.contact | [first contact] contactId -> contact.name where isOrganization IS TRUE |
21
+ | Publisher Parent Organization | publisher{subOrganizationOf} | if citation.responsibleParty[any].role = "publisher" and exists contactId -> memberOfOrganization[0] and isOrganization is true | contactId -> contact.name |
22
+ | | | if exists resourceDistribution.distributor.contact and exists contactId -> memberOfOrganization[0] and isOrganization IS TRUE | contactId -> contact.name |
23
+ | Contact Name | contactPoint{fn} | exists | resourceInfo.pointOfContact.parties[0].contactId -> contact.name |
24
+ | Contact Email | contactPoint{email} | exists | resourceInfo.pointOfContact.parties[0].contactId -> contact.eMailList[0] |
25
+ | Unique Identifier | identifier | if resourceInfo.citation.identifier.namespace = "DOI" | resourceInfo.citation.onlineResource.uri |
26
+ | | | if "DOI" within resourceInfo.citation.onlineResource.uri | resourceInfo.citation.onlineResource.uri |
27
+ | Public Access Level | accessLevel | [*extend codelist MD_RestrictionCode to include "public", "restricted public", "non-public"*] <br> if resourceInfo.constraints.legal[any] one of {"public", "restricted public", "non-public"} | resourceInfo.constraints.legal[first]. Also resourceInfo.constraint.security.classification [[MD_ClassificationCode](https://mdtools.adiwg.org/#codes-page?c=iso_classification)] |
28
+ | Bureau Code | bureauCode | | [*extend role codelist to include "bureau", extend namespace codelist to include "bureauCode"*] <br> for each resourceInfo.citation.responsibleParty[any] role = "bureau" <br>contactId -> contact.identifier [*identifier must conform to https://resources.data.gov/schemas/dcat-us/v1.1/omb_bureau_codes.csv*] |
29
+ | Program Code | programCode | | [*add new element of program resourceInfo.programCode, add new codelist of programCode*] <br> resourceInfo.program[0,n] |
30
+
31
+ ### If-Applicable (required if it exists)
32
+
33
+ | Field Name | DCAT Name | Condition | mdJson Source |
34
+ | --- | --- | --- | --- |
35
+ | Distribution | distribution | if exists resourceDistribution[any] and if exists resourceDistribution.distributor[any].transferOption[any].onlineOption[any].uri <br> for each resourceDistribution[0, n] where exists resourceDistribution.distributor.transferOption.onlineOption.uri then <br> {description, accessURL, downloadURL, mediaType, title} |
36
+ | - Description | distribution.description | exists | resourceDistribution.description |
37
+ | - AccessURL | distribution.accessURL | if citation.onlineResources[first occurence].uri [path ends in ".html"] [*required if applicable*] | resourceDistribution.distributor.transferOption.onlineOption.uri |
38
+ | - DownloadURL | dcat.distribution.downloadURL | if citation.onlineResources[first occurence].uri [path does not end in ".html"] [*required if applicable*] |resourceDistribution.distributor.transferOption.onlineOption.uri |
39
+ | - MediaType | distribution.mediaType | [*add codelist of "dataFormat"*] <br> transferOption.distributionFormat.formatSpecification.title [dataFormat] [*dataFormat should conform to: https://www.iana.org/assignments/media-types/media-types.xhtml*] |
40
+ | - Title | distribution.title | exists | resourceDistribution.distributor.transferOption.onlineOption.name |
41
+ | License | license | [*add resourceInfo.constraint.reference to mdEditor*] <br> if exists resourceInfo.constraint.reference[0] | resourceInfo.constraint.reference[0] <br> |
42
+ | | | else | https://creativecommons.org/publicdomain/zero/1.0/ <br> [*allows author to identify a license to use, or default to CC0 if none provided, CC0 would cover international usage as opposed to publicdomain*] <br> [*others: http://www.usa.gov/publicdomain/label/1.0/, http://opendatacommons.org/licenses/pddl/1.0*] |
43
+ | Rights | rights | if constraint.accessLevel in {"restricted public", "non-public"} | resourceInfo.constraint.releasibility.statement + " " + each constraint.releasibility.dessiminationConstraint[0, n] |
44
+ | Endpoint | *removed* | *ignored* | *ignored* |
45
+ | Spatial | spatial | if exists resourceInfo.extents[0].geographicExtents[0].boundingBox | boundingBox.eastLongitude + "," + boundingBox.southLatitude + "," + boundingBox.westLongitude + "," + boundingBox.northLatitude [*decimal degrees*] |
46
+ | | | else | if exists resourceInfo.extents[0].geographicExtents[0].geographicElement[0].type = "point" then <br> geographicElement[0].coordinate[1] + "," + geographicElement[0].coordinate[0] [*lat, long decimal degrees*] |
47
+ | Temporal | temporal | if exists resourceInfo.extent[0].temporalExtent[0] then <br> if exists tempororalExtent[0].timePeriod.startDate and exists temporaralExtent[0].timePeriod.endDate | timePeriod[0].startDate + "/" + timePeriod.endDate |
48
+ | | | if exists tempororalExtent[0].timePeriod.startDate and not exists temporaralExtent[0].timePeriod.endDate | tempororalExtent[0].timePeriod.startDate |
49
+ | | | if not exists temporalExtent[0].timePeriod.startDate and exists temporaralExtent[0].timePeriod.endDate | tempororalExtent[0].timePeriod.endDate <br> [*may need revisiting relative to decision on date only formatting*] |
50
+
51
+ ### No (not required)
52
+
53
+ | Field Name | DCAT Name | Condition | mdJson Source |
54
+ | --- | --- | --- | --- |
55
+ | Release Date | issued | if resourceInfo.citation.date[any].dateType = "publication" or "distributed" | resourceInfo.citation.date[earliest] |
56
+ | Frequency | accrualPeriodicity | | [*ISO codelist MD_maintenanceFrequency can be used and several codes intersect with accrualPeriod codelist they are partially corresponding. A column of ISO8601 code equivalents could be added to MD_maintenanceFrequency to provide the coding expected https://resources.data.gov/schemas/dcat-us/v1.1/iso8601_guidance/#accrualperiodicity, community valuation should be determined*] |
57
+ | Language | language | | [*language codelist could be used but needs to be bound with country corresponding to the RFC 5646 format https://datatracker.ietf.org/doc/html/rfc5646, such as "en-US", community valuation should be determined* |
58
+ | Data Quality | dataQuality | | [*this is a boolean to indicate whether data "conforms" to agency standards, value seems negligble*] |
59
+ | Category | theme | where resourceInfo.keyword[any].thesaurus.title = "ISO Topic Category" | [resourceInfo.keyword.keyword[0, n] *flatten*] |
60
+ | Related Documents | references | | associatedResource[all].resourceCitation.onlineResource[all].uri + additionalDocumentation[all].citation[all].onlineResource[all].uri [*comma separated*]|
61
+ | Homepage URL | landingPage | [*Add code "landingPage" to CI_OnlineFunctionCode*] <br> if resourceInfo.citation.onlineResource[any].function = "landingPage" | resourceInfo.citation.onlineResource.uri |
62
+ | Collection | isPartOf | for each associatedResource[0, n].initiativeType = "collection" and associatedResource.associationType = "collectiveTitle" | associatedResource.resourceCitation[0].uri |
63
+ | System of Records | systemOfRecords | [*Add code "sorn" to DS_InitiativeTypeCode*] <br> for each associatedResource[0, n].initiativeType = "sorn" | associatedResource.resourceCitation[0].uri |
64
+ | Primary IT Investment | primaryITInvestmentUII | | [*Links data to an IT investment identifier relative to Exhibit 53 docs, community valuation should be determined*] |
65
+ | Data Dictionary | describedBy | if dataDictionary.dictionaryIncludedWithResource IS NOT TRUE and citation.onlineResource[0].uri exists | dataDictionary.citation.onlineResource[0].uri |
66
+ | Data Dictionary Type | describedByType | | [*For simplicity, leave blank implying html page, community decision needed whether to support other format types using mime type and in the form of "application/pdf"*]|
67
+ | Data Standard | conformsTo | | [*Currently not able to identify the schema standard the data conforms to, though this has been proposed. Should this be built and there is community decision to support it, then it can be mapped*] |
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adiwg-mdtranslator (2.19.0.pre.beta.25)
5
- adiwg-mdcodes (= 2.10.0)
6
- adiwg-mdjson_schemas (= 2.9.5)
4
+ adiwg-mdtranslator (2.20.0.pre.beta.3)
5
+ adiwg-mdcodes (= 2.9.4.pre.beta.0)
6
+ adiwg-mdjson_schemas (= 2.9.3.pre.beta.0)
7
7
  builder (~> 3.2)
8
8
  coderay (~> 1.1)
9
9
  jbuilder (~> 2.5)
@@ -17,59 +17,69 @@ PATH
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- actionview (5.2.8.1)
21
- activesupport (= 5.2.8.1)
20
+ actionview (7.1.3.2)
21
+ activesupport (= 7.1.3.2)
22
22
  builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
26
- activesupport (5.2.8.1)
23
+ erubi (~> 1.11)
24
+ rails-dom-testing (~> 2.2)
25
+ rails-html-sanitizer (~> 1.6)
26
+ activesupport (7.1.3.2)
27
+ base64
28
+ bigdecimal
27
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
- i18n (>= 0.7, < 2)
29
- minitest (~> 5.1)
30
- tzinfo (~> 1.1)
31
- addressable (2.8.5)
30
+ connection_pool (>= 2.2.5)
31
+ drb
32
+ i18n (>= 1.6, < 2)
33
+ minitest (>= 5.1)
34
+ mutex_m
35
+ tzinfo (~> 2.0)
36
+ addressable (2.8.6)
32
37
  public_suffix (>= 2.0.2, < 6.0)
33
- adiwg-mdcodes (2.10.0)
38
+ adiwg-mdcodes (2.9.4.pre.beta.0)
34
39
  json (~> 2.0)
35
- adiwg-mdjson_schemas (2.9.5)
40
+ adiwg-mdjson_schemas (2.9.3.pre.beta.0)
41
+ base64 (0.2.0)
42
+ bigdecimal (3.1.8)
36
43
  builder (3.2.4)
37
44
  coderay (1.1.3)
38
- concurrent-ruby (1.2.2)
45
+ concurrent-ruby (1.2.3)
46
+ connection_pool (2.4.1)
39
47
  crass (1.0.6)
48
+ drb (2.2.1)
40
49
  erubi (1.12.0)
41
- i18n (1.14.1)
50
+ i18n (1.14.5)
42
51
  concurrent-ruby (~> 1.0)
43
- jbuilder (2.11.5)
52
+ jbuilder (2.12.0)
44
53
  actionview (>= 5.0.0)
45
54
  activesupport (>= 5.0.0)
46
- json (2.6.3)
55
+ json (2.7.2)
47
56
  json-schema (2.8.1)
48
57
  addressable (>= 2.4)
49
58
  kramdown (2.4.0)
50
59
  rexml
51
- loofah (2.21.1)
60
+ loofah (2.22.0)
52
61
  crass (~> 1.0.2)
53
- nokogiri (>= 1.5.9)
62
+ nokogiri (>= 1.12.0)
54
63
  minitest (5.20.0)
55
- nokogiri (1.15.5-arm64-darwin)
64
+ mutex_m (0.2.0)
65
+ nokogiri (1.15.6-arm64-darwin)
56
66
  racc (~> 1.4)
57
- nokogiri (1.15.5-x86_64-linux)
67
+ nokogiri (1.15.6-x86_64-linux)
58
68
  racc (~> 1.4)
59
- public_suffix (4.0.7)
69
+ public_suffix (5.0.5)
60
70
  racc (1.7.3)
61
- rails-dom-testing (2.1.1)
71
+ rails-dom-testing (2.2.0)
62
72
  activesupport (>= 5.0.0)
63
73
  minitest
64
74
  nokogiri (>= 1.6)
65
- rails-html-sanitizer (1.5.0)
66
- loofah (~> 2.19, >= 2.19.1)
75
+ rails-html-sanitizer (1.6.0)
76
+ loofah (~> 2.21)
77
+ nokogiri (~> 1.14)
67
78
  rake (13.1.0)
68
- rexml (3.2.5)
79
+ rexml (3.2.6)
69
80
  thor (0.20.3)
70
- thread_safe (0.3.6)
71
- tzinfo (1.2.11)
72
- thread_safe (~> 0.1)
81
+ tzinfo (2.0.6)
82
+ concurrent-ruby (~> 1.0)
73
83
  uuidtools (2.2.0)
74
84
 
75
85
  PLATFORMS
data/README.md CHANGED
@@ -23,6 +23,27 @@ Or install it yourself as:
23
23
 
24
24
  $ mdtranslator help translate
25
25
 
26
+ ## Development
27
+
28
+ ### Requirements
29
+
30
+ Requires
31
+ - [Ruby](https://www.ruby-lang.org/en/documentation/installation/)
32
+ - bundler (`gem install bundler`)
33
+ - rake (`gem install rake`)
34
+
35
+ ### Tests
36
+
37
+ In order to run the tests, first install the dependencies
38
+
39
+ $ bundle install
40
+
41
+ Then, run the rake command
42
+
43
+ $ bundle exec rake
44
+
45
+ _TODO: There are currently 4 tests that are not passing, related to mdJSON readers and writers_
46
+
26
47
  ## Contributing
27
48
 
28
49
  1. Fork it ( https://github.com/[my-github-username]/mdTranslator/fork )
data/Rakefile CHANGED
@@ -23,6 +23,7 @@ Rake::TestTask.new do |t|
23
23
  'test/writers/iso19115-3/tc*.rb',
24
24
  'test/writers/mdJson/tc*.rb',
25
25
  'test/writers/sbJson/tc*.rb',
26
+ 'test/writers/dcat_us/tc*.rb',
26
27
  'test/translator/tc*.rb'
27
28
  ]
28
29
  t.verbose = true
@@ -34,8 +34,8 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency "thor", "~> 0.19"
35
35
  spec.add_runtime_dependency "uuidtools", "~> 2.1"
36
36
  spec.add_runtime_dependency "json-schema", "~> 2.7"
37
- spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.5"
38
- spec.add_runtime_dependency "adiwg-mdcodes", "2.10.0"
37
+ spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.3.pre.beta.0"
38
+ spec.add_runtime_dependency "adiwg-mdcodes", "2.9.4.pre.beta.0"
39
39
  spec.add_runtime_dependency "jbuilder", "~> 2.5"
40
40
  spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0"
41
41
  spec.add_runtime_dependency "coderay", "~> 1.1"
@@ -28,39 +28,24 @@ module ADIWG
28
28
 
29
29
  # data quality 2.1 (attracc) - attribute accuracy
30
30
  xAccuracy = xDataQual.xpath('./attracc')
31
- unless xAccuracy.empty?
32
- # data quality 2.1.1 (attraccr) - Attribute Accuracy Report
33
- xAccuracyReport = xAccuracy.xpath('./attraccr')
34
- unless xAccuracyReport.empty?
35
- report = intMetadataClass.newDataQualityReport
36
- report[:type] = 'DQ_NonQuantitativeAttributeCorrectness'
37
- descriptiveResult = intMetadataClass.newDescriptiveResult
38
- descriptiveResult[:name] = 'Attribute Accuracy Report'
39
- descriptiveResult[:statement] = xAccuracyReport.text
40
- report[:descriptiveResult] << descriptiveResult
41
- hDataQuality[:report] << report
42
- end
43
- # data quality 2.1.2 (qattracc) - Quantitative Attribute Accuracy Assessment
44
- xQuantitativeAccuracy = xAccuracy.xpath('./qattracc')
45
- unless xQuantitativeAccuracy.empty?
46
- report = intMetadataClass.newDataQualityReport
47
- report[:type] = 'DQ_QuantitativeAttributeAccuracy'
48
- # data quality 2.1.2.1 (attraccv) - Attribute Accuracy Value
49
- xQuantitativeAccuracyValue = xQuantitativeAccuracy.xpath('./attraccv')
50
- unless xQuantitativeAccuracyValue.empty?
51
- quantitativeResult = intMetadataClass.newQuantitativeResult
52
- quantitativeResult[:name] = 'Attribute Accuracy Value'
53
- quantitativeResult[:values] << xQuantitativeAccuracyValue.text
54
- report[:quantitativeResult] << quantitativeResult
55
- end
56
- # data quality 2.1.2.2 (attracce) - Attribute Accuracy Explanation
57
- xEvaluationMethod = xQuantitativeAccuracy.xpath('./attracce')
58
- unless xEvaluationMethod.empty?
59
- report[:evaluationMethod] = intMetadataClass.newEvaluationMethod
60
- report[:evaluationMethod][:methodDescription] = xEvaluationMethod.text
61
- end
62
- hDataQuality[:report] << report unless report[:quantitativeResult].empty? && report[:evaluationMethod].empty?
63
- end
31
+ accuracyReport = xAccuracy.xpath('./attraccr').text
32
+ report = intMetadataClass.newDataQualityReport
33
+ report[:type] = 'NonQuantitativeAttributeCorrectness'
34
+ descriptiveResult = intMetadataClass.newDescriptiveResult
35
+ descriptiveResult[:statement] = accuracyReport
36
+ report[:descriptiveResult] << descriptiveResult
37
+ hDataQuality[:report] << report
38
+
39
+ # data quality 2.1 (qattracc) - Quantitative Attribute Accuracy Assessment
40
+ xQuantitativeAccuracy = xDataQual.xpath('./qattracc')
41
+ unless xQuantitativeAccuracy.xpath('./attraccv').empty?
42
+ value = xQuantitativeAccuracy.xpath('./attraccv').text
43
+ report = intMetadataClass.newDataQualityReport
44
+ report[:type] = 'QuantitativeAttributeAccuracy'
45
+ quantitativeResult = intMetadataClass.newQuantitativeResult
46
+ quantitativeResult[:values] << value
47
+ report[:quantitativeResult] << quantitativeResult
48
+ hDataQuality[:report] << report
64
49
  end
65
50
 
66
51
  # data quality 2.2 (logic) - logical consistency (required) (not implemented)
@@ -70,11 +55,9 @@ module ADIWG
70
55
  else
71
56
  logic = xLogic.text
72
57
  report = intMetadataClass.newDataQualityReport
73
- report[:type] = 'DQ_ConceptualConsistency'
74
- descriptiveResult = intMetadataClass.newDescriptiveResult
75
- descriptiveResult[:name] = 'Logical Consistency Report'
76
- descriptiveResult[:statement] = logic
77
- report[:descriptiveResult] << descriptiveResult
58
+ report[:type] = 'ConceptualConsistency'
59
+ report[:qualityMeasure] = intMetadataClass.newQualityMeasure
60
+ report[:qualityMeasure][:description] = logic
78
61
  hDataQuality[:report] << report
79
62
  end
80
63
 
@@ -85,86 +68,59 @@ module ADIWG
85
68
  else
86
69
  complete = xComplete.text
87
70
  report = intMetadataClass.newDataQualityReport
88
- report[:type] = 'DQ_CompletenessOmission'
71
+ report[:type] = 'Omission'
89
72
  descriptiveResult = intMetadataClass.newDescriptiveResult
90
- descriptiveResult[:name] = 'Completeness Report'
91
73
  descriptiveResult[:statement] = complete
92
74
  report[:descriptiveResult] << descriptiveResult
93
75
  hDataQuality[:report] << report
94
76
  end
95
77
 
96
- # data quality 2.4 (posacc) - Positional Accuracy
78
+ # data quality 2.4 (position) - positional accuracy
97
79
  xPositionalAccuracy = xDataQual.xpath('./posacc')
98
80
  unless xPositionalAccuracy.empty?
99
- # data quality 2.4.1 (horizpa) - Horizontal Positional Accuracy
100
- xHorizontalAccuracy = xPositionalAccuracy.xpath('./horizpa')
101
- unless xHorizontalAccuracy.empty?
81
+ # horizontal positional accuracy
82
+ xHorizontal = xPositionalAccuracy.xpath('./horizpa')
83
+ unless xHorizontal.empty?
102
84
  report = intMetadataClass.newDataQualityReport
103
- report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
104
- # data quality 2.4.1.1 (horizpar) - Horizontal Positional Accuracy Report
105
- xHorizontalAccuracyReport = xHorizontalAccuracy.xpath('./horizpar')
106
- unless xHorizontalAccuracyReport.empty?
107
- descriptiveResult = intMetadataClass.newDescriptiveResult
108
- descriptiveResult[:name] = 'Horizontal Positional Accuracy Report'
109
- descriptiveResult[:statement] = xHorizontalAccuracyReport.text
110
- report[:descriptiveResult] << descriptiveResult
85
+ report[:type] = 'AbsoluteExternalPositionalAccuracy'
86
+ unless xHorizontal.xpath('qhorizpa/horizpae').empty?
87
+ report[:qualityMeasure] = intMetadataClass.newQualityMeasure
88
+ report[:qualityMeasure][:description] = xHorizontal.xpath('qhorizpa/horizpae').text
89
+ name = 'Horizontal Positional Accuracy Report'
90
+ report[:qualityMeasure][:nameOfMeasure] << name
111
91
  end
112
- # data quality 2.4.1.2 (qhorizpa) - Quantitative Horizontal Positional Accuracy Assessment
113
- xQuantitativeHorizontalAccuracy = xHorizontalAccuracy.xpath('./qhorizpa')
114
- unless xQuantitativeHorizontalAccuracy.empty?
115
- # data quality 2.4.1.2.1 (horizpav) - Horizontal Positional Accuracy Value
116
- xHorizontalAccuracyValue = xQuantitativeHorizontalAccuracy.xpath('horizpav')
117
- unless xHorizontalAccuracyValue.empty?
118
- quantitativeResult = intMetadataClass.newQuantitativeResult
119
- value = xHorizontalAccuracyValue.text
120
- quantitativeResult[:name] = 'Horizontal Positional Accuracy Value'
121
- quantitativeResult[:values] << value
122
- report[:quantitativeResult] << quantitativeResult
123
- end
124
- # data quality 2.4.1.2.2 (horizpae) - Horizontal Positional Accuracy Explanation
125
- xHorizontalAccuracyExplanation = xQuantitativeHorizontalAccuracy.xpath('horizpae')
126
- unless xHorizontalAccuracyExplanation.empty?
127
- descriptiveResult = intMetadataClass.newDescriptiveResult
128
- descriptiveResult[:name] = 'Horizontal Positional Accuracy Explanation'
129
- descriptiveResult[:statement] = xHorizontalAccuracyExplanation.text
130
- report[:descriptiveResult] << descriptiveResult
131
- end
92
+ unless xHorizontal.xpath('horizpar').empty?
93
+ report[:evaluationMethod] = intMetadataClass.newEvaluationMethod
94
+ report[:evaluationMethod][:methodDescription] = xHorizontal.xpath('horizpar').text
95
+ end
96
+ unless xHorizontal.xpath('qhorizpa/horizpav').empty?
97
+ quantitativeResult = intMetadataClass.newQuantitativeResult
98
+ value = xHorizontal.xpath('qhorizpa/horizpav').text
99
+ quantitativeResult[:values] << value
100
+ report[:quantitativeResult] << quantitativeResult
132
101
  end
133
102
  hDataQuality[:report] << report
134
103
  end
135
- # data quality 2.4.2 (vertacc) - Vertical Positional Accuracy
136
- xVerticalAccuracy = xPositionalAccuracy.xpath('./vertacc')
137
- unless xVerticalAccuracy.empty?
104
+ # vertical positional accuracy
105
+ xVertical = xPositionalAccuracy.xpath('./vertacc')
106
+ unless xVertical.empty?
138
107
  report = intMetadataClass.newDataQualityReport
139
- report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
140
- # data quality 2.4.2.1 (vertaccr) - Vertical Positional Accuracy Report
141
- xVerticalAccuracyReport = xVerticalAccuracy.xpath('./vertaccr')
142
- unless xVerticalAccuracyReport.empty?
143
- descriptiveResult = intMetadataClass.newDescriptiveResult
144
- descriptiveResult[:name] = 'Vertical Positional Accuracy Report'
145
- descriptiveResult[:statement] = xVerticalAccuracyReport.text
146
- report[:descriptiveResult] << descriptiveResult
108
+ report[:type] = 'AbsoluteExternalPositionalAccuracy'
109
+ unless xVertical.xpath('qvertpa/vertacce').empty?
110
+ report[:qualityMeasure] = intMetadataClass.newQualityMeasure
111
+ report[:qualityMeasure][:description] = xVertical.xpath('qvertpa/vertacce').text
112
+ name = 'Vertical Positional Accuracy Report'
113
+ report[:qualityMeasure][:nameOfMeasure] << name
114
+ end
115
+ unless xVertical.xpath('vertaccr').empty?
116
+ report[:evaluationMethod] = intMetadataClass.newEvaluationMethod
117
+ report[:evaluationMethod][:methodDescription] = xVertical.xpath('vertaccr').text
147
118
  end
148
- # data quality 2.4.2.2 (qvertpa) - Quantitative Vertical Positional Accuracy Assessment
149
- xVerticalAccuracyAssessment = xVerticalAccuracy.xpath('./qvertpa')
150
- unless xVerticalAccuracyAssessment.empty?
151
- # data quality 2.4.2.2.1 (vertaccv) - Vertical Positional Accuracy Value
152
- xVerticalAccuracyValue = xVerticalAccuracyAssessment.xpath('vertaccv')
153
- unless xVerticalAccuracyValue.empty?
154
- quantitativeResult = intMetadataClass.newQuantitativeResult
155
- value = xVerticalAccuracyValue.text
156
- quantitativeResult[:name] = 'Vertical Positional Accuracy Value'
157
- quantitativeResult[:values] << value
158
- report[:quantitativeResult] << quantitativeResult
159
- end
160
- # data quality 2.4.2.2.2 (vertacce) - Vertical Positional Accuracy Explanation
161
- xVerticalAccuracyExplanation = xVerticalAccuracyAssessment.xpath('vertacce')
162
- unless xVerticalAccuracyExplanation.empty?
163
- descriptiveResult = intMetadataClass.newDescriptiveResult
164
- descriptiveResult[:name] = 'Vertical Positional Accuracy Explanation'
165
- descriptiveResult[:statement] = xVerticalAccuracyExplanation.text
166
- report[:descriptiveResult] << descriptiveResult
167
- end
119
+ unless xVertical.xpath('qvertpa/vertaccv').empty?
120
+ quantitativeResult = intMetadataClass.newQuantitativeResult
121
+ value = xVertical.xpath('qvertpa/vertaccv').text
122
+ quantitativeResult[:values] << value
123
+ report[:quantitativeResult] << quantitativeResult
168
124
  end
169
125
  hDataQuality[:report] << report
170
126
  end
@@ -23,11 +23,6 @@ module ADIWG
23
23
  intConformanceResult[:scope] = Scope.unpack(hConformanceResult['scope'], responseObj)
24
24
  end
25
25
 
26
- # name
27
- if hConformanceResult.has_key?('name')
28
- intConformanceResult[:name] = hConformanceResult['name']
29
- end
30
-
31
26
  #specification
32
27
  if hConformanceResult.has_key?('specification')
33
28
  intConformanceResult[:specification] = Citation.unpack(hConformanceResult['specification'], responseObj)
@@ -26,10 +26,6 @@ module ADIWG
26
26
  intResult[:scope] = Scope.unpack(hResult['scope'], responseObj)
27
27
  end
28
28
 
29
- # name
30
- if hResult.has_key?('name')
31
- intResult[:name] = hResult['name']
32
- end
33
29
 
34
30
  # spatialRepresentationType
35
31
  if hResult.has_key?('spatialRepresentationType')
@@ -35,13 +35,6 @@ module ADIWG
35
35
  end
36
36
  end
37
37
 
38
- if hDataQuality.has_key?('systemIdentifier')
39
- systemIdentifier = hDataQuality['systemIdentifier']
40
- intDataQuality[:systemIdentifier] = {}
41
- intDataQuality[:systemIdentifier][:uid] = systemIdentifier['uid']
42
- intDataQuality[:systemIdentifier][:label] = systemIdentifier['label']
43
- end
44
-
45
38
  if hDataQuality.has_key?('standaloneQualityReport')
46
39
  hObject = hDataQuality['standaloneQualityReport']
47
40
  unless hObject.empty?
@@ -25,10 +25,6 @@ module ADIWG
25
25
  intResult[:scope] = Scope.unpack(hResult['scope'], responseObj)
26
26
  end
27
27
 
28
- if hResult.has_key?('name')
29
- intResult[:name] = hResult['name']
30
- end
31
-
32
28
  if hResult.has_key?('statement')
33
29
  intResult[:statement] = hResult['statement']
34
30
  end
@@ -25,10 +25,6 @@ module ADIWG
25
25
  intResult[:scope] = Scope.unpack(hResult['scope'], responseObj)
26
26
  end
27
27
 
28
- if hResult.has_key?('name')
29
- intResult[:name] = hResult['name']
30
- end
31
-
32
28
  if hResult.has_key?('value')
33
29
  intResult[:values] = hResult['value']
34
30
  end
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.19.0-beta.25"
112
+ VERSION = "2.20.0-beta.3"
113
113
  end
114
114
  end
115
115
 
@@ -0,0 +1,98 @@
1
+ require 'jbuilder'
2
+ require_relative 'version'
3
+ require_relative 'sections/dcat_us_dcat_us'
4
+
5
+ module ADIWG
6
+ module Mdtranslator
7
+ module Writers
8
+ module Dcat_us
9
+
10
+ def self.startWriter(intObj, responseObj)
11
+ # set the contact array for use by the writer
12
+ @contacts = intObj[:contacts]
13
+
14
+ # set output flag for null properties
15
+ Jbuilder.ignore_nil(!responseObj[:writerShowTags])
16
+
17
+ # set the format of the output file based on the writer specified
18
+ responseObj[:writerOutputFormat] = 'json'
19
+ responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Dcat_us::VERSION
20
+
21
+ # write the dcat_us metadata record
22
+ metadata = Dcat_us.build(intObj, responseObj)
23
+
24
+ # set writer pass to true if no messages
25
+ # false or warning state will be set by writer code
26
+ responseObj[:writerPass] = true if responseObj[:writerMessages].empty?
27
+
28
+ # encode the metadata target as JSON
29
+ metadata.target!
30
+ end
31
+
32
+ # find contact in contact array and return the contact hash
33
+ def self.get_contact_by_index(contactIndex)
34
+ if @contacts[contactIndex]
35
+ return @contacts[contactIndex]
36
+ end
37
+ {}
38
+ end
39
+
40
+ # find contact in contact array and return the contact hash
41
+ def self.get_contact_by_id(contactId)
42
+ @contacts.each do |hContact|
43
+ if hContact[:contactId] == contactId
44
+ return hContact
45
+ end
46
+ end
47
+ {}
48
+ end
49
+
50
+ # find contact in contact array and return the contact index
51
+ def self.get_contact_index_by_id(contactId)
52
+ @contacts.each_with_index do |hContact, index|
53
+ if hContact[:contactId] == contactId
54
+ return index
55
+ end
56
+ end
57
+ {}
58
+ end
59
+
60
+ # ignore jBuilder object mapping when array is empty
61
+ def self.json_map(collection = [], _class)
62
+ if collection.nil? || collection.empty?
63
+ return nil
64
+ else
65
+ collection.map { |item| _class.build(item).attributes! }
66
+ end
67
+ end
68
+
69
+ # find all nested objects in 'obj' that contain the element 'ele'
70
+ def self.nested_objs_by_element(obj, ele, excludeList = [])
71
+ aCollected = []
72
+ obj.each do |key, value|
73
+ skipThisOne = false
74
+ excludeList.each do |exclude|
75
+ if key == exclude.to_sym
76
+ skipThisOne = true
77
+ end
78
+ end
79
+ next if skipThisOne
80
+ if key == ele.to_sym
81
+ aCollected << obj
82
+ elsif obj.is_a?(Array)
83
+ if key.respond_to?(:each)
84
+ aReturn = nested_objs_by_element(key, ele, excludeList)
85
+ aCollected = aCollected.concat(aReturn) unless aReturn.empty?
86
+ end
87
+ elsif obj[key].respond_to?(:each)
88
+ aReturn = nested_objs_by_element(value, ele, excludeList)
89
+ aCollected = aCollected.concat(aReturn) unless aReturn.empty?
90
+ end
91
+ end
92
+ aCollected
93
+ end
94
+
95
+ end
96
+ end
97
+ end
98
+ end