adiwg-mdtranslator 1.4.0.beta3 → 1.4.0.beta4

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: 68edaa289dc4c510306d76867d0f5d539fe3bd17
4
- data.tar.gz: cc2252c9fa076ba8c7fa652153b443a3dd705069
3
+ metadata.gz: 58a5d16ef8141dcf32194249d9afbb1d29d06312
4
+ data.tar.gz: dcde482a1c83a91a02d9f37362c103ab2d888315
5
5
  SHA512:
6
- metadata.gz: f859cb8ea9a253b3a11f66cd3ea37c6584546eb8916f130e3742b7d84e39a7e7b8f11dd4114c5173eb270ee4c97218c3ca62d7bce456f8d875639074395a1d50
7
- data.tar.gz: 70bf1d4ad2a9b3023a0e430fec9beb9a16d6e89b4f46d2b0509370a92471d94e415dfdac674f6088a49935afe74cad126c794c6191c57275bb88190e5f5d25df
6
+ metadata.gz: 4acdba7e9612ea93fd2db5d509fd57ce984946ec43c96bc686687a342c16b0522c11eb27fe52cccc869f6e16ff641b1312b7d4447dbbc421f9daa8bf4a97bee9
7
+ data.tar.gz: dc263654dc2b42635616c7eaf72cfaea45abb0c69612326275ea85415590f7228a5b68813cb52525a9da82e0598ed088ef2c371fff5fd1cc4d9dc08f9f278d04
@@ -7,125 +7,117 @@ require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_dateTime')
7
7
  # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_locale')
8
8
 
