datacite-mapping 0.2.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +27 -11
  3. data/.ruby-version +1 -1
  4. data/CHANGES.md +25 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE.md +1 -1
  7. data/README.md +10 -5
  8. data/Rakefile +5 -3
  9. data/datacite-mapping.gemspec +10 -9
  10. data/examples/reading.rb +1 -1
  11. data/examples/writing.rb +1 -0
  12. data/lib/datacite/mapping/affiliation.rb +44 -0
  13. data/lib/datacite/mapping/alternate_identifier.rb +6 -2
  14. data/lib/datacite/mapping/contributor.rb +35 -7
  15. data/lib/datacite/mapping/contributor_name.rb +42 -0
  16. data/lib/datacite/mapping/creator.rb +43 -9
  17. data/lib/datacite/mapping/creator_name.rb +42 -0
  18. data/lib/datacite/mapping/date.rb +17 -5
  19. data/lib/datacite/mapping/date_value.rb +10 -2
  20. data/lib/datacite/mapping/description.rb +10 -4
  21. data/lib/datacite/mapping/empty_filtering_nodes.rb +3 -0
  22. data/lib/datacite/mapping/funding_reference.rb +31 -10
  23. data/lib/datacite/mapping/geo_location.rb +8 -1
  24. data/lib/datacite/mapping/geo_location_box.rb +17 -10
  25. data/lib/datacite/mapping/geo_location_node.rb +12 -8
  26. data/lib/datacite/mapping/geo_location_point.rb +11 -6
  27. data/lib/datacite/mapping/geo_location_polygon.rb +13 -2
  28. data/lib/datacite/mapping/identifier.rb +18 -14
  29. data/lib/datacite/mapping/module_info.rb +5 -3
  30. data/lib/datacite/mapping/name_identifier.rb +12 -6
  31. data/lib/datacite/mapping/name_type.rb +18 -0
  32. data/lib/datacite/mapping/namespace_extensions.rb +2 -0
  33. data/lib/datacite/mapping/publisher.rb +42 -0
  34. data/lib/datacite/mapping/read_only_nodes.rb +9 -3
  35. data/lib/datacite/mapping/related_identifier.rb +43 -4
  36. data/lib/datacite/mapping/resource.rb +37 -21
  37. data/lib/datacite/mapping/resource_type.rb +7 -1
  38. data/lib/datacite/mapping/rights.rb +35 -6
  39. data/lib/datacite/mapping/subject.rb +7 -4
  40. data/lib/datacite/mapping/title.rb +7 -4
  41. data/lib/datacite/mapping.rb +3 -1
  42. data/spec/.rubocop.yml +3 -0
  43. data/spec/data/datacite4/{datacite-example-Box_dateCollected_DataCollector-v4.0.xml → datacite-example-Box_dateCollected_DataCollector-v4.xml} +9 -11
  44. data/spec/data/datacite4/{datacite-example-GeoLocation-v4.0.xml → datacite-example-GeoLocation-v4.xml} +11 -10
  45. data/spec/data/datacite4/{datacite-example-HasMetadata-v4.0.xml → datacite-example-HasMetadata-v4.xml} +18 -13
  46. data/spec/data/datacite4/{datacite-example-ResearchGroup_Methods-v4.0.xml → datacite-example-ResearchGroup_Methods-v4.xml} +14 -12
  47. data/spec/data/datacite4/{datacite-example-ResourceTypeGeneral_Collection-v4.0.xml → datacite-example-ResourceTypeGeneral_Collection-v4.xml} +9 -9
  48. data/spec/data/datacite4/datacite-example-affiliation-v4.xml +114 -0
  49. data/spec/data/datacite4/{datacite-example-complicated-v4.0.xml → datacite-example-complicated-v4.xml} +14 -11
  50. data/spec/data/datacite4/datacite-example-datapaper-v4.xml +32 -0
  51. data/spec/data/datacite4/{datacite-example-dataset-v4.0.xml → datacite-example-dataset-v4.xml} +20 -14
  52. data/spec/data/datacite4/datacite-example-full-v4.xml +114 -0
  53. data/spec/data/datacite4/{datacite-example-fundingReference-v.4.0.xml → datacite-example-fundingReference-v4.xml} +16 -13
  54. data/spec/data/datacite4/datacite-example-polygon-advanced-v4.xml +141 -0
  55. data/spec/data/datacite4/datacite-example-polygon-v4.xml +161 -0
  56. data/spec/data/datacite4/{datacite-example-relationTypeIsIdenticalTo-v4.0.xml → datacite-example-relationTypeIsIdenticalTo-v4.xml} +17 -17
  57. data/spec/data/datacite4/datacite-example-software-v4.xml +66 -0
  58. data/spec/data/datacite4/{datacite-example-video-v4.0.xml → datacite-example-video-v4.xml} +7 -7
  59. data/spec/data/datacite4/{datacite-example-workflow-v4.0.xml → datacite-example-workflow-v4.xml} +13 -11
  60. data/spec/data/datacite4/metadata.xsd +102 -57
  61. data/spec/rspec_custom_matchers.rb +11 -8
  62. data/spec/spec_helper.rb +2 -0
  63. data/spec/unit/datacite/mapping/alternate_identifier_spec.rb +2 -0
  64. data/spec/unit/datacite/mapping/contributor_spec.rb +9 -1
  65. data/spec/unit/datacite/mapping/creator_spec.rb +11 -3
  66. data/spec/unit/datacite/mapping/date_spec.rb +2 -0
  67. data/spec/unit/datacite/mapping/date_value_spec.rb +2 -0
  68. data/spec/unit/datacite/mapping/description_spec.rb +2 -0
  69. data/spec/unit/datacite/mapping/funding_reference_spec.rb +13 -1
  70. data/spec/unit/datacite/mapping/geo_location_box_spec.rb +2 -0
  71. data/spec/unit/datacite/mapping/geo_location_point_spec.rb +2 -0
  72. data/spec/unit/datacite/mapping/geo_location_polygon_spec.rb +22 -20
  73. data/spec/unit/datacite/mapping/geo_location_spec.rb +24 -22
  74. data/spec/unit/datacite/mapping/identifier_spec.rb +8 -6
  75. data/spec/unit/datacite/mapping/name_identifier_spec.rb +2 -0
  76. data/spec/unit/datacite/mapping/related_identifier_spec.rb +2 -0
  77. data/spec/unit/datacite/mapping/resource_spec.rb +34 -33
  78. data/spec/unit/datacite/mapping/rights_spec.rb +3 -14
  79. data/spec/unit/datacite/mapping/subject_spec.rb +2 -0
  80. data/spec/unit/datacite/mapping/title_spec.rb +2 -0
  81. metadata +74 -60
  82. data/spec/data/datacite4/datacite-example-full-v4.0.xml +0 -71
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping'
2
4
 
