datacite-mapping 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGES.md +8 -1
- data/README.md +1 -1
- data/lib/datacite/mapping/contributor.rb +3 -0
- data/lib/datacite/mapping/date.rb +3 -0
- data/lib/datacite/mapping/geo_location_polygon.rb +4 -4
- data/lib/datacite/mapping/identifier.rb +3 -3
- data/lib/datacite/mapping/module_info.rb +2 -2
- data/lib/datacite/mapping/publisher.rb +16 -1
- data/lib/datacite/mapping/related_identifier.rb +37 -1
- data/lib/datacite/mapping/related_item.rb +226 -0
- data/lib/datacite/mapping/resource.rb +12 -0
- data/lib/datacite/mapping/resource_type.rb +57 -0
- data/lib/datacite/mapping/subject.rb +4 -0
- data/spec/spec_helper.rb +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 370ed14bb82380efcbf6786213d3be379df734d5922af601d9b0db6116577d00
|
|
4
|
+
data.tar.gz: 645f09ba29266c3c9614d4ff5c37c90755259b48a8027c882da4ef2906efe7a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d214d5e04f36c80ffde982f85e02b5d2663bb1e5ffcf71f5010d7d86c050917cc3c300caa9c99e03577de894ef5bd7a0320f5a3135ad4257b17b1b00e569015a
|
|
7
|
+
data.tar.gz: 989fb22bb7c733a72ea7625b9628b6203326fb205c142a3b4739e51e7162174782b6c58d561e15c3c3e7e459e1d3e95795bdd3e17464ee483c667904c2aa6378
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.3.7
|
data/CHANGES.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
## 0.
|
|
1
|
+
## 0.6.0 (7 April 2026)
|
|
2
|
+
- Update to Ruby 3.3.7
|
|
3
|
+
- Datacite 4.7 support:
|
|
4
|
+
- Added the new elements and attributes introduced in DataCite 4.4, 4.5, 4.6, and 4.7.
|
|
5
|
+
- Reading from XML still supports any version of the DataCite schema from 3.0 through 4.7.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 0.5.0 (14 March 2023)
|
|
2
9
|
- Update to Ruby 3.0.4
|
|
3
10
|
- Update to Rubocop 0.93
|
|
4
11
|
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ based on [xml-mapping](http://multi-io.github.io/xml-mapping/) and
|
|
|
10
10
|
[xml-mapping_extensions](https://github.com/dmolesUC3/xml-mapping_extensions).
|
|
11
11
|
Full API documentation on [RubyDoc.info](http://www.rubydoc.info/github/CDLUC3/datacite-mapping/master/frames).
|
|
12
12
|
|
|
13
|
-
Supports [Datacite 4.
|
|
13
|
+
Supports [Datacite 4.7](https://datacite-metadata-schema.readthedocs.io/en/4.7); backward-compatible with
|
|
14
14
|
[Datacite 3.1](https://schema.labs.datacite.org/meta/kernel-3/).
|
|
15
15
|
|
|
16
16
|
Note that although this gem maintains compatibility with multiple
|
|
@@ -70,6 +70,9 @@ module Datacite
|
|
|
70
70
|
# @!parse SUPERVISOR = Supervisor
|
|
71
71
|
new :SUPERVISOR, 'Supervisor'
|
|
72
72
|
|
|
73
|
+
# @!parse TRANSLATOR = Translator
|
|
74
|
+
new :TRANSLATOR, 'Translator'
|
|
75
|
+
|
|
73
76
|
# @!parse WORK_PACKAGE_LEADER = WorkPackageLeader
|
|
74
77
|
new :WORK_PACKAGE_LEADER, 'WorkPackageLeader'
|
|
75
78
|
|
|
@@ -43,15 +43,15 @@ module Datacite
|
|
|
43
43
|
# # @return [Array<GeoLocationPoint>] an array of points defining the polygon area.
|
|
44
44
|
array_node :points, 'polygonPoint',
|
|
45
45
|
default_value: [],
|
|
46
|
-
marshaller:
|
|
47
|
-
unmarshaller:
|
|
46
|
+
marshaller: proc { |xml, value| marshal_point(xml, value) },
|
|
47
|
+
unmarshaller: proc { |xml| unmarshal_point(xml) }
|
|
48
48
|
|
|
49
49
|
# # @!attribute [rw] in_polygon_point
|
|
50
50
|
# # @return [InPolygonPoint] a point within the target polygon
|
|
51
51
|
object_node :in_polygon_point, 'inPolygonPoint',
|
|
52
52
|
default_value: nil,
|
|
53
|
-
marshaller:
|
|
54
|
-
unmarshaller:
|
|
53
|
+
marshaller: proc { |xml, value| marshal_point(xml, value) },
|
|
54
|
+
unmarshaller: proc { |xml| unmarshal_point(xml) }
|
|
55
55
|
|
|
56
56
|
use_mapping :datacite_3
|
|
57
57
|
|
|
@@ -38,7 +38,7 @@ module Datacite
|
|
|
38
38
|
# @param new_value [String]
|
|
39
39
|
# the identifier type (always 'DOI')
|
|
40
40
|
def identifier_type=(new_value)
|
|
41
|
-
raise ArgumentError, "Identifier type '#{new_value}' must be 'DOI'" unless
|
|
41
|
+
raise ArgumentError, "Identifier type '#{new_value}' must be 'DOI'" unless new_value == DOI
|
|
42
42
|
|
|
43
43
|
@identifier_type = new_value
|
|
44
44
|
end
|
|
@@ -68,12 +68,12 @@ module Datacite
|
|
|
68
68
|
class IdentifierNode < XML::Mapping::ObjectNode
|
|
69
69
|
include EmptyNodeUtils
|
|
70
70
|
def xml_to_obj(_obj, xml)
|
|
71
|
-
|
|
71
|
+
super if (element = element?(xml)) && not_empty(element)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
private
|
|
75
75
|
|
|
76
|
-
def
|
|
76
|
+
def element?(xml)
|
|
77
77
|
@path.first(xml)
|
|
78
78
|
rescue XML::XXPathError
|
|
79
79
|
false
|
|
@@ -6,9 +6,9 @@ module Datacite
|
|
|
6
6
|
NAME = 'datacite-mapping'
|
|
7
7
|
|
|
8
8
|
# The version of this gem
|
|
9
|
-
VERSION = '0.
|
|
9
|
+
VERSION = '0.6.0'
|
|
10
10
|
|
|
11
11
|
# The copyright notice for this gem
|
|
12
|
-
COPYRIGHT = 'Copyright (c)
|
|
12
|
+
COPYRIGHT = 'Copyright (c) 2026 Dryad'
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -12,8 +12,11 @@ module Datacite
|
|
|
12
12
|
# Initializes a new {Publisher}
|
|
13
13
|
# @param language [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language.
|
|
14
14
|
# @param value [String] name of the publisher
|
|
15
|
-
def initialize(value:, language: nil)
|
|
15
|
+
def initialize(value:, language: nil, identifier: nil, identifier_scheme: nil, scheme_uri: nil)
|
|
16
16
|
self.language = language
|
|
17
|
+
self.identifier = identifier
|
|
18
|
+
self.identifier_scheme = identifier_scheme
|
|
19
|
+
self.scheme_uri = scheme_uri
|
|
17
20
|
self.value = value
|
|
18
21
|
end
|
|
19
22
|
|
|
@@ -32,6 +35,18 @@ module Datacite
|
|
|
32
35
|
# @return [String] an IETF BCP 47, ISO 639-1 language code identifying the language.
|
|
33
36
|
text_node :language, '@xml:lang', default_value: nil
|
|
34
37
|
|
|
38
|
+
# @!attribute [rw] identifier
|
|
39
|
+
# @return [String, nil] The publisher identifier. Optional.
|
|
40
|
+
text_node :identifier, '@publisherIdentifier', default_value: nil
|
|
41
|
+
|
|
42
|
+
# @!attribute [rw] identifier_scheme
|
|
43
|
+
# @return [String, nil] The scheme for the publisher identifier. Optional.
|
|
44
|
+
text_node :identifier_scheme, '@publisherIdentifierScheme', default_value: nil
|
|
45
|
+
|
|
46
|
+
# @!attribute [rw] scheme_uri
|
|
47
|
+
# @return [URI, nil] the URI of the identifier scheme. Optional.
|
|
48
|
+
uri_node :scheme_uri, '@schemeURI', default_value: nil
|
|
49
|
+
|
|
35
50
|
# @!attribute [rw] value
|
|
36
51
|
# @return [String] the title itself.
|
|
37
52
|
text_node :value, 'text()'
|
|
@@ -107,6 +107,24 @@ module Datacite
|
|
|
107
107
|
# @!parse REQUIRES = Requires
|
|
108
108
|
new :REQUIRES, 'Requires'
|
|
109
109
|
|
|
110
|
+
# @!parse IS_PUBLISHED_IN = IsPublishedIn
|
|
111
|
+
new :IS_PUBLISHED_IN, 'IsPublishedIn'
|
|
112
|
+
|
|
113
|
+
# @!parse IS_COLLECTED_BY = IsCollectedBy
|
|
114
|
+
new :IS_COLLECTED_BY, 'IsCollectedBy'
|
|
115
|
+
|
|
116
|
+
# @!parse COLLECTS = Collects
|
|
117
|
+
new :COLLECTS, 'Collects'
|
|
118
|
+
|
|
119
|
+
# @!parse HAS_TRANSLATION = HasTranslation
|
|
120
|
+
new :HAS_TRANSLATION, 'HasTranslation'
|
|
121
|
+
|
|
122
|
+
# @!parse IS_TRANSLATION_OF = IsTranslationOf
|
|
123
|
+
new :IS_TRANSLATION_OF, 'IsTranslationOf'
|
|
124
|
+
|
|
125
|
+
# @!parse OTHER = Other
|
|
126
|
+
new :OTHER, 'Other'
|
|
127
|
+
|
|
110
128
|
end
|
|
111
129
|
|
|
112
130
|
# Controlled list of related identifier types.
|
|
@@ -120,6 +138,9 @@ module Datacite
|
|
|
120
138
|
# @!parse BIBCODE = bibcode
|
|
121
139
|
new :BIBCODE, 'bibcode'
|
|
122
140
|
|
|
141
|
+
# @!parse CSTR = CSTR
|
|
142
|
+
new :CSTR, 'CSTR'
|
|
143
|
+
|
|
123
144
|
# @!parse DOI = DOI
|
|
124
145
|
new :DOI, 'DOI'
|
|
125
146
|
|
|
@@ -153,6 +174,15 @@ module Datacite
|
|
|
153
174
|
# @!parse PURL = PURL
|
|
154
175
|
new :PURL, 'PURL'
|
|
155
176
|
|
|
177
|
+
# @!parse RAID = RAiD
|
|
178
|
+
new :RAID, 'RAiD'
|
|
179
|
+
|
|
180
|
+
# @!parse RRID = RRID
|
|
181
|
+
new :RRID, 'RRID'
|
|
182
|
+
|
|
183
|
+
# @!parse SWHID = SWHID
|
|
184
|
+
new :SWHID, 'SWHID'
|
|
185
|
+
|
|
156
186
|
# @!parse UPC = UPC
|
|
157
187
|
new :UPC, 'UPC'
|
|
158
188
|
|
|
@@ -198,13 +228,15 @@ module Datacite
|
|
|
198
228
|
|
|
199
229
|
# Initializes a new {RelatedIdentifier}.
|
|
200
230
|
# @param relation_type [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
|
|
231
|
+
# @param relation_type_information [String] additional information about the selected [RelationType], if appropriate.
|
|
201
232
|
# @param value [String] the identifier value. Cannot be nil.
|
|
202
233
|
# @param identifier_type [RelatedIdentifierType] the type of the related identifier. Cannot be nil.
|
|
203
234
|
# @param related_metadata_scheme [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
204
235
|
# @param scheme_uri [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
205
236
|
# @param scheme_type [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
206
|
-
def initialize(relation_type:, value:, identifier_type:, related_metadata_scheme: nil, scheme_uri: nil, scheme_type: nil)
|
|
237
|
+
def initialize(relation_type:, value:, identifier_type:, relation_type_information: nil, related_metadata_scheme: nil, scheme_uri: nil, scheme_type: nil)
|
|
207
238
|
self.relation_type = relation_type
|
|
239
|
+
self.relation_type_information = relation_type_information
|
|
208
240
|
self.value = value
|
|
209
241
|
self.identifier_type = identifier_type
|
|
210
242
|
self.related_metadata_scheme = related_metadata_scheme
|
|
@@ -236,6 +268,10 @@ module Datacite
|
|
|
236
268
|
# @return [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
|
|
237
269
|
typesafe_enum_node :relation_type, '@relationType', class: RelationType
|
|
238
270
|
|
|
271
|
+
# @!attribute [rw] relation_type_information
|
|
272
|
+
# @return [String, nil] Additional information about the selected relationType, if appropriate. Recommended for use with the relationType Other.
|
|
273
|
+
text_node :relation_type_information, '@rrelationTypeInformation', default_value: nil
|
|
274
|
+
|
|
239
275
|
# @!attribute [rw] value
|
|
240
276
|
# @return [String] the identifier value. Cannot be nil.
|
|
241
277
|
text_node :value, 'text()'
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'xml/mapping_extensions'
|
|
4
|
+
require 'datacite/mapping/creator'
|
|
5
|
+
require 'datacite/mapping/title'
|
|
6
|
+
require 'datacite/mapping/contributor'
|
|
7
|
+
require 'datacite/mapping/publisher'
|
|
8
|
+
|
|
9
|
+
module Datacite
|
|
10
|
+
module Mapping
|
|
11
|
+
|
|
12
|
+
class NumberType < TypesafeEnum::Base
|
|
13
|
+
# @!parse ARTICLE = Article
|
|
14
|
+
new :ARTICLE, 'Article'
|
|
15
|
+
|
|
16
|
+
# @!parse CHAPTER = Chapter
|
|
17
|
+
new :CHAPTER, 'Chapter'
|
|
18
|
+
|
|
19
|
+
# @!parse REPORT = Report
|
|
20
|
+
new :REPORT, 'Report'
|
|
21
|
+
|
|
22
|
+
# @!parse OTHER = Other
|
|
23
|
+
new :OTHER, 'Other'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @param number_type [identifierType] the type of the related identifier. Cannot be nil.
|
|
27
|
+
class Number
|
|
28
|
+
include XML::Mapping
|
|
29
|
+
|
|
30
|
+
def initialize(value:, number_type:)
|
|
31
|
+
self.value = value
|
|
32
|
+
self.number_type = number_type
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
root_element_name 'number'
|
|
36
|
+
|
|
37
|
+
# @!attribute [rw] number_type
|
|
38
|
+
# @return [NumberType] the type of the related item’s number, e.g., report number or article number.
|
|
39
|
+
typesafe_enum_node :number_type, '@numberType', class: NumberType
|
|
40
|
+
|
|
41
|
+
# @!attribute [rw] value
|
|
42
|
+
# @return [String] the identifier value. Cannot be nil.
|
|
43
|
+
text_node :value, 'text()'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
47
|
+
|
|
48
|
+
# @param identifier_type [identifierType] the type of the related identifier. Cannot be nil.
|
|
49
|
+
# @param related_metadata_scheme [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
50
|
+
# @param scheme_uri [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
51
|
+
# @param scheme_type [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
52
|
+
class RelatedItemIdentifier
|
|
53
|
+
include XML::Mapping
|
|
54
|
+
|
|
55
|
+
def initialize(value:, identifier_type:, related_metadata_scheme: nil, scheme_uri: nil, scheme_type: nil)
|
|
56
|
+
self.value = value
|
|
57
|
+
self.identifier_type = identifier_type
|
|
58
|
+
self.related_metadata_scheme = related_metadata_scheme
|
|
59
|
+
self.scheme_uri = scheme_uri
|
|
60
|
+
self.scheme_type = scheme_type
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def value=(value)
|
|
64
|
+
raise ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
|
|
65
|
+
|
|
66
|
+
@value = value
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def identifier_type=(value)
|
|
70
|
+
raise ArgumentError, 'Identifier type cannot be empty or nil' unless value
|
|
71
|
+
|
|
72
|
+
@identifier_type = value
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
root_element_name 'relatedItemIdentifier'
|
|
76
|
+
|
|
77
|
+
# @!attribute [rw] value
|
|
78
|
+
# @return [String] the identifier value. Cannot be nil.
|
|
79
|
+
text_node :value, 'text()'
|
|
80
|
+
|
|
81
|
+
# @!attribute [rw] identifier_type
|
|
82
|
+
# @return [RelatedIdentifierType] the type of the related identifier. Cannot be nil.
|
|
83
|
+
typesafe_enum_node :identifier_type, '@relatedItemIdentifierType', class: RelatedIdentifierType
|
|
84
|
+
|
|
85
|
+
# @!attribute [rw] related_metadata_scheme
|
|
86
|
+
# @return [String, nil] the name of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
87
|
+
text_node :related_metadata_scheme, '@relatedMetadataScheme', default_value: nil
|
|
88
|
+
|
|
89
|
+
# @!attribute [rw] scheme_uri
|
|
90
|
+
# @return [URI, nil] the URI of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
91
|
+
uri_node :scheme_uri, '@schemeURI', default_value: nil
|
|
92
|
+
|
|
93
|
+
# @!attribute [rw] scheme_type
|
|
94
|
+
# @return [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
|
|
95
|
+
text_node :scheme_type, '@schemeType', default_value: nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Information about a resource related to the one being registered.
|
|
99
|
+
class RelatedItem
|
|
100
|
+
include XML::Mapping
|
|
101
|
+
|
|
102
|
+
attr_writer :related_item_identifier, :creators, :number
|
|
103
|
+
|
|
104
|
+
# Initializes a new {RelatedItem}.
|
|
105
|
+
# @param relation_type [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
|
|
106
|
+
# @param relation_type_information [String] additional information about the selected [RelationType], if appropriate.
|
|
107
|
+
# @param value [String] the identifier value. Cannot be nil.
|
|
108
|
+
# @param identifier_type [RelatedItemType] the type of the related identifier. Cannot be nil.
|
|
109
|
+
def initialize(relation_type:, related_item_type:, titles:, relation_type_information: nil, related_item_identifier: nil, creators: [], publication_year: nil, volume: nil, issue: nil, number: nil, first_page: nil, last_page: nil, edition: nil, publisher: nil, contributors: [])
|
|
110
|
+
self.relation_type = relation_type
|
|
111
|
+
self.related_item_type = related_item_type
|
|
112
|
+
self.relation_type_information = relation_type_information
|
|
113
|
+
self.related_item_identifier = related_item_identifier
|
|
114
|
+
self.creators = creators
|
|
115
|
+
self.titles = titles
|
|
116
|
+
self.publication_year = publication_year
|
|
117
|
+
self.volume = volume
|
|
118
|
+
self.issue = issue
|
|
119
|
+
self.number = number
|
|
120
|
+
self.first_page = first_page
|
|
121
|
+
self.last_page = last_page
|
|
122
|
+
self.publisher = publisher
|
|
123
|
+
self.edition = edition
|
|
124
|
+
self.contributors = contributors
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def relation_type=(value)
|
|
128
|
+
raise ArgumentError, 'Relation type cannot be nil' unless value
|
|
129
|
+
|
|
130
|
+
@relation_type = value
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def related_item_type=(value)
|
|
134
|
+
raise ArgumentError, 'Identifier type cannot be empty or nil' unless value
|
|
135
|
+
|
|
136
|
+
@related_item_type = value
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def titles=(value)
|
|
140
|
+
raise ArgumentError, 'RelatedItem must have at least one title' unless value && !value.empty?
|
|
141
|
+
|
|
142
|
+
@titles = value
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def publication_year=(value)
|
|
146
|
+
raise ArgumentError, 'Resource must have a four-digit publication year' if value.present? && !value&.to_i&.between?(1000, 9999)
|
|
147
|
+
|
|
148
|
+
@publication_year = value.to_i
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# publisher can be entered as a string or a Publisher object, but it will be stored
|
|
152
|
+
# as a Publisher object
|
|
153
|
+
def publisher=(value)
|
|
154
|
+
@publisher = if value.is_a?(Publisher)
|
|
155
|
+
value
|
|
156
|
+
else
|
|
157
|
+
Publisher.new(value: value)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def contributors=(value)
|
|
162
|
+
@contributors = value || []
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
root_element_name 'relatedItem'
|
|
166
|
+
|
|
167
|
+
# @!attribute [rw] related_item_type
|
|
168
|
+
# @return [ResourceTypeGeneral] the general resource type
|
|
169
|
+
typesafe_enum_node :related_item_type, '@relatedItemType', class: ResourceTypeGeneral, default_value: nil
|
|
170
|
+
|
|
171
|
+
# @!attribute [rw] relation_type
|
|
172
|
+
# @return [RelationType] the relationship of the {Resource} to the related resource. Cannot be nil.
|
|
173
|
+
typesafe_enum_node :relation_type, '@relationType', class: RelationType
|
|
174
|
+
|
|
175
|
+
# @!attribute [rw] relation_type_information
|
|
176
|
+
# @return [String, nil] Additional information about the selected relationType, if appropriate. Recommended for use with the relationType Other.
|
|
177
|
+
text_node :relation_type_information, '@rrelationTypeInformation', default_value: nil
|
|
178
|
+
|
|
179
|
+
# @!attribute [rw] related_item_identifier
|
|
180
|
+
# @return [RelatedItemIdentifier, nil] the related item identifier
|
|
181
|
+
object_node :related_item_identifier, 'relatedItemIdentifier', class: RelatedItemIdentifier, default_value: nil
|
|
182
|
+
|
|
183
|
+
# @!attribute [rw] creators
|
|
184
|
+
# @return [Array<Creator>] the main researchers involved working on the data, or the authors of the publication in priority order.
|
|
185
|
+
array_node :creators, 'creators', 'creator', class: Creator
|
|
186
|
+
|
|
187
|
+
# @!attribute [rw] titles
|
|
188
|
+
# @return [Array<Title>] the names or titles by which a resource is known.
|
|
189
|
+
array_node :titles, 'titles', 'title', class: Title
|
|
190
|
+
|
|
191
|
+
# @!attribute [rw] volume
|
|
192
|
+
# @return [String] Volume of the related item.
|
|
193
|
+
text_node :volume, 'volume', default_value: nil
|
|
194
|
+
|
|
195
|
+
# @!attribute [rw] issue
|
|
196
|
+
# @return [String] Issue number or name of the related item.
|
|
197
|
+
text_node :issue, 'issue', default_value: nil
|
|
198
|
+
|
|
199
|
+
# @!attribute [rw] related_item_identifier
|
|
200
|
+
# @return [RelatedItemIdentifier, nil] the related item identifier
|
|
201
|
+
object_node :number, 'number', class: Number, default_value: nil
|
|
202
|
+
|
|
203
|
+
# @!attribute [rw] firstPage
|
|
204
|
+
# @return [String] First page of the resource within the related item, e.g., of the chapter, article, or conference paper in proceedings.
|
|
205
|
+
text_node :first_page, 'firstPage', default_value: nil
|
|
206
|
+
|
|
207
|
+
# @!attribute [rw] lastPage
|
|
208
|
+
# @return [String] Last page of the resource within the related item, e.g., of the chapter, article, or conference paper in proceedings.
|
|
209
|
+
text_node :last_page, 'lastPage', default_value: nil
|
|
210
|
+
|
|
211
|
+
# @!attribute [rw] publisher
|
|
212
|
+
# @return [Publisher] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
|
|
213
|
+
object_node :publisher, 'publisher', class: Publisher
|
|
214
|
+
|
|
215
|
+
# @!attribute [rw] edition
|
|
216
|
+
# @return [String] Edition of the related item.
|
|
217
|
+
text_node :edition, 'edition', default_value: nil
|
|
218
|
+
|
|
219
|
+
# @!attribute [rw] contributors
|
|
220
|
+
# @return [Array<Contributor>] institutions or persons responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
|
|
221
|
+
array_node :contributors, 'contributors', 'contributor', class: Contributor, default_value: []
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
225
|
+
end
|
|
226
|
+
end
|
|
@@ -13,6 +13,7 @@ require 'datacite/mapping/alternate_identifier'
|
|
|
13
13
|
require 'datacite/mapping/rights'
|
|
14
14
|
require 'datacite/mapping/geo_location'
|
|
15
15
|
require 'datacite/mapping/read_only_nodes'
|
|
16
|
+
require 'datacite/mapping/related_item'
|
|
16
17
|
|
|
17
18
|
module Datacite
|
|
18
19
|
module Mapping
|
|
@@ -76,6 +77,7 @@ module Datacite
|
|
|
76
77
|
self.resource_type = resource_type
|
|
77
78
|
self.alternate_identifiers = alternate_identifiers
|
|
78
79
|
self.related_identifiers = related_identifiers
|
|
80
|
+
self.related_items = related_items
|
|
79
81
|
self.sizes = sizes
|
|
80
82
|
self.formats = formats
|
|
81
83
|
self.version = version
|
|
@@ -152,6 +154,10 @@ module Datacite
|
|
|
152
154
|
@related_identifiers = value || []
|
|
153
155
|
end
|
|
154
156
|
|
|
157
|
+
def related_items=(value)
|
|
158
|
+
@related_items = value || []
|
|
159
|
+
end
|
|
160
|
+
|
|
155
161
|
def sizes=(value)
|
|
156
162
|
@sizes = value || []
|
|
157
163
|
end
|
|
@@ -233,6 +239,10 @@ module Datacite
|
|
|
233
239
|
# @return [Array<RelatedIdentifier>] identifiers of related resources.
|
|
234
240
|
array_node :related_identifiers, 'relatedIdentifiers', 'relatedIdentifier', class: RelatedIdentifier, default_value: []
|
|
235
241
|
|
|
242
|
+
# @!attribute [rw] related_items
|
|
243
|
+
# @return [Array<RelatedItems>] descriptions of related resources.
|
|
244
|
+
array_node :related_items, 'relatedItems', 'relatedItem', class: RelatedItem, default_value: []
|
|
245
|
+
|
|
236
246
|
# @!attribute [rw] sizes
|
|
237
247
|
# @return [Array<String>] unstructured size information about the resource.
|
|
238
248
|
array_node :sizes, 'sizes', 'size', class: String, default_value: []
|
|
@@ -305,6 +315,8 @@ module Datacite
|
|
|
305
315
|
|
|
306
316
|
read_only_array_node :funding_references, 'fundingReferences', 'fundingReference', class: FundingReference, default_value: [], warn_reason: '<fundingReferences/> not supported in Datacite 3'
|
|
307
317
|
|
|
318
|
+
read_only_array_node :related_items, 'relatedItems', 'relatedItem', class: RelatedItem, default_value: [], warn_reason: '<relatedItems/> not supported in Datacite 3'
|
|
319
|
+
|
|
308
320
|
fallback_mapping :datacite_3, :_default
|
|
309
321
|
end
|
|
310
322
|
|
|
@@ -10,30 +10,81 @@ module Datacite
|
|
|
10
10
|
# @!parse AUDIOVISUAL = Audiovisual
|
|
11
11
|
new :AUDIOVISUAL, 'Audiovisual'
|
|
12
12
|
|
|
13
|
+
# @!parse AWARD = Award
|
|
14
|
+
new :AWARD, 'Award'
|
|
15
|
+
|
|
16
|
+
# @!parse BOOK = Book
|
|
17
|
+
new :BOOK, 'Book'
|
|
18
|
+
|
|
19
|
+
# @!parse BOOK_CHAPTER = BookChapter
|
|
20
|
+
new :BOOK_CHAPTER, 'BookChapter'
|
|
21
|
+
|
|
13
22
|
# @!parse COLLECTION = Collection
|
|
14
23
|
new :COLLECTION, 'Collection'
|
|
15
24
|
|
|
25
|
+
# @!parse COMPUTATIONAL_NOTEBOOK = ComputationalNotebook
|
|
26
|
+
new :COMPUTATIONAL_NOTEBOOK, 'ComputationalNotebook'
|
|
27
|
+
|
|
28
|
+
# @!parse CONFERENCE_PAPER = ConferencePaper
|
|
29
|
+
new :CONFERENCE_PAPER, 'ConferencePaper'
|
|
30
|
+
|
|
31
|
+
# @!parse CONFERENCE_PROCEEDING = ConferenceProceeding
|
|
32
|
+
new :CONFERENCE_PROCEEDING, 'ConferenceProceeding'
|
|
33
|
+
|
|
16
34
|
# @!parse DATASET = Dataset
|
|
17
35
|
new :DATASET, 'Dataset'
|
|
18
36
|
|
|
19
37
|
# @!parse DATA_PAPER = DataPaper
|
|
20
38
|
new :DATA_PAPER, 'DataPaper'
|
|
21
39
|
|
|
40
|
+
# @!parse DISSERTATION = Dissertation
|
|
41
|
+
new :DISSERTATION, 'Dissertation'
|
|
42
|
+
|
|
22
43
|
# @!parse EVENT = Event
|
|
23
44
|
new :EVENT, 'Event'
|
|
24
45
|
|
|
25
46
|
# @!parse IMAGE = Image
|
|
26
47
|
new :IMAGE, 'Image'
|
|
27
48
|
|
|
49
|
+
# @!parse INSTRUMENT = Instrument
|
|
50
|
+
new :INSTRUMENT, 'Instrument'
|
|
51
|
+
|
|
52
|
+
# @!parse JOURNAL = Journal
|
|
53
|
+
new :JOURNAL, 'Journal'
|
|
54
|
+
|
|
55
|
+
# @!parse JOURNAL_ARTICLE = JournalArticle
|
|
56
|
+
new :JOURNAL_ARTICLE, 'JournalArticle'
|
|
57
|
+
|
|
28
58
|
# @!parse INTERACTIVE_RESOURCE = InteractiveResource
|
|
29
59
|
new :INTERACTIVE_RESOURCE, 'InteractiveResource'
|
|
30
60
|
|
|
31
61
|
# @!parse MODEL = Model
|
|
32
62
|
new :MODEL, 'Model'
|
|
33
63
|
|
|
64
|
+
# @!parse OUTPUT_MANAGEMENT_PLAN = OutputManagementPlan
|
|
65
|
+
new :OUTPUT_MANAGEMENT_PLAN, 'OutputManagementPlan'
|
|
66
|
+
|
|
67
|
+
# @!parse PEER_REVIEW = PeerReview
|
|
68
|
+
new :PEER_REVIEW, 'PeerReview'
|
|
69
|
+
|
|
34
70
|
# @!parse PHYSICAL_OBJECT = PhysicalObject
|
|
35
71
|
new :PHYSICAL_OBJECT, 'PhysicalObject'
|
|
36
72
|
|
|
73
|
+
# @!parse POSTER = Poster
|
|
74
|
+
new :POSTER, 'Poster'
|
|
75
|
+
|
|
76
|
+
# @!parse PREPRINT = Preprint
|
|
77
|
+
new :PREPRINT, 'Preprint'
|
|
78
|
+
|
|
79
|
+
# @!parse PRESENTATION = Presentation
|
|
80
|
+
new :PRESENTATION, 'Presentation'
|
|
81
|
+
|
|
82
|
+
# @!parse PROJECT = Project
|
|
83
|
+
new :PROJECT, 'Project'
|
|
84
|
+
|
|
85
|
+
# @!parse REPORT = Report
|
|
86
|
+
new :REPORT, 'Report'
|
|
87
|
+
|
|
37
88
|
# @!parse SERVICE = Service
|
|
38
89
|
new :SERVICE, 'Service'
|
|
39
90
|
|
|
@@ -43,6 +94,12 @@ module Datacite
|
|
|
43
94
|
# @!parse SOUND = Sound
|
|
44
95
|
new :SOUND, 'Sound'
|
|
45
96
|
|
|
97
|
+
# @!parse STANDARD = Standard
|
|
98
|
+
new :STANDARD, 'Standard'
|
|
99
|
+
|
|
100
|
+
# @!parse STUDY_REGISTRATION = StudyRegistration
|
|
101
|
+
new :STUDY_REGISTRATION, 'StudyRegistration'
|
|
102
|
+
|
|
46
103
|
# @!parse TEXT = Text
|
|
47
104
|
new :TEXT, 'Text'
|
|
48
105
|
|
|
@@ -44,6 +44,10 @@ module Datacite
|
|
|
44
44
|
# @return [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language.
|
|
45
45
|
text_node :language, '@xml:lang', default_value: nil
|
|
46
46
|
|
|
47
|
+
# @!attribute [rw] classification_code
|
|
48
|
+
# @return [String, nil] the classification code used for the subject term in the subject scheme.
|
|
49
|
+
text_node :classification_code, '@classificationCode', default_value: nil
|
|
50
|
+
|
|
47
51
|
# @!attribute [rw] value
|
|
48
52
|
# @return [String] the subject itself.
|
|
49
53
|
text_node :value, 'text()'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datacite-mapping
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Moles
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-04-07 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: typesafe_enum
|
|
@@ -235,6 +234,7 @@ files:
|
|
|
235
234
|
- lib/datacite/mapping/publisher.rb
|
|
236
235
|
- lib/datacite/mapping/read_only_nodes.rb
|
|
237
236
|
- lib/datacite/mapping/related_identifier.rb
|
|
237
|
+
- lib/datacite/mapping/related_item.rb
|
|
238
238
|
- lib/datacite/mapping/resource.rb
|
|
239
239
|
- lib/datacite/mapping/resource_type.rb
|
|
240
240
|
- lib/datacite/mapping/rights.rb
|
|
@@ -447,7 +447,6 @@ homepage: http://github.com/datacite-mapping
|
|
|
447
447
|
licenses:
|
|
448
448
|
- MIT
|
|
449
449
|
metadata: {}
|
|
450
|
-
post_install_message:
|
|
451
450
|
rdoc_options: []
|
|
452
451
|
require_paths:
|
|
453
452
|
- lib
|
|
@@ -462,8 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
462
461
|
- !ruby/object:Gem::Version
|
|
463
462
|
version: '0'
|
|
464
463
|
requirements: []
|
|
465
|
-
rubygems_version: 3.
|
|
466
|
-
signing_key:
|
|
464
|
+
rubygems_version: 3.6.3
|
|
467
465
|
specification_version: 4
|
|
468
466
|
summary: Parses and generates Datacite XML documents
|
|
469
467
|
test_files:
|