9
9
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module SbJson
13
-
14
- module MetadataInfo
15
-
16
- def self.unpack(hMetadata, responseObj, intObj)
17
-
18
- # return nil object if input is empty
19
- intMetadataInfo = nil
20
- return if hMetadata.empty?
21
-
22
- # instance classes needed in script
23
- intMetadataClass = InternalMetadata.new
24
- intMetadataInfo = intMetadataClass.newMetadataInfo
25
- hMetadataInfo = hMetadata
26
-
27
- # metadata - metadata identifier
28
- if hMetadataInfo.has_key?('id')
29
- hMetadataId = hMetadataInfo['id']
30
- unless hMetadataId.empty?
31
- rId = intMetadataClass.newResourceId
32
- rId[:identifier] = hMetadataId
33
- rId[:identifierType] = 'uuid'
34
- rId[:identifierNamespace] = 'gov.sciencebase.catalog'
35
- rId[:identifierDescription] = 'The unique ScienceBase id of the resource.'
36
- intMetadataInfo[:metadataId] = rId
37
- end
38
- end
39
-
40
- # metadata - parent metadata identifier
41
- if hMetadataInfo.has_key?('parentId')
42
- hParentId = hMetadataInfo['parentId']
43
- hParent = intMetadataClass.newCitation
44
- hParent[:citTitle] = 'Parent Metadata identifier'
45
- pId = intMetadataClass.newResourceId
46
- pId[:identifier] = hParentId
47
- pId[:identifierType] = 'uuid'
48
- pId[:identifierNamespace] = 'gov.sciencebase.catalog'
49
- pId[:identifierDescription] = 'The unique ScienceBase id of the parent resource.'
50
- hParent[:citResourceIds] << pId
51
- pParty = intMetadataClass.newRespParty
52
- pParty[:contactId] = 'SB'
53
- pParty[:roleName] = 'originator'
54
- hParent[:citResponsibleParty] << pParty
55
-
56
- unless hParent.empty?
57
- intMetadataInfo[:parentMetadata] = hParent
58
- end
59
- end
60
-
61
- # metadata - metadata contacts, custodians
62
- # We're just injecting the first sbJSON contact here
63
- firstCont = intObj[:contacts][0]
64
- aCust = {}
65
- aCust['contactId'] = firstCont[:contactId]
66
- aCust['role'] = firstCont[:sbType]
67
- intMetadataInfo[:metadataCustodians] << ResponsibleParty.unpack(aCust, responseObj)
68
-
69
- # metadata - creation date
70
- if hMetadataInfo.has_key?('provenance')
71
- s = hMetadataInfo['provenance']['dateCreated']
72
- if s != ''
73
- hDateTime = DateTime.unpack(s, responseObj)
74
- hDateTime[:dateType] = 'creation'
75
- intMetadataInfo[:metadataCreateDate] = hDateTime
76
- end
77
- end
78
-
79
- # metadata - date of last metadata update
80
- if hMetadataInfo.has_key?('provenance')
81
- s = hMetadataInfo['provenance']['lastUpdated']
82
- if s != ''
83
- hDateTime = DateTime.unpack(s, responseObj)
84
- hDateTime[:dateType] = 'lastUpdate'
85
- intMetadataInfo[:metadataUpdateDate] = hDateTime
86
- end
87
- end
88
-
89
- # metadata - characterSet - default 'utf8'
90
- intMetadataInfo[:metadataCharacterSet] = 'utf8'
91
-
92
- # metadata - locale
93
- intLocale = intMetadataClass.newLocale
94
- intLocale[:languageCode] = 'eng'
95
- intLocale[:countryCode] = 'USA'
96
- intLocale[:characterEncoding] = 'UTF-8'
97
- intMetadataInfo[:metadataLocales] << intLocale
98
-
99
-
100
- # metadata - metadata URI
101
- intMetadataInfo[:metadataURI] = 'https://www.sciencebase.gov/catalog/item/' + hMetadataInfo['id']
102
-
103
- # metadata - status
104
- # if hMetadataInfo.has_key?('metadataStatus')
105
- # s = hMetadataInfo['metadataStatus']
106
- # if s != ''
107
- # intMetadataInfo[:metadataStatus] = s
108
- # end
109
- # end
110
-
111
- # metadata - metadata maintenance info
112
- intResMaint = intMetadataClass.newResourceMaint
113
-
114
- # resource maintenance - frequency code
115
- intResMaint[:maintFreq] = 'asNeeded'
116
-
117
- # resource maintenance - contact
118
- intResMaint[:maintContacts] << intMetadataInfo[:metadataCustodians][0]
119
-
120
- intMetadataInfo[:maintInfo] = intResMaint
121
-
122
- return intMetadataInfo
123
-
124
- end
125
-
126
- end
10
+ module Mdtranslator
11
+ module Readers
12
+ module SbJson
13
+ module MetadataInfo
14
+ def self.unpack(hMetadata, responseObj, intObj)
15
+ # return nil object if input is empty
16
+ intMetadataInfo = nil
17
+ return if hMetadata.empty?
18
+
19
+ # instance classes needed in script
20
+ intMetadataClass = InternalMetadata.new
21
+ intMetadataInfo = intMetadataClass.newMetadataInfo
22
+ hMetadataInfo = hMetadata
23
+
24
+ # metadata - metadata identifier
25
+ if hMetadataInfo.key?('id')
26
+ hMetadataId = hMetadataInfo['id']
27
+ unless hMetadataId.empty?
28
+ rId = intMetadataClass.newResourceId
29
+ rId[:identifier] = hMetadataId
30
+ rId[:identifierType] = 'uuid'
31
+ rId[:identifierNamespace] = 'gov.sciencebase.catalog'
32
+ rId[:identifierDescription] = 'The unique ScienceBase id of the resource.'
33
+ intMetadataInfo[:metadataId] = rId
34
+ end
35
+ end
36
+
37
+ # metadata - parent metadata identifier
38
+ if hMetadataInfo.key?('parentId')
39
+ hParentId = hMetadataInfo['parentId']
40
+ hParent = intMetadataClass.newCitation
41
+ hParent[:citTitle] = 'Parent Metadata identifier'
42
+ pId = intMetadataClass.newResourceId
43
+ pId[:identifier] = hParentId
44
+ pId[:identifierType] = 'uuid'
45
+ pId[:identifierNamespace] = 'gov.sciencebase.catalog'
46
+ pId[:identifierDescription] = 'The unique ScienceBase id of the parent resource.'
47
+ hParent[:citResourceIds] << pId
48
+ pParty = intMetadataClass.newRespParty
49
+ pParty[:contactId] = 'SB'
50
+ pParty[:roleName] = 'originator'
51
+ hParent[:citResponsibleParty] << pParty
52
+
53
+ intMetadataInfo[:parentMetadata] = hParent unless hParent.empty?
54
+ end
127
55
 