3
5
  module XML
@@ -20,18 +22,20 @@ module Datacite
20
22
 
21
23
  def value_str(val)
22
24
  return "[ #{val.map(&:to_s).join(', ')} ]" if val.is_a?(Array)
25
+
23
26
  "'#{val}'"
24
27
  end
25
28
 
26
29
  def obj_to_xml(obj, _xml)
27
30
  val = value_from(obj)
28
31
  return unless val
32
+
29
33
  warn_ignored(val)
30
34
  end
31
35
 
32
36
  def warn_ignored(val)
33
37
  warning = "ignoring #{@attrname} #{value_str(val)}"
34
- warning.prepend("#{warn_reason}; ") if warn_reason
38
+ warning = "#{warn_reason}; #{warning}" if warn_reason
35
39
  ReadOnlyNodes.warn(warning)
36
40
  end
37
41
 
@@ -43,8 +47,9 @@ module Datacite
43
47
 
44
48
  class ReadOnlyTextNode < XML::Mapping::TextNode
45
49
  def warn_ignored(val)
46
- fail ArgumentError, "Expected string, got #{val}" unless val.respond_to?(:strip)
50
+ raise ArgumentError, "Expected string, got #{val}" unless val.respond_to?(:strip)
47
51
  return if val.strip.empty?
52
+
48
53
  super
49
54
  end
50
55
  include ReadOnlyNodes
@@ -53,8 +58,9 @@ module Datacite
53
58
 
54
59
  class ReadOnlyArrayNode < XML::Mapping::ArrayNode
55
60
  def warn_ignored(val)
56
- fail ArgumentError, "Expected array, got #{val}" unless val.respond_to?(:empty?)
61
+ raise ArgumentError, "Expected array, got #{val}" unless val.respond_to?(:empty?)
57
62
  return if val.empty?
63
+
58
64
  super
59
65
  end
60
66
  include ReadOnlyNodes
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping_extensions'
4
+ require 'datacite/mapping/resource_type'
2
5
 
3
6
  module Datacite
4
7
  module Mapping
@@ -35,6 +38,12 @@ module Datacite
35
38
  # @!parse IS_PREVIOUS_VERSION_OF = IsPreviousVersionOf
36
39
  new :IS_PREVIOUS_VERSION_OF, 'IsPreviousVersionOf'
37
40
 
41
+ # @!parse HAS_VERSION = HasVersion
42
+ new :HAS_VERSION, 'HasVersion'
43
+
44
+ # @!parse IS_VERSION_OF = IsVersionOf
45
+ new :IS_VERSION_OF, 'IsVersionOf'
46
+
38
47
  # @!parse IS_PART_OF = IsPartOf
39
48
  new :IS_PART_OF, 'IsPartOf'
40
49
 
@@ -80,6 +89,24 @@ module Datacite
80
89
  # @!parse IS_SOURCE_OF = IsSourceOf
81
90
  new :IS_SOURCE_OF, 'IsSourceOf'
82
91
 
92
+ # @!parse IS_OBSOLETED_BY = IsObsoletedBy
93
+ new :IS_OBSOLETED_BY, 'IsObsoletedBy'
94
+
95
+ # @!parse OBSOLETES = Obsoletes
96
+ new :OBSOLETES, 'Obsoletes'
97
+
98
+ # @!parse IS_DESCRIBED_BY = IsDescribedBy
99
+ new :IS_DESCRIBED_BY, 'IsDescribedBy'
100
+
101
+ # @!parse DESCRIBES = Describes
102
+ new :DESCRIBES, 'Describes'
103
+
104
+ # @!parse IS_REQUIRED_BY = IsRequiredBy
105
+ new :IS_REQUIRED_BY, 'IsRequiredBy'
106
+
107
+ # @!parse REQUIRES = Requires
108
+ new :REQUIRES, 'Requires'
109
+
83
110
  end
84
111
 
85
112
  # Controlled list of related identifier types.
@@ -137,11 +164,15 @@ module Datacite
137
164
 
138
165
  # @!parse IGSN = IGSN
139
166
  new :IGSN, 'IGSN'
167
+
168
+ # @!parse W3ID = w3id
169
+ new :W3ID, 'w3id'
140
170
  end
141
171
 
142
172
  class Datacite3RidTypeNode < XML::MappingExtensions::TypesafeEnumNode
143
173
  def to_xml_text(enum_instance)
144
174
  return super unless enum_instance == RelatedIdentifierType::IGSN
175
+
145
176
  super(RelatedIdentifierType::HANDLE)
146
177
  end
147
178
  end
@@ -150,6 +181,7 @@ module Datacite
150
181
  class Datacite3RidValueNode < XML::Mapping::TextNode
151
182
  def obj_to_xml(obj, xml)
152
183
  return super unless obj.identifier_type == RelatedIdentifierType::IGSN
184
+
153
185
  igsn_value = obj.value
154
186
  handle_value = "10273/#{igsn_value}"
155
187
  # TODO: move this somewhere more general
@@ -171,7 +203,7 @@ module Datacite
171
203
  # @param related_metadata_scheme [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
172
204
  # @param scheme_uri [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
173
205
  # @param scheme_type [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
174
- def initialize(relation_type:, value:, identifier_type:, related_metadata_scheme: nil, scheme_uri: nil, scheme_type: nil) # rubocop:disable Metrics/ParameterLists
206
+ def initialize(relation_type:, value:, identifier_type:, related_metadata_scheme: nil, scheme_uri: nil, scheme_type: nil)
175
207
  self.relation_type = relation_type
176
208
  self.value = value
177
209
  self.identifier_type = identifier_type
@@ -181,17 +213,20 @@ module Datacite
181
213
  end
182
214
 
183
215
  def value=(value)
184
- fail ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
216
+ raise ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
217
+
185
218
  @value = value
186
219
  end
187
220
 
188
221
  def identifier_type=(value)
189
- fail ArgumentError, 'Identifier type cannot be empty or nil' unless value
222
+ raise ArgumentError, 'Identifier type cannot be empty or nil' unless value
223
+
190
224
  @identifier_type = value
191
225
  end
192
226
 
193
227
  def relation_type=(value)
194
- fail ArgumentError, 'Relation type cannot be nil' unless value
228
+ raise ArgumentError, 'Relation type cannot be nil' unless value
229
+
195
230
  @relation_type = value
196
231
  end
197
232
 
@@ -213,6 +248,10 @@ module Datacite
213
248
  # @return [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
214
249
  text_node :related_metadata_scheme, '@relatedMetadataScheme', default_value: nil
215
250
 
251
+ # @!attribute [rw] resource_type_general
252
+ # @return [ResourceTypeGeneral] the general resource type
253
+ typesafe_enum_node :resource_type_general, '@resourceTypeGeneral', class: ResourceTypeGeneral, default_value: nil
254
+
216
255
  # @!attribute [rw] scheme_uri
217
256
  # @return [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
218
257
  uri_node :scheme_uri, '@schemeURI', default_value: nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping_extensions'
2
4
 
3
5
  require 'datacite/mapping/identifier'
@@ -44,7 +46,7 @@ module Datacite
44
46
  # @param identifier [Identifier] a persistent identifier that identifies a resource.
45
47
  # @param creators [Array<Creator>] the main researchers involved working on the data, or the authors of the publication in priority order.
46
48
  # @param titles [Array<Title>] the names or titles by which a resource is known.
47
- # @param publisher [String] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
49
+ # @param publisher [Publisher] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
48
50
  # @param publication_year [Integer] year when the resource is made publicly available.
49
51
  # @param subjects [Array<Subject>] subjects, keywords, classification codes, or key phrases describing the resource.
50
52
  # @param funding_references [Array<FundingReference>] information about financial support (funding) for the resource being registered.
@@ -60,7 +62,7 @@ module Datacite
60
62
  # @param rights_list [Array<Rights>] rights information for this resource.
61
63
  # @param descriptions [Array<Description>] all additional information that does not fit in any of the other categories.
62
64
  # @param geo_locations [Array<GeoLocations>] spatial region or named place where the data was gathered or about which the data is focused.
63
- def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], contributors: [], dates: [], language: nil, funding_references: [], resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Metrics/AbcSize
65
+ def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], contributors: [], dates: [], language: nil, funding_references: [], resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
64
66
  self.identifier = identifier
65
67
  self.creators = creators
66
68
  self.titles = titles
@@ -91,33 +93,43 @@ module Datacite
91
93
  end
92
94
 
93
95
  def identifier=(value)
94
- fail ArgumentError, 'Resource must have an identifier' unless value
96
+ raise ArgumentError, 'Resource must have an identifier' unless value
97
+
95
98
  @identifier = value
96
99
  end
97
100
 
98
101
  def creators=(value)
99
- fail ArgumentError, 'Resource must have at least one creator' unless value && !value.empty?
102
+ raise ArgumentError, 'Resource must have at least one creator' unless value && !value.empty?
103
+
100
104
  @creators = value
101
105
  end
102
106
 
103
107
  def titles=(value)
104
- fail ArgumentError, 'Resource must have at least one title' unless value && !value.empty?
108
+ raise ArgumentError, 'Resource must have at least one title' unless value && !value.empty?
109
+
105
110
  @titles = value
106
111
  end
107
112
 
113
+ # publisher can be entered as a string or a Publisher object, but it will be stored
114
+ # as a Publisher object
108
115
  def publisher=(value)
109
- new_value = value && value.strip
110
- fail ArgumentError, 'Resource must have a publisher' unless new_value && !new_value.empty?
111
- @publisher = new_value.strip
116
+ raise ArgumentError, 'Publisher must have a value' unless value
117
+
118
+ @publisher = if value.is_a?(Publisher)
119
+ value
120
+ else
121
+ Publisher.new(value: value)
122
+ end
112
123
  end
113
124
 
114
125
  def publication_year=(value)
115
- fail ArgumentError, 'Resource must have a four-digit publication year' unless value && value.to_i.between?(1000, 9999)
126
+ raise ArgumentError, 'Resource must have a four-digit publication year' unless value&.to_i&.between?(1000, 9999)
127
+
116
128
  @publication_year = value.to_i
117
129
  end
118
130
 
119
131
  def subjects=(value)
120
- @subjects = (value && value.select(&:value)) || []
132
+ @subjects = (value&.select(&:value)) || []
121
133
  end
122
134
 
123
135
  def contributors=(value)
@@ -149,8 +161,8 @@ module Datacite
149
161
  end
150
162
 
151
163
  def version=(value)
152
- new_value = value && value.to_s
153
- @version = new_value && new_value.strip
164
+ new_value = value&.to_s
165
+ @version = new_value&.strip
154
166
  end
155
167
 
156
168
  def rights_list=(value)
@@ -158,11 +170,11 @@ module Datacite
158
170
  end
159
171
 
160
172
  def descriptions=(value)
161
- @descriptions = (value && value.select(&:value)) || []
173
+ @descriptions = (value&.select(&:value)) || []
162
174
  end
163
175
 
164
176
  def geo_locations=(value)
165
- @geo_locations = (value && value.select(&:location?)) || []
177
+ @geo_locations = (value&.select(&:location?)) || []
166
178
  end
167
179
 
168
180
  # @!attribute [rw] identifier
@@ -178,8 +190,12 @@ module Datacite
178
190
  array_node :titles, 'titles', 'title', class: Title
179
191
 
180
192
  # @!attribute [rw] publisher
181
- # @return [String] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
182
- text_node :publisher, 'publisher'
193
+ # @return [Publisher] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
194
+ object_node :publisher, 'publisher', class: Publisher
195
+
196
+ # @!attribute [rw] resource_type
197
+ # @return [ResourceType, nil] the type of the resource
198
+ object_node :resource_type, 'resourceType', class: ResourceType, default_value: nil
183
199
 
184
200
  # @!attribute [rw] publication_year
185
201
  # @return [Integer] year when the resource is made publicly available.
@@ -244,14 +260,14 @@ module Datacite
244
260
  # Convenience method to get the creators' names.
245
261
  # @return [[Array[String]] An array of the creators' names.
246
262
  def creator_names
247
- creators.map(&:name)
263
+ creators.map { |c| c&.creator_name&.value }
248
264
  end
249
265
 
250
266
  # Convenience method to get the creators' affiliations. (Bear in mind that each creator
251
267
  # can have multiple affiliations.)
252
268
  # @return [Array[Array[String]]] An array containing each creator's array of affiliations.
253
269
  def creator_affiliations
254
- creators.map(&:affiliations)
270
+ creators.map(&:affiliation_names)
255
271
  end
256
272
 
257
273
  # Convenience method to get the funding contributor.
@@ -264,19 +280,19 @@ module Datacite
264
280
  # @deprecated contributor type 'funder' is deprecated. Use {FundingReference} instead.
265
281
  # @return [String, nil] the name of the funding contributor, if any.
266
282
  def funder_name
267
- funder_contrib.name if funder_contrib
283
+ funder_contrib&.name
268
284
  end
269
285
 
270
286
  # Convenience method to get the funding contributor identifier.
271
287
  # @return [NameIdentifier, nil] the identifier of the funding contributor, if any.
272
288
  def funder_id
273
- funder_contrib.identifier if funder_contrib
289
+ funder_contrib&.identifier
274
290
  end
275
291
 
276
292
  # Convenience method to get the funding contributor identifier as a string.
277
293
  # @return [String, nil] the string value of the funding contributor's identifier, if any.
278
294
  def funder_id_value
279
- funder_id.value if funder_id
295
+ funder_id&.value
280
296
  end
281
297
 
282
298
  extend Gem::Deprecate
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping_extensions'
2
4
 
3
5
  module Datacite
@@ -14,6 +16,9 @@ module Datacite
14
16
  # @!parse DATASET = Dataset
15
17
  new :DATASET, 'Dataset'
16
18
 
19
+ # @!parse DATA_PAPER = DataPaper
20
+ new :DATA_PAPER, 'DataPaper'
21
+
17
22
  # @!parse EVENT = Event
18
23
  new :EVENT, 'Event'
19
24
 
@@ -62,7 +67,8 @@ module Datacite
62
67
  end
63
68
 
64
69
  def resource_type_general=(val)
65
- fail ArgumentError, 'General resource type cannot be nil' unless val
70
+ raise ArgumentError, 'General resource type cannot be nil' unless val
71
+
66
72
  @resource_type_general = val
67
73
  end
68
74
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping_extensions'
2
4
 
3
5
  module Datacite
@@ -10,24 +12,51 @@ module Datacite
10
12
  # Initializes a new {Rights} object
11
13
  #
12
14
  # @param uri [URI, nil] a URI for the license. Optional.
13
- # @param value [String] the rights statement. Cannot be empty or nil.
14
- def initialize(uri: nil, value:)
15
+ # @param identifier [String, nil] Optional.
16
+ # @param identifier_scheme [String, nil] Optional.
17
+ # @param scheme_url [URI, nil] Optional.
18
+ # @param language [String, nil] Optional.
19
+ # @param value [String] a rights statement.
20
+ def initialize(uri: nil, identifier: nil, identifier_scheme: nil, scheme_uri: nil, language: nil, value: nil)
15
21
  self.uri = uri
22
+ self.identifier = identifier
23
+ self.identifier_scheme = identifier_scheme
24
+ self.scheme_uri = scheme_uri
25
+ self.language = language
16
26
  self.value = value
17
27
  end
18
28
 
19
- def value=(v)
20
- fail ArgumentError, 'Value cannot be empty or nil' unless v && !v.empty?
21
- @value = v.strip
29
+ def language=(value)
30
+ @language = value&.strip
31
+ end
32
+
33
+ def value=(new_value)
34
+ @value = new_value&.strip
22
35
  end
23
36
 
24
37
  # @!attribute [rw] uri
25
38
  # @return [URI, nil] a URI for the license. Optional.
26
39
  uri_node :uri, '@rightsURI', default_value: nil
27
40
 
41
+ # @!attribute [rw] language
42
+ # @return [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language.
43
+ text_node :language, '@xml:lang', default_value: nil
44
+
45
+ # @!attribute [rw] identifier
46
+ # @return [String, nil] an identifier for the rights setting. Optional.
47
+ text_node :identifier, '@rightsIdentifier', default_value: nil
48
+
49
+ # @!attribute [rw] identifier_scheme
50
+ # @return [String, nil] an identifier for the rights scheme. Optional.
51
+ text_node :identifier_scheme, '@rightsIdentifierScheme', default_value: nil
52
+
53
+ # @!attribute [rw] scheme_uri
54
+ # @return [URI, nil] a URI for the rights scheme. Optional.
55
+ uri_node :scheme_uri, '@schemeURI', default_value: nil
56
+
28
57
  # @!attribute [rw] value
29
58
  # @return [String] the rights statement. Cannot be empty or nil.
30
- text_node :value, 'text()'
59
+ text_node :value, 'text()', default_value: nil
31
60
 
32
61
  fallback_mapping :datacite_3, :_default
33
62
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping'
2
4
 
3
5
  module Datacite
@@ -20,12 +22,13 @@ module Datacite
20
22
  end
21
23
 
22
24
  def language=(value)
23
- @language = value && value.strip
25
+ @language = value&.strip
24
26
  end
25
27
 
26
- def value=(v)
27
- new_value = v && v.strip
28
- fail ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
28
+ def value=(value)
29
+ new_value = value&.strip
30
+ raise ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
31
+
29
32
  @value = new_value
30
33
  end
31
34
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'xml/mapping_extensions'
2
4
 
3
5
  module Datacite
@@ -31,12 +33,13 @@ module Datacite
31
33
  end
32
34
 
33
35
  def language=(value)
34
- @language = value && value.strip
36
+ @language = value&.strip
35
37
  end
36
38
 
37
- def value=(v)
38
- new_value = v && v.strip
39
- fail ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
39
+ def value=(value)
40
+ new_value = value&.strip
41
+ raise ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
42
+
40
43
  @value = new_value.strip
41
44
  end
42
45
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logger'
2
4
  require 'rexml/formatters/transitive' # unaccountably, xml/mapping doesn't do this
3
5
  require 'xml/mapping_extensions'
@@ -17,7 +19,7 @@ module Datacite
17
19
  schema_location: 'http://schema.datacite.org/meta/kernel-4/metadata.xsd'
18
20
  )
19
21
 
20
- Dir.glob(File.expand_path('../mapping/*.rb', __FILE__)).sort.each(&method(:require))
22
+ Dir.glob(File.expand_path('mapping/*.rb', __dir__)).sort.each(&method(:require))
21
23
 
22
24
  end
23
25
  end
data/spec/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  inherit_from: ../.rubocop.yml
2
2
 
3
+ Metrics/BlockLength:
4
+ Enabled: false
5
+
3
6
  Metrics/MethodLength:
4
7
  Enabled: false
5
8
 
@@ -3,25 +3,23 @@
3
3
  <identifier identifierType="DOI">10.5072/DataCollector_dateCollected_geoLocationBox</identifier>
4
4
  <creators>
5
5
  <creator>
6
- <creatorName>Peach, A.</creatorName>
6
+ <creatorName nameType="Personal">Peach, A.</creatorName>
7
7
  </creator>
8
8
  </creators>
9
9
  <titles>
10
- <title>
11
- Temperature and Humidity in School Classrooms, Ponhook Lake, N.S., 1961-1962
12
- </title>
10
+ <title xml:lang="en">Temperature and Humidity in School Classrooms, Ponhook Lake, N.S., 1961-1962</title>
13
11
  </titles>
14
- <publisher>National Research Council Canada</publisher>
12
+ <publisher xml:lang="en">National Research Council Canada</publisher>
15
13
  <publicationYear>1963</publicationYear>
16
14
  <subjects>
17
- <subject schemeURI="http://lccn.loc.gov/sh85062931" subjectScheme="LCCN">Temperature</subject>
18
- <subject schemeURI="http://lccn.loc.gov/sh85133712" subjectScheme="LCCN">Humidity</subject>
19
- <subject schemeURI="http://lccn.loc.gov/sh88003345" subjectScheme="LCCN">Classrooms</subject>
20
- <subject>Ponhook Lake (N.S.)</subject>
15
+ <subject xml:lang="en" schemeURI="http://lccn.loc.gov/sh85062931" subjectScheme="LCCN">Temperature</subject>
16
+ <subject xml:lang="en" schemeURI="http://lccn.loc.gov/sh85133712" subjectScheme="LCCN">Humidity</subject>
17
+ <subject xml:lang="en" schemeURI="http://lccn.loc.gov/sh88003345" subjectScheme="LCCN">Classrooms</subject>
18
+ <subject xml:lang="en">Ponhook Lake (N.S.)</subject>
21
19
  </subjects>
22
20
  <contributors>
23
21
  <contributor contributorType="DataCollector">
24
- <contributorName>Pomegranate, B.</contributorName>
22
+ <contributorName nameType="Personal">Pomegranate, B.</contributorName>
25
23
  </contributor>
26
24
  </contributors>
27
25
  <dates>
@@ -33,7 +31,7 @@
33
31
  <size>10 p.</size>
34
32
  </sizes>
35
33
  <descriptions>
36
- <description descriptionType="Abstract">
34
+ <description xml:lang="en" descriptionType="Abstract">
37
35
  The Division has been taking records of temperatures and humidities in groups of houses at various locations in Canada over the past several years. This survey has more recently been extended to include schools. Records obtained from classrooms in
38
36
  six schools in Ponhook Lake, Nova Scotia from June 1, 1961-October 12, 1962 are now reported.
39
37
  </description>
@@ -3,32 +3,33 @@
3
3
  <identifier identifierType="DOI">10.5072/geoPointExample</identifier>
4
4
  <creators>
5
5
  <creator>
6
- <creatorName>Schumann, Kai</creatorName>
6
+ <creatorName nameType="Personal">Schumann, Kai</creatorName>
7
7
  </creator>
8
8
  <creator>
9
- <creatorName>Völker, David</creatorName>
9
+ <creatorName nameType="Personal">Völker, David</creatorName>
10
10
  </creator>
11
11
  <creator>
12
- <creatorName>Weinrebe, Wilhelm Reiber</creatorName>
12
+ <creatorName nameType="Personal">Weinrebe, Wilhelm Reiber</creatorName>
13
13
  </creator>
14
14
  </creators>
15
15
  <titles>
16
- <title>
16
+ <title xml:lang="en">
17
17
  Gridded results of swath bathymetric mapping of Disko Bay, Western Greenland, 2007-2008
18
18
  </title>
19
19
  </titles>
20
- <publisher>
20
+ <publisher xml:lang="en">
21
21
  PANGAEA - Data Publisher for Earth &amp; Environmental Science
22
22
  </publisher>
23
23
  <publicationYear>2011</publicationYear>
24
24
  <subjects>
25
- <subject subjectScheme="DDC">551 Geology, hydrology, meteorology</subject>
25
+ <subject xml:lang="en" subjectScheme="DDC">551 Geology, hydrology, meteorology</subject>
26
26
  </subjects>
27
27
  <contributors>
28
28
  <contributor contributorType="HostingInstitution">
29
- <contributorName>
29
+ <contributorName nameType="Organizational">
30
30
  IFM-GEOMAR Leibniz-Institute of Marine Sciences, Kiel University
31
31
  </contributorName>
32
+ <nameIdentifier nameIdentifierScheme="ROR" schemeURI="http://ror.org/">https://ror.org/02h2x0161</nameIdentifier>
32
33
  </contributor>
33
34
  </contributors>
34
35
  <language>en</language>
@@ -43,10 +44,10 @@
43
44
  <format>application/zip</format>
44
45
  </formats>
45
46
  <rightsList>
46
- <rights rightsURI="http://creativecommons.org/licenses/by/3.0/deed">Creative Commons Attribution 3.0 Unported</rights>
47
- </rightsList>
47
+ <rights xml:lang="en-US" schemeURI="https://spdx.org/licenses/" rightsIdentifierScheme="SPDX" rightsIdentifier="
48
+ CC-BY-3.0" rightsURI="http://creativecommons.org/licenses/by/3.0/deed">Creative Commons Attribution-NoDerivs 2.0 Generic</rights></rightsList>
48
49
  <descriptions>
49
- <description descriptionType="Abstract">
50
+ <description xml:lang="en" descriptionType="Abstract">
50
51
  A ship-based acoustic mapping campaign was conducted at the exit of Ilulissat Ice Fjord and in the sedimentary basin of Disko Bay to the west of the fjord mouth. Submarine landscape and sediment distribution patterns are interpreted in terms of
51
52
  glaciomarine facies types that are related to variations in the past position of the glacier front. In particular, asymmetric ridges that form a curved entity and a large sill at the fjord mouth may represent moraines hat depict at least two
52
53
  relatively stable positions of the ice front in the Disko Bay and at the fjord mouth. In this respect, Ilulissat Glacier shows prominent differences to the East Greenland Kangerlussuaq Glacier which is comparable in present size and present role for
@@ -3,24 +3,32 @@
3
3
  <identifier identifierType="DOI">10.5072/example</identifier>
4
4
  <creators>
5
5
  <creator>
6
- <creatorName>Mari, Bernard</creatorName>
6
+ <creatorName nameType="Personal">Mari, Bernard</creatorName>
7
+ <givenName>Bernard</givenName>
8
+ <familyName>Mari</familyName>
7
9
  </creator>
8
10
  <creator>
9
- <creatorName>Puissegur, Marie-Pierre</creatorName>
11
+ <creatorName nameType="Personal">Puissegur, Marie-Pierre</creatorName>
12
+ <givenName>Marie-Pierre</givenName>
13
+ <familyName>Puissegur</familyName>
10
14
  </creator>
11
15
  <creator>
12
- <creatorName>Barbry, Pascal</creatorName>
16
+ <creatorName nameType="Personal">Barbry, Pascal</creatorName>
17
+ <givenName>Pascal</givenName>
18
+ <familyName>Barbry</familyName>
13
19
  </creator>
14
20
  <creator>
15
- <creatorName>Lebrigand, Kevin</creatorName>
21
+ <creatorName nameType="Personal">Lebrigand, Kevin</creatorName>
22
+ <givenName>Kevin</givenName>
23
+ <familyName>Lebrigand</familyName>
16
24
  </creator>
17
25
  </creators>
18
26
  <titles>
19
- <title>
27
+ <title xml:lang="en">
20
28
  Identification of putative novel specific targets of mir-210 in A549 human adenocarcinoma cells
21
29
  </title>
22
30
  </titles>
23
- <publisher>
31
+ <publisher xml:lang="fr">
24
32
  Institut de Pharmacologie Moleculaire et Cellulaire (IPMC), CNRS UMR6097, Universite de Nice Sophia-Antipolis, 660 route des lucioles, 06560 Valbonne - Sophia-Antipolis, France
25
33
  </publisher>
26
34
  <publicationYear>2010</publicationYear>
@@ -33,10 +41,10 @@
33
41
  </subjects>
34
42
  <contributors>
35
43
  <contributor contributorType="HostingInstitution">
36
- <contributorName>INIST-CNRS</contributorName>
44
+ <contributorName xml:lang="fr" nameType="Organizational">INIST-CNRS</contributorName>
37
45
  </contributor>
38
46
  </contributors>
39
- <language>eng</language>
47
+ <language>en</language>
40
48
  <resourceType resourceTypeGeneral="Text">Experiment report</resourceType>
41
49
  <relatedIdentifiers>
42
50
  <relatedIdentifier relatedIdentifierType="URL" relatedMetadataScheme="ISA-Tab" relationType="HasMetadata" schemeType="Text" schemeURI="http://isatab.sourceforge.net/docs/ISA-TAB_release-candidate-1_v1.0_24nov08.pdf">http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE18695</relatedIdentifier>
@@ -49,12 +57,9 @@
49
57
  <format>PDF</format>
50
58
  </formats>
51
59
  <rightsList>
52
- <rights rightsURI="http://creativecommons.org/licenses/by-nc-nd/3.0/">
53
- Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
54
- </rights>
55
- </rightsList>
60
+ <rights xml:lang="en-US" schemeURI="https://spdx.org/licenses/" rightsIdentifierScheme="SPDX" rightsIdentifier="CC-BY-NC-ND-3.0" rightsURI="http://creativecommons.org/licenses/by-nc-nd/3.0/"/> </rightsList>
56
61
  <descriptions>
57
- <description descriptionType="Abstract">
62
+ <description xml:lang="en" descriptionType="Abstract">
58
63
  To identify putative novel specific targets of mir-210, we overexpressed miR-210 as well as miR-34a and a siRNA targeted against E2F3 in A549 human adenocarcinoma cells by transfecting them with synthetic pre-miRNAs or a synthetic negative pre-miRNA
59
64
  as control (miR-Neg). RNA samples were harvested at 48 hours post-transfection and 2 independent experiments performed in dye-swap: miR-210 versus miR-Neg ; miR-34a versus miR-Neg ; si-E2F3 versus miR-Neg ; si-control versus miR-Neg.
60
65
  </description>