datacite-mapping 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +4 -0
- data/CHANGES.md +15 -0
- data/README.md +8 -3
- data/datacite-mapping.gemspec +2 -3
- data/lib/datacite/mapping.rb +1 -1
- data/lib/datacite/mapping/affiliation.rb +44 -0
- data/lib/datacite/mapping/alternate_identifier.rb +2 -0
- data/lib/datacite/mapping/contributor.rb +32 -6
- data/lib/datacite/mapping/contributor_name.rb +42 -0
- data/lib/datacite/mapping/creator.rb +39 -7
- data/lib/datacite/mapping/creator_name.rb +42 -0
- data/lib/datacite/mapping/date.rb +12 -0
- data/lib/datacite/mapping/date_value.rb +6 -0
- data/lib/datacite/mapping/description.rb +6 -2
- data/lib/datacite/mapping/empty_filtering_nodes.rb +1 -0
- data/lib/datacite/mapping/funding_reference.rb +14 -1
- data/lib/datacite/mapping/geo_location.rb +6 -1
- data/lib/datacite/mapping/geo_location_box.rb +5 -0
- data/lib/datacite/mapping/geo_location_node.rb +4 -2
- data/lib/datacite/mapping/geo_location_point.rb +3 -0
- data/lib/datacite/mapping/geo_location_polygon.rb +10 -1
- data/lib/datacite/mapping/identifier.rb +11 -9
- data/lib/datacite/mapping/module_info.rb +2 -2
- data/lib/datacite/mapping/name_identifier.rb +10 -6
- data/lib/datacite/mapping/name_type.rb +18 -0
- data/lib/datacite/mapping/publisher.rb +42 -0
- data/lib/datacite/mapping/read_only_nodes.rb +4 -0
- data/lib/datacite/mapping/related_identifier.rb +38 -1
- data/lib/datacite/mapping/resource.rb +25 -11
- data/lib/datacite/mapping/resource_type.rb +4 -0
- data/lib/datacite/mapping/rights.rb +33 -6
- data/lib/datacite/mapping/subject.rb +3 -2
- data/lib/datacite/mapping/title.rb +3 -2
- data/spec/data/datacite4/{datacite-example-Box_dateCollected_DataCollector-v4.0.xml → datacite-example-Box_dateCollected_DataCollector-v4.xml} +9 -11
- data/spec/data/datacite4/{datacite-example-GeoLocation-v4.0.xml → datacite-example-GeoLocation-v4.xml} +11 -10
- data/spec/data/datacite4/{datacite-example-HasMetadata-v4.0.xml → datacite-example-HasMetadata-v4.xml} +18 -13
- data/spec/data/datacite4/{datacite-example-ResearchGroup_Methods-v4.0.xml → datacite-example-ResearchGroup_Methods-v4.xml} +14 -12
- data/spec/data/datacite4/{datacite-example-ResourceTypeGeneral_Collection-v4.0.xml → datacite-example-ResourceTypeGeneral_Collection-v4.xml} +9 -9
- data/spec/data/datacite4/datacite-example-affiliation-v4.xml +114 -0
- data/spec/data/datacite4/{datacite-example-complicated-v4.0.xml → datacite-example-complicated-v4.xml} +14 -11
- data/spec/data/datacite4/datacite-example-datapaper-v4.xml +32 -0
- data/spec/data/datacite4/{datacite-example-dataset-v4.0.xml → datacite-example-dataset-v4.xml} +20 -14
- data/spec/data/datacite4/datacite-example-full-v4.xml +114 -0
- data/spec/data/datacite4/{datacite-example-fundingReference-v.4.0.xml → datacite-example-fundingReference-v4.xml} +16 -13
- data/spec/data/datacite4/datacite-example-polygon-advanced-v4.xml +141 -0
- data/spec/data/datacite4/datacite-example-polygon-v4.xml +161 -0
- data/spec/data/datacite4/{datacite-example-relationTypeIsIdenticalTo-v4.0.xml → datacite-example-relationTypeIsIdenticalTo-v4.xml} +17 -17
- data/spec/data/datacite4/datacite-example-software-v4.xml +66 -0
- data/spec/data/datacite4/{datacite-example-video-v4.0.xml → datacite-example-video-v4.xml} +7 -7
- data/spec/data/datacite4/{datacite-example-workflow-v4.0.xml → datacite-example-workflow-v4.xml} +13 -11
- data/spec/data/datacite4/metadata.xsd +102 -57
- data/spec/rspec_custom_matchers.rb +3 -0
- data/spec/unit/datacite/mapping/contributor_spec.rb +7 -1
- data/spec/unit/datacite/mapping/creator_spec.rb +9 -3
- data/spec/unit/datacite/mapping/resource_spec.rb +14 -17
- data/spec/unit/datacite/mapping/rights_spec.rb +0 -13
- metadata +42 -28
- data/spec/data/datacite4/datacite-example-full-v4.0.xml +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 735d8cc7ab80f9534cba40b1b46b38b15dc8124f4e0cd53bb1963c5b31b2a9c2
|
4
|
+
data.tar.gz: f052e557983ea3af4ea3c025db12daa93ad5e60253f3e427c0cfe1ee39277bf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21645ef65182b9800dd3657188d31dc38a2ce148a910853d667eacaebf20dd334bdcd2ee34c32b85dd5bfa8b681b47a9380b0ab600367af5750a39c80c4ddf35
|
7
|
+
data.tar.gz: 33c2ff60458e0c835c086b2eff99e5198b26e0783ef483444418cd74e98f715ff4f149534e979fa5f124044924f5ad781088021ca56ad867a0af5ae89fe8c286
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
Metrics/LineLength:
|
3
3
|
Enabled: False
|
4
4
|
|
5
|
+
# Disable parameter-length check; this is determined by the number of XML attributes defined in the DataCite schema
|
6
|
+
Metrics/ParameterLists:
|
7
|
+
Enabled: False
|
8
|
+
|
5
9
|
# Disable problematic module documentation check (see https://github.com/bbatsov/rubocop/issues/947)
|
6
10
|
Style/Documentation:
|
7
11
|
Enabled: false
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## 0.4.0 (12 November 2019
|
2
|
+
|
3
|
+
- Datacite 4.3 support:
|
4
|
+
- Added the new elements and attributes introduced in DataCite 4.1, 4.2, and 4.3.
|
5
|
+
- Updated sample DataCite XML documents to include the new examples introduced in DataCite 4.3.
|
6
|
+
- Reading from XML still supports any version of the DataCite schema from 3.0 through 4.3.
|
7
|
+
- Object mapping for some items was updated to use full objects instead of simple Strings
|
8
|
+
when the DataCite schema introduced more complicated structure. E.g., because ContributorName
|
9
|
+
can now include a nameType and an xml:lang, the simple "name" String in the Contributor object was
|
10
|
+
replaced with a ContributorName object, accessed through Contributor.contributor_name, while
|
11
|
+
Contributor.name is now a convenience method that allows access to the value as a String.
|
12
|
+
- These updates to the gem are fully backwards compatible with respect to the input/output XML, but some changes in the object
|
13
|
+
model were required to support the more complex XML. So ruby code that worked with version 0.3.0 will require minor updates to use
|
14
|
+
this version.
|
15
|
+
|
1
16
|
## 0.3.0 (2 January 2018)
|
2
17
|
|
3
18
|
- Update to Ruby 2.4.1
|
data/README.md
CHANGED
@@ -10,9 +10,14 @@ 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.3](https://schema.labs.datacite.org/meta/kernel-4.3/); backward-compatible with
|
14
14
|
[Datacite 3.1](https://schema.labs.datacite.org/meta/kernel-3/).
|
15
15
|
|
16
|
+
Note that although this gem maintains compatibility with multiple
|
17
|
+
versions of DataCite XML, changes to DataCite XML sometimes force
|
18
|
+
changes to the internal object model of the gem. So different versions
|
19
|
+
of this gem may require minor updates to how a part of the model is accessed.
|
20
|
+
|
16
21
|
## Usage
|
17
22
|
|
18
23
|
The core of the Datacite::Mapping library is the `Resource` class, corresponding to the root `<resource/>` element
|
@@ -37,13 +42,13 @@ Example:
|
|
37
42
|
require 'datacite/mapping'
|
38
43
|
include Datacite::Mapping
|
39
44
|
|
40
|
-
resource = Resource.load_from_file('datacite-example-full-v4.
|
45
|
+
resource = Resource.load_from_file('datacite-example-full-v4.3.xml')
|
41
46
|
# => #<Datacite::Mapping::Resource:0x007f97689e87a0 …
|
42
47
|
|
43
48
|
abstract = resource.descriptions.find { |d| d.type = DescriptionType::ABSTRACT }
|
44
49
|
# => #<Datacite::Mapping::Description:0x007f976aafa330 …
|
45
50
|
abstract.value
|
46
|
-
# => "XML example of all DataCite Metadata Schema v4.
|
51
|
+
# => "XML example of all DataCite Metadata Schema v4.3 properties."
|
47
52
|
```
|
48
53
|
|
49
54
|
Note that Datacite::Mapping uses the [TypesafeEnum](https://github.com/dmolesUC3/typesafe_enum) gem to represent controlled
|
data/datacite-mapping.gemspec
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
5
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
5
|
|
7
6
|
require 'uri'
|
8
7
|
require 'datacite/mapping/module_info'
|
9
8
|
|
10
|
-
Gem::Specification.new do |spec|
|
9
|
+
Gem::Specification.new do |spec|
|
11
10
|
spec.name = Datacite::Mapping::NAME
|
12
11
|
spec.version = Datacite::Mapping::VERSION
|
13
12
|
spec.authors = ['David Moles']
|
data/lib/datacite/mapping.rb
CHANGED
@@ -19,7 +19,7 @@ module Datacite
|
|
19
19
|
schema_location: 'http://schema.datacite.org/meta/kernel-4/metadata.xsd'
|
20
20
|
)
|
21
21
|
|
22
|
-
Dir.glob(File.expand_path('
|
22
|
+
Dir.glob(File.expand_path('mapping/*.rb', __dir__)).sort.each(&method(:require))
|
23
23
|
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xml/mapping'
|
4
|
+
require 'datacite/mapping/read_only_nodes'
|
5
|
+
|
6
|
+
module Datacite
|
7
|
+
module Mapping
|
8
|
+
class Affiliation
|
9
|
+
include XML::Mapping
|
10
|
+
|
11
|
+
def initialize(identifier: nil, identifier_scheme: nil, scheme_uri: nil, value:)
|
12
|
+
self.identifier = identifier
|
13
|
+
self.identifier_scheme = identifier_scheme
|
14
|
+
self.scheme_uri = scheme_uri
|
15
|
+
self.value = value
|
16
|
+
end
|
17
|
+
|
18
|
+
def value=(value)
|
19
|
+
new_value = value&.strip
|
20
|
+
raise ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
|
21
|
+
|
22
|
+
@value = new_value.strip
|
23
|
+
end
|
24
|
+
|
25
|
+
# @!attribute [rw] identifier
|
26
|
+
# @return [String, nil] The affiliation identifier. Optional.
|
27
|
+
text_node :identifier, '@affiliationIdentifier', default_value: nil
|
28
|
+
|
29
|
+
# @!attribute [rw] identifier_scheme
|
30
|
+
# @return [String, nil] The scheme for the affiliation identifier. Optional.
|
31
|
+
text_node :identifier_scheme, '@affiliationIdentifierScheme', default_value: nil
|
32
|
+
|
33
|
+
# @!attribute [rw] scheme_uri
|
34
|
+
# @return [URI, nil] the URI of the identifier scheme. Optional.
|
35
|
+
uri_node :scheme_uri, '@schemeURI', default_value: nil
|
36
|
+
|
37
|
+
# @!attribute [rw] value
|
38
|
+
# @return [String] the name itself.
|
39
|
+
text_node :value, 'text()'
|
40
|
+
|
41
|
+
fallback_mapping :datacite_3, :_default
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -22,6 +22,7 @@ module Datacite
|
|
22
22
|
# @param val [String] the identifier type
|
23
23
|
def type=(val)
|
24
24
|
raise ArgumentError, 'No identifier type provided' unless val
|
25
|
+
|
25
26
|
@type = val
|
26
27
|
end
|
27
28
|
|
@@ -29,6 +30,7 @@ module Datacite
|
|
29
30
|
# @param val [String] the value
|
30
31
|
def value=(val)
|
31
32
|
raise ArgumentError, 'No identifier value provided' unless val
|
33
|
+
|
32
34
|
@value = val
|
33
35
|
end
|
34
36
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'xml/mapping_extensions'
|
4
4
|
require 'datacite/mapping/name_identifier'
|
5
|
+
require 'datacite/mapping/contributor_name'
|
5
6
|
|
6
7
|
module Datacite
|
7
8
|
module Mapping
|
@@ -93,20 +94,45 @@ module Datacite
|
|
93
94
|
self.type = type
|
94
95
|
end
|
95
96
|
|
97
|
+
# name can be entered as a string or a ContributorName object, but it will be stored
|
98
|
+
# internally as a ContributorName object
|
96
99
|
def name=(value)
|
97
|
-
|
98
|
-
|
99
|
-
@
|
100
|
+
raise ArgumentError, 'Name cannot be empty or nil' unless value
|
101
|
+
|
102
|
+
@contributor_name = if value.is_a?(ContributorName)
|
103
|
+
value
|
104
|
+
else
|
105
|
+
ContributorName.new(value: value)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def contributor_name=(value)
|
110
|
+
raise ArgumentError, 'ContributorName cannot be empty or nil' unless value
|
111
|
+
|
112
|
+
@contributor_name = value
|
113
|
+
end
|
114
|
+
|
115
|
+
def name
|
116
|
+
@contributor_name&.value
|
100
117
|
end
|
101
118
|
|
102
119
|
def type=(value)
|
103
120
|
raise ArgumentError, 'Type cannot be nil' unless value
|
121
|
+
|
104
122
|
@type = value
|
105
123
|
end
|
106
124
|
|
107
125
|
# @!attribute [rw] name
|
108
|
-
# @return [String]
|
109
|
-
|
126
|
+
# @return [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil.
|
127
|
+
object_node :contributor_name, 'contributorName', class: ContributorName
|
128
|
+
|
129
|
+
# @!attribute [rw] given_name
|
130
|
+
# @return [String, nil] The given name of the creator. Optional.
|
131
|
+
text_node :given_name, 'givenName', default_value: nil
|
132
|
+
|
133
|
+
# @!attribute [rw] family_name
|
134
|
+
# @return [String, nil] The family name of the creator. Optional.
|
135
|
+
text_node :family_name, 'familyName', default_value: nil
|
110
136
|
|
111
137
|
# @!attribute [rw] identifier
|
112
138
|
# @return [NameIdentifier, nil] an identifier for the contributor. Optional.
|
@@ -114,7 +140,7 @@ module Datacite
|
|
114
140
|
|
115
141
|
# @!attribute [rw] affiliations
|
116
142
|
# @return [Array<String>] the contributor's affiliations. Defaults to an empty list.
|
117
|
-
array_node :affiliations, 'affiliation', class:
|
143
|
+
array_node :affiliations, 'affiliation', class: Affiliation, default_value: []
|
118
144
|
|
119
145
|
# @!attribute [rw] type
|
120
146
|
# @return [ContributorType] the contributor type. Cannot be nil.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xml/mapping'
|
4
|
+
require 'datacite/mapping/read_only_nodes'
|
5
|
+
require 'datacite/mapping/name_identifier'
|
6
|
+
require 'datacite/mapping/name_type'
|
7
|
+
|
8
|
+
module Datacite
|
9
|
+
module Mapping
|
10
|
+
class ContributorName
|
11
|
+
include XML::Mapping
|
12
|
+
def initialize(type: nil, language: nil, value:)
|
13
|
+
self.type = type
|
14
|
+
self.language = language
|
15
|
+
self.value = value
|
16
|
+
end
|
17
|
+
|
18
|
+
def language=(value)
|
19
|
+
@language = value&.strip
|
20
|
+
end
|
21
|
+
|
22
|
+
def value=(value)
|
23
|
+
new_value = value&.strip
|
24
|
+
raise ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
|
25
|
+
|
26
|
+
@value = new_value.strip
|
27
|
+
end
|
28
|
+
|
29
|
+
# @!attribute [rw] type
|
30
|
+
# @return [NameType, nil] the name type. Optional.
|
31
|
+
typesafe_enum_node :type, '@nameType', class: NameType, default_value: nil
|
32
|
+
|
33
|
+
# @!attribute [rw] language
|
34
|
+
# @return [String, nil] an IETF BCP 47, ISO 639-1 language code identifying the language.
|
35
|
+
text_node :language, '@xml:lang', default_value: nil
|
36
|
+
|
37
|
+
# @!attribute [rw] value
|
38
|
+
# @return [String] the name itself.
|
39
|
+
text_node :value, 'text()'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -3,9 +3,12 @@
|
|
3
3
|
require 'xml/mapping'
|
4
4
|
require 'datacite/mapping/read_only_nodes'
|
5
5
|
require 'datacite/mapping/name_identifier'
|
6
|
+
require 'datacite/mapping/creator_name'
|
7
|
+
require 'datacite/mapping/affiliation'
|
6
8
|
|
7
9
|
module Datacite
|
8
10
|
module Mapping
|
11
|
+
|
9
12
|
# The main researchers involved working on the data, or the authors of the publication in priority order.
|
10
13
|
class Creator
|
11
14
|
include XML::Mapping
|
@@ -15,7 +18,7 @@ module Datacite
|
|
15
18
|
# @param given_name [String, nil] The given name of the creator. Optional.
|
16
19
|
# @param given_name [String, nil] The family name of the creator. Optional.
|
17
20
|
# @param identifier [NameIdentifier, nil] An identifier for the creator. Optional.
|
18
|
-
# @param affiliations [Array<
|
21
|
+
# @param affiliations [Array<Affiliation>, nil] The creator's affiliations. Defaults to an empty list.
|
19
22
|
def initialize(name:, given_name: nil, family_name: nil, identifier: nil, affiliations: [])
|
20
23
|
self.name = name
|
21
24
|
self.given_name = given_name
|
@@ -24,10 +27,26 @@ module Datacite
|
|
24
27
|
self.affiliations = affiliations
|
25
28
|
end
|
26
29
|
|
30
|
+
# name can be entered as a string or a CreatorName object, but it will be stored
|
31
|
+
# internally as a CreatorName object
|
27
32
|
def name=(value)
|
28
|
-
|
29
|
-
|
30
|
-
@
|
33
|
+
raise ArgumentError, 'Name cannot be empty or nil' unless value
|
34
|
+
|
35
|
+
@creator_name = if value.is_a?(CreatorName)
|
36
|
+
value
|
37
|
+
else
|
38
|
+
CreatorName.new(value: value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def creator_name=(value)
|
43
|
+
raise ArgumentError, 'CreatorName cannot be empty or nil' unless value
|
44
|
+
|
45
|
+
@creator_name = value
|
46
|
+
end
|
47
|
+
|
48
|
+
def name
|
49
|
+
@creator_name&.value
|
31
50
|
end
|
32
51
|
|
33
52
|
def given_name=(value)
|
@@ -40,13 +59,26 @@ module Datacite
|
|
40
59
|
@family_name = new_value
|
41
60
|
end
|
42
61
|
|
62
|
+
# Affiliations can be entered as an array of Strings or an array of Affiliation objects,
|
63
|
+
# but will be stored internally as an array of Affiliation objects
|
43
64
|
def affiliations=(value)
|
44
|
-
@affiliations =
|
65
|
+
@affiliations = []
|
66
|
+
value&.each do |affil|
|
67
|
+
@affiliations << if affil.is_a?(Affiliation)
|
68
|
+
affil
|
69
|
+
else
|
70
|
+
Affiliation.new(value: affil)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def affiliation_names
|
76
|
+
@affiliations.map { |affil| affil&.value }
|
45
77
|
end
|
46
78
|
|
47
79
|
# @!attribute [rw] name
|
48
80
|
# @return [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil.
|
49
|
-
|
81
|
+
object_node :creator_name, 'creatorName', class: CreatorName
|
50
82
|
|
51
83
|
# @!attribute [rw] given_name
|
52
84
|
# @return [String, nil] The given name of the creator. Optional.
|
@@ -62,7 +94,7 @@ module Datacite
|
|
62
94
|
|
63
95
|
# @!attribute [rw] affiliations
|
64
96
|
# @return [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
|
65
|
-
array_node :affiliations, 'affiliation', class:
|
97
|
+
array_node :affiliations, 'affiliation', class: Affiliation, default_value: []
|
66
98
|
|
67
99
|
use_mapping :datacite_3
|
68
100
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xml/mapping'
|
4
|
+
require 'datacite/mapping/read_only_nodes'
|
5
|
+
require 'datacite/mapping/name_identifier'
|
6
|
+
require 'datacite/mapping/name_type'
|
7
|
+
|
8
|
+
module Datacite
|
9
|
+
module Mapping
|
10
|
+
class CreatorName
|
11
|
+
include XML::Mapping
|
12
|
+
def initialize(type: nil, language: nil, value:)
|
13
|
+
self.type = type
|
14
|
+
self.language = language
|
15
|
+
self.value = value
|
16
|
+
end
|
17
|
+
|
18
|
+
def language=(value)
|
19
|
+
@language = value&.strip
|
20
|
+
end
|
21
|
+
|
22
|
+
def value=(value)
|
23
|
+
new_value = value&.strip
|
24
|
+
raise ArgumentError, 'Value cannot be empty or nil' unless new_value && !new_value.empty?
|
25
|
+
|
26
|
+
@value = new_value.strip
|
27
|
+
end
|
28
|
+
|
29
|
+
# @!attribute [rw] type
|
30
|
+
# @return [NameType, nil] the name type. Optional.
|
31
|
+
typesafe_enum_node :type, '@nameType', class: NameType, default_value: nil
|
32
|
+
|
33
|
+
# @!attribute [rw] language
|
34
|
+
# @return [String] an IETF BCP 47, ISO 639-1 language code identifying the language.
|
35
|
+
text_node :language, '@xml:lang', default_value: nil
|
36
|
+
|
37
|
+
# @!attribute [rw] value
|
38
|
+
# @return [String] the name itself.
|
39
|
+
text_node :value, 'text()'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -27,6 +27,9 @@ module Datacite
|
|
27
27
|
# @!parse ISSUED = Issued
|
28
28
|
new :ISSUED, 'Issued'
|
29
29
|
|
30
|
+
# @!parse OTHER = Other
|
31
|
+
new :OTHER, 'Other'
|
32
|
+
|
30
33
|
# @!parse SUBMITTED = Submitted
|
31
34
|
new :SUBMITTED, 'Submitted'
|
32
35
|
|
@@ -36,6 +39,9 @@ module Datacite
|
|
36
39
|
# @!parse VALID = Valid
|
37
40
|
new :VALID, 'Valid'
|
38
41
|
|
42
|
+
# @!parse WITHDRAWN = Withdrawn
|
43
|
+
new :WITHDRAWN, 'Withdrawn'
|
44
|
+
|
39
45
|
end
|
40
46
|
|
41
47
|
# Represents a DataCite `<date/>` field, which can be a year, date (year-month-day or just year-month),
|
@@ -70,6 +76,7 @@ module Datacite
|
|
70
76
|
|
71
77
|
def type=(val)
|
72
78
|
raise ArgumentError, 'Date type cannot be nil' unless val
|
79
|
+
|
73
80
|
@type = val
|
74
81
|
end
|
75
82
|
|
@@ -89,6 +96,7 @@ module Datacite
|
|
89
96
|
|
90
97
|
def <=>(other)
|
91
98
|
return nil unless other.class == self.class
|
99
|
+
|
92
100
|
%i[date_value range_start range_end type].each do |v|
|
93
101
|
order = send(v) <=> other.send(v)
|
94
102
|
return order if order.nonzero?
|
@@ -108,6 +116,10 @@ module Datacite
|
|
108
116
|
# @return [DateType] the type of date. Cannot be nil.
|
109
117
|
typesafe_enum_node :type, '@dateType', class: DateType
|
110
118
|
|
119
|
+
# @!attribute [rw] date_information
|
120
|
+
# @return [String] information to clarify a date
|
121
|
+
text_node :date_information, '@dateInformation', default_value: nil
|
122
|
+
|
111
123
|
# @!method value
|
112
124
|
# @return [String] The value as a string. May be any [W3C DateTime format](http://www.w3.org/TR/NOTE-datetime).
|
113
125
|
text_node :value, 'text()'
|