56
+ # metadata - metadata contacts, custodians
57
+ # We're just injecting the first sbJSON contact here
58
+ firstCont = intObj[:contacts][0]
59
+ aCust = {}
60
+ aCust['contactId'] = firstCont[:contactId]
61
+ aCust['role'] = firstCont[:sbType]
62
+ intMetadataInfo[:metadataCustodians] << ResponsibleParty.unpack(aCust, responseObj)
63
+
64
+ # metadata - creation date
65
+ if hMetadataInfo.key?('provenance')
66
+ s = hMetadataInfo['provenance']['dateCreated']
67
+ if s != ''
68
+ hDateTime = DateTime.unpack(s, responseObj)
69
+ hDateTime[:dateType] = 'creation'
70
+ intMetadataInfo[:metadataCreateDate] = hDateTime
71
+ end
128
72
  end
73
+
74
+ # metadata - date of last metadata update
75
+ if hMetadataInfo.key?('provenance')
76
+ s = hMetadataInfo['provenance']['lastUpdated']
77
+ if s != ''
78
+ hDateTime = DateTime.unpack(s, responseObj)
79
+ hDateTime[:dateType] = 'lastUpdate'
80
+ intMetadataInfo[:metadataUpdateDate] = hDateTime
81
+ end
82
+ end
83
+
84
+ # metadata - characterSet - default 'utf8'
85
+ intMetadataInfo[:metadataCharacterSet] = 'utf8'
86
+
87
+ # metadata - locale
88
+ intLocale = intMetadataClass.newLocale
89
+ intLocale[:languageCode] = 'eng'
90
+ intLocale[:countryCode] = 'USA'
91
+ intLocale[:characterEncoding] = 'UTF-8'
92
+ intMetadataInfo[:metadataLocales] << intLocale
93
+
94
+ # metadata - metadata URI
95
+ intMetadataInfo[:metadataURI] = 'https://www.sciencebase.gov/catalog/item/' +
96
+ hMetadataInfo['id'] unless hMetadataInfo['id'].nil?
97
+
98
+ # metadata - status
99
+ # if hMetadataInfo.has_key?('metadataStatus')
100
+ # s = hMetadataInfo['metadataStatus']
101
+ # if s != ''
102
+ # intMetadataInfo[:metadataStatus] = s
103
+ # end
104
+ # end
105
+
106
+ # metadata - metadata maintenance info
107
+ intResMaint = intMetadataClass.newResourceMaint
108
+
109
+ # resource maintenance - frequency code
110
+ intResMaint[:maintFreq] = 'asNeeded'
111
+
112
+ # resource maintenance - contact
113
+ intResMaint[:maintContacts] << intMetadataInfo[:metadataCustodians][0]
114
+
115
+ intMetadataInfo[:maintInfo] = intResMaint
116
+
117
+ intMetadataInfo
118
+ end
129
119
  end
120
+ end
130
121
  end
122
+ end
131
123
  end
@@ -61,6 +61,6 @@
61
61
  module ADIWG
62
62
  module Mdtranslator
63
63
  # current mdtranslator version
64
- VERSION = "1.4.0.beta3"
64
+ VERSION = "1.4.0.beta4"
65
65
  end
66
66
  end
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: 1.4.0.beta3
4
+ version: 1.4.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith