datacite-mapping 0.4.1 → 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 +7 -1
- data/.ruby-version +1 -1
- data/CHANGES.md +12 -1
- data/README.md +1 -1
- data/datacite-mapping.gemspec +3 -1
- data/lib/datacite/mapping/affiliation.rb +1 -1
- data/lib/datacite/mapping/contributor.rb +4 -1
- data/lib/datacite/mapping/contributor_name.rb +1 -1
- data/lib/datacite/mapping/creator_name.rb +1 -1
- data/lib/datacite/mapping/date.rb +11 -6
- data/lib/datacite/mapping/date_value.rb +2 -11
- data/lib/datacite/mapping/description.rb +1 -1
- data/lib/datacite/mapping/funding_reference.rb +2 -2
- data/lib/datacite/mapping/geo_location_box.rb +6 -6
- data/lib/datacite/mapping/geo_location_node.rb +2 -3
- data/lib/datacite/mapping/geo_location_point.rb +6 -4
- data/lib/datacite/mapping/geo_location_polygon.rb +5 -5
- data/lib/datacite/mapping/identifier.rb +4 -4
- data/lib/datacite/mapping/module_info.rb +2 -2
- data/lib/datacite/mapping/name_identifier.rb +1 -1
- data/lib/datacite/mapping/publisher.rb +16 -1
- data/lib/datacite/mapping/read_only_nodes.rb +3 -0
- data/lib/datacite/mapping/related_identifier.rb +37 -1
- data/lib/datacite/mapping/related_item.rb +226 -0
- data/lib/datacite/mapping/resource.rb +15 -3
- data/lib/datacite/mapping/resource_type.rb +57 -0
- data/lib/datacite/mapping/subject.rb +5 -1
- data/lib/datacite/mapping/title.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/datacite/mapping/date_value_spec.rb +1 -1
- data/spec/unit/datacite/mapping/resource_spec.rb +108 -109
- metadata +5 -7
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Disable line-length check; it's too easy for the cure to be worse than the disease
|
|
2
|
-
|
|
2
|
+
Layout/LineLength:
|
|
3
3
|
Enabled: False
|
|
4
4
|
|
|
5
5
|
# Disable parameter-length check; this is determined by the number of XML attributes defined in the DataCite schema
|
|
@@ -42,3 +42,9 @@ Style/ClassAndModuleChildren:
|
|
|
42
42
|
Style/MixinUsage:
|
|
43
43
|
Exclude:
|
|
44
44
|
- 'examples/*'
|
|
45
|
+
|
|
46
|
+
Style/OptionalBooleanParameter:
|
|
47
|
+
Enabled: false
|
|
48
|
+
|
|
49
|
+
Naming/VariableNumber:
|
|
50
|
+
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.3.7
|
data/CHANGES.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
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)
|
|
9
|
+
- Update to Ruby 3.0.4
|
|
10
|
+
- Update to Rubocop 0.93
|
|
11
|
+
|
|
12
|
+
## 0.4.0 (12 November 2019)
|
|
2
13
|
|
|
3
14
|
- Datacite 4.3 support:
|
|
4
15
|
- Added the new elements and attributes introduced in DataCite 4.1, 4.2, and 4.3.
|
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
|
data/datacite-mapping.gemspec
CHANGED
|
@@ -16,9 +16,11 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
spec.license = 'MIT'
|
|
17
17
|
|
|
18
18
|
origin = `git config --get remote.origin.url`.chomp
|
|
19
|
-
origin_uri = origin.start_with?('http') ? URI(origin) : URI(origin.gsub(%r{git@([^:]+)(.com|.org)[
|
|
19
|
+
origin_uri = origin.start_with?('http') ? URI(origin) : URI(origin.gsub(%r{git@([^:]+)(.com|.org)[^/]+}, 'http://\1\2'))
|
|
20
20
|
spec.homepage = URI::HTTP.build(host: origin_uri.host, path: origin_uri.path.chomp('.git')).to_s
|
|
21
21
|
|
|
22
|
+
spec.required_ruby_version = '>= 3.0.0'
|
|
23
|
+
|
|
22
24
|
spec.files = `git ls-files -z`.split("\x0")
|
|
23
25
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
24
26
|
|
|
@@ -8,7 +8,7 @@ module Datacite
|
|
|
8
8
|
class Affiliation
|
|
9
9
|
include XML::Mapping
|
|
10
10
|
|
|
11
|
-
def initialize(identifier: nil, identifier_scheme: nil, scheme_uri: nil
|
|
11
|
+
def initialize(value:, identifier: nil, identifier_scheme: nil, scheme_uri: nil)
|
|
12
12
|
self.identifier = identifier
|
|
13
13
|
self.identifier_scheme = identifier_scheme
|
|
14
14
|
self.scheme_uri = scheme_uri
|
|
@@ -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
|
|
|
@@ -87,7 +90,7 @@ module Datacite
|
|
|
87
90
|
# @param identifier [NameIdentifier, nil] an identifier for the contributor. Optional.
|
|
88
91
|
# @param affiliations [Array<Affiliation>] the contributor's affiliations. Defaults to an empty list.
|
|
89
92
|
# @param type [ContributorType] the contributor type. Cannot be nil.
|
|
90
|
-
def initialize(name:, identifier: nil, affiliations: nil
|
|
93
|
+
def initialize(name:, type:, identifier: nil, affiliations: nil)
|
|
91
94
|
self.name = name
|
|
92
95
|
self.identifier = identifier
|
|
93
96
|
self.affiliations = affiliations || []
|
|
@@ -21,6 +21,9 @@ module Datacite
|
|
|
21
21
|
# @!parse COLLECTED = Collected
|
|
22
22
|
new :COLLECTED, 'Collected'
|
|
23
23
|
|
|
24
|
+
# @!parse COVERAGE = Coverage
|
|
25
|
+
new :COVERAGE, 'Coverage'
|
|
26
|
+
|
|
24
27
|
# @!parse CREATED = Created
|
|
25
28
|
new :CREATED, 'Created'
|
|
26
29
|
|
|
@@ -60,9 +63,7 @@ module Datacite
|
|
|
60
63
|
include Comparable
|
|
61
64
|
include XML::Mapping
|
|
62
65
|
|
|
63
|
-
attr_reader :date_value
|
|
64
|
-
attr_reader :range_start
|
|
65
|
-
attr_reader :range_end
|
|
66
|
+
attr_reader :date_value, :range_start, :range_end
|
|
66
67
|
|
|
67
68
|
# Initializes a new `Date`
|
|
68
69
|
#
|
|
@@ -80,12 +81,15 @@ module Datacite
|
|
|
80
81
|
@type = val
|
|
81
82
|
end
|
|
82
83
|
|
|
84
|
+
# rubocop:disable Metrics/MethodLength
|
|
85
|
+
|
|
83
86
|
def value=(val) # rubocop:disable Metrics/AbcSize
|
|
84
87
|
parts = val.to_s.split('/', -1) # negative limit so we don't drop trailing empty string
|
|
85
88
|
@date_value, @range_start, @range_end = nil
|
|
86
|
-
|
|
89
|
+
case parts.size
|
|
90
|
+
when 1
|
|
87
91
|
@date_value = DateValue.new(val)
|
|
88
|
-
|
|
92
|
+
when 2
|
|
89
93
|
@range_start, @range_end = parts.map(&:strip).map { |part| DateValue.new(part) unless part == '' }
|
|
90
94
|
# puts "#{val} -> [#{range_start}, #{range_end}]"
|
|
91
95
|
else
|
|
@@ -93,9 +97,10 @@ module Datacite
|
|
|
93
97
|
end
|
|
94
98
|
@value = date_value ? date_value.to_s : "#{range_start}/#{range_end}"
|
|
95
99
|
end
|
|
100
|
+
# rubocop:enable Metrics/MethodLength
|
|
96
101
|
|
|
97
102
|
def <=>(other)
|
|
98
|
-
return nil unless other.
|
|
103
|
+
return nil unless other.instance_of?(self.class)
|
|
99
104
|
|
|
100
105
|
%i[date_value range_start range_end type].each do |v|
|
|
101
106
|
order = send(v) <=> other.send(v)
|
|
@@ -25,16 +25,7 @@ module Datacite
|
|
|
25
25
|
class DateValue
|
|
26
26
|
include Comparable
|
|
27
27
|
|
|
28
|
-
attr_reader :year
|
|
29
|
-
attr_reader :month
|
|
30
|
-
attr_reader :day
|
|
31
|
-
attr_reader :hour
|
|
32
|
-
attr_reader :minute
|
|
33
|
-
attr_reader :sec
|
|
34
|
-
attr_reader :nsec
|
|
35
|
-
attr_reader :date
|
|
36
|
-
attr_reader :zone
|
|
37
|
-
attr_reader :iso_value
|
|
28
|
+
attr_reader :year, :month, :day, :hour, :minute, :sec, :nsec, :date, :zone, :iso_value
|
|
38
29
|
|
|
39
30
|
# Creates a new {DateValue}.
|
|
40
31
|
#
|
|
@@ -58,7 +49,7 @@ module Datacite
|
|
|
58
49
|
end
|
|
59
50
|
|
|
60
51
|
def <=>(other)
|
|
61
|
-
return nil unless other.
|
|
52
|
+
return nil unless other.instance_of?(self.class)
|
|
62
53
|
|
|
63
54
|
%i[year month day hour minute sec nsec].each do |v|
|
|
64
55
|
order = send(v) <=> other.send(v)
|
|
@@ -86,7 +86,7 @@ module Datacite
|
|
|
86
86
|
# @param type [DescriptionType] the description type.
|
|
87
87
|
# @param value [String] the description itself. See {Description} for notes on special
|
|
88
88
|
# handling of `<br/>` tags.
|
|
89
|
-
def initialize(
|
|
89
|
+
def initialize(type:, value:, language: nil)
|
|
90
90
|
self.language = language
|
|
91
91
|
self.type = type
|
|
92
92
|
self.value = value
|
|
@@ -27,7 +27,7 @@ module Datacite
|
|
|
27
27
|
|
|
28
28
|
# @param type [FunderIdentifierType] the identifier type. Cannot be nil.
|
|
29
29
|
# @param value [String] the identifier value. Cannot be nil.
|
|
30
|
-
def initialize(type:, scheme_uri: nil
|
|
30
|
+
def initialize(type:, value:, scheme_uri: nil)
|
|
31
31
|
self.type = type
|
|
32
32
|
self.scheme_uri = scheme_uri
|
|
33
33
|
self.value = value
|
|
@@ -65,7 +65,7 @@ module Datacite
|
|
|
65
65
|
class AwardNumber
|
|
66
66
|
include XML::Mapping
|
|
67
67
|
|
|
68
|
-
def initialize(uri: nil
|
|
68
|
+
def initialize(value:, uri: nil)
|
|
69
69
|
self.uri = uri
|
|
70
70
|
self.value = value
|
|
71
71
|
end
|
|
@@ -19,10 +19,7 @@ module Datacite
|
|
|
19
19
|
class GeoLocationBox
|
|
20
20
|
include Comparable
|
|
21
21
|
|
|
22
|
-
attr_reader :south_latitude
|
|
23
|
-
attr_reader :west_longitude
|
|
24
|
-
attr_reader :north_latitude
|
|
25
|
-
attr_reader :east_longitude
|
|
22
|
+
attr_reader :south_latitude, :west_longitude, :north_latitude, :east_longitude
|
|
26
23
|
|
|
27
24
|
# Initializes a new {GeoLocationBox}. The arguments can be provided
|
|
28
25
|
# either as a named-parameter hash, or as a list of four coordinates
|
|
@@ -51,7 +48,10 @@ module Datacite
|
|
|
51
48
|
def initialize(*args)
|
|
52
49
|
case args.length
|
|
53
50
|
when 1
|
|
54
|
-
|
|
51
|
+
raise ArgumentError, "Can't construct GeoLocationBox from arguments: #{args}" unless args[0].respond_to?(:keys)
|
|
52
|
+
|
|
53
|
+
init_from_hash(**args[0])
|
|
54
|
+
|
|
55
55
|
when 4
|
|
56
56
|
init_from_array(args)
|
|
57
57
|
else
|
|
@@ -99,7 +99,7 @@ module Datacite
|
|
|
99
99
|
# @return [Fixnum, nil] the sort order (-1, 0, or 1), or nil if `other` is not a
|
|
100
100
|
# {GeoLocationBox}
|
|
101
101
|
def <=>(other)
|
|
102
|
-
return nil unless other.
|
|
102
|
+
return nil unless other.instance_of?(self.class)
|
|
103
103
|
|
|
104
104
|
%i[south_latitude west_longitude north_latitude east_longitude].each do |c|
|
|
105
105
|
order = send(c) <=> other.send(c)
|
|
@@ -7,8 +7,7 @@ module Datacite
|
|
|
7
7
|
# Abstract superclass of GeoLocation parsing nodes
|
|
8
8
|
class GeoLocationNode < XML::Mapping::SingleAttributeNode
|
|
9
9
|
|
|
10
|
-
attr_reader :geom_class
|
|
11
|
-
attr_reader :coord_elements
|
|
10
|
+
attr_reader :geom_class, :coord_elements
|
|
12
11
|
|
|
13
12
|
def initialize(*args)
|
|
14
13
|
raise 'No geometry class provided' unless @geom_class
|
|
@@ -30,7 +29,7 @@ module Datacite
|
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
def set_attr_value(xml, value)
|
|
33
|
-
raise "Invalid value: expected #{geom_class} instance, was #{value || 'nil'}" unless value
|
|
32
|
+
raise "Invalid value: expected #{geom_class} instance, was #{value || 'nil'}" unless value.is_a?(geom_class)
|
|
34
33
|
|
|
35
34
|
element = @path.first(xml, ensure_created: true)
|
|
36
35
|
|
|
@@ -15,8 +15,7 @@ module Datacite
|
|
|
15
15
|
class GeoLocationPoint
|
|
16
16
|
include Comparable
|
|
17
17
|
|
|
18
|
-
attr_reader :latitude
|
|
19
|
-
attr_reader :longitude
|
|
18
|
+
attr_reader :latitude, :longitude
|
|
20
19
|
|
|
21
20
|
# Initializes a new {GeoLocationPoint}. The arguments can be provided
|
|
22
21
|
# either as a named-parameter hash, or as a pair of coordinates in the
|
|
@@ -31,7 +30,10 @@ module Datacite
|
|
|
31
30
|
def initialize(*args)
|
|
32
31
|
case args.length
|
|
33
32
|
when 1
|
|
34
|
-
|
|
33
|
+
raise ArgumentError, "Can't construct GeoLocationPoint from arguments: #{args}" unless args[0].respond_to?(:keys)
|
|
34
|
+
|
|
35
|
+
init_from_hash(**args[0])
|
|
36
|
+
|
|
35
37
|
when 2
|
|
36
38
|
init_from_array(args)
|
|
37
39
|
else
|
|
@@ -65,7 +67,7 @@ module Datacite
|
|
|
65
67
|
# @return [Fixnum, nil] the sort order (-1, 0, or 1), or nil if `other` is not a
|
|
66
68
|
# {GeoLocationPoint}
|
|
67
69
|
def <=>(other)
|
|
68
|
-
return nil unless other.
|
|
70
|
+
return nil unless other.instance_of?(self.class)
|
|
69
71
|
|
|
70
72
|
%i[latitude longitude].each do |c|
|
|
71
73
|
order = send(c) <=> other.send(c)
|
|
@@ -25,7 +25,7 @@ module Datacite
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def <=>(other)
|
|
28
|
-
return nil unless other.
|
|
28
|
+
return nil unless other.instance_of?(self.class)
|
|
29
29
|
|
|
30
30
|
points <=> other.points
|
|
31
31
|
end
|
|
@@ -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
|
|
|
@@ -5,7 +5,7 @@ require 'datacite/mapping/empty_filtering_nodes'
|
|
|
5
5
|
|
|
6
6
|
module Datacite
|
|
7
7
|
module Mapping
|
|
8
|
-
DOI_PATTERN = %r{10\.\S+/\S+}
|
|
8
|
+
DOI_PATTERN = %r{10\.\S+/\S+}
|
|
9
9
|
|
|
10
10
|
# The persistent identifier that identifies the resource.
|
|
11
11
|
#
|
|
@@ -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,7 +12,7 @@ module Datacite
|
|
|
12
12
|
# @param scheme [Scheme] the name identifier scheme. Cannot be nil.
|
|
13
13
|
# @param scheme_uri [URI, nil] the URI of the identifier scheme. Optional.
|
|
14
14
|
# @param value [String] the identifier value. Cannot be nil.
|
|
15
|
-
def initialize(scheme:, scheme_uri: nil
|
|
15
|
+
def initialize(scheme:, value:, scheme_uri: nil)
|
|
16
16
|
self.scheme = scheme
|
|
17
17
|
self.scheme_uri = scheme_uri
|
|
18
18
|
self.value = value
|
|
@@ -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(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()'
|
|
@@ -39,10 +39,13 @@ module Datacite
|
|
|
39
39
|
ReadOnlyNodes.warn(warning)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
42
43
|
# public to allow testing
|
|
43
44
|
def self.warn(warning)
|
|
44
45
|
super
|
|
45
46
|
end
|
|
47
|
+
|
|
48
|
+
# rubocop:enable Lint/UselessMethodDefinition
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
class ReadOnlyTextNode < XML::Mapping::TextNode
|
|
@@ -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()'
|