datacite-mapping 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/datacite/mapping/funding_reference.rb +97 -0
- data/lib/datacite/mapping/module_info.rb +1 -1
- data/lib/datacite/mapping/resource.rb +13 -5
- data/lib/datacite/mapping/rights.rb +28 -0
- data/spec/data/kernel-4.0/datacite-example-fundingReference-v.4.0.xml +59 -0
- data/spec/data/kernel-4.0/metadata.xsd +470 -0
- data/spec/unit/datacite/mapping/funding_reference_spec.rb +61 -0
- data/spec/unit/datacite/mapping/resource_spec.rb +22 -1
- data/spec/unit/datacite/mapping/rights_spec.rb +10 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4b979eb3cad19e98ca359c9512763ac9e866704
|
4
|
+
data.tar.gz: f9e8694c3d5377cea0e737cab6be8160637e8fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adec25ce6902203ae62f11ba7ac85f046128b0c4cf49f5d4fd55678a45759267e45b1c42a30b4f5bceb598ea02990e36f8936893d2b9e465198b991505ed791d
|
7
|
+
data.tar.gz: 5c30c3c926e0779bfb9f5fdb4acb31f8e6e2ab5e695959c64d6ad068bccfab035fb2a837aa76f5e702138035a02a9996c05c1c661c62bc2498ab030af4a2f6dd
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.1.17 (5 August 2016)
|
2
|
+
|
3
|
+
- Added experimental support for Datacite 4.0 `<fundingReference/>` tag
|
4
|
+
- Added convenience constants `Rights::CC_ZERO` and `Rights::CC_BY` for the
|
5
|
+
[CC0](https://creativecommons.org/publicdomain/zero/1.0/legalcode) public domain declaration
|
6
|
+
and [CC-BY](https://creativecommons.org/licenses/by/4.0/) Creative Commons Attribution License
|
7
|
+
|
1
8
|
## 0.1.16 (14 July 2016)
|
2
9
|
|
3
10
|
- Add new `:nonvalidating` mapping for less strict parsing of problem files.
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'xml/mapping_extensions'
|
2
|
+
|
3
|
+
module Datacite
|
4
|
+
module Mapping
|
5
|
+
|
6
|
+
class FunderIdentifierType < TypesafeEnum::Base
|
7
|
+
# @!parse ISNI = ISNI
|
8
|
+
new :ISNI, 'ISNI'
|
9
|
+
|
10
|
+
# @!parse GRID = GRID
|
11
|
+
new :GRID, 'GRID'
|
12
|
+
|
13
|
+
# @!parse CROSSREF_FUNDER = 'Crossref Funder ID'
|
14
|
+
new :CROSSREF_FUNDER_ID, 'Crossref Funder ID'
|
15
|
+
|
16
|
+
# @!parse OTHER = Other
|
17
|
+
new :OTHER, 'Other'
|
18
|
+
end
|
19
|
+
|
20
|
+
class FunderIdentifier
|
21
|
+
include XML::Mapping
|
22
|
+
|
23
|
+
# @param type [FunderIdentifierType] the identifier type. Cannot be nil.
|
24
|
+
# @param value [String] the identifier value. Cannot be nil.
|
25
|
+
def initialize(type:, value:)
|
26
|
+
self.type = type
|
27
|
+
self.value = value
|
28
|
+
end
|
29
|
+
|
30
|
+
def value=(value)
|
31
|
+
fail ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
|
32
|
+
@value = value
|
33
|
+
end
|
34
|
+
|
35
|
+
def type=(value)
|
36
|
+
fail ArgumentError, 'Type cannot be nil' unless value
|
37
|
+
@type = value
|
38
|
+
end
|
39
|
+
|
40
|
+
# @!attribute [rw] type
|
41
|
+
# @return [FunderIdentifierType] the identifier type. Cannot be nil.
|
42
|
+
typesafe_enum_node :type, '@funderIdentifierType', class: FunderIdentifierType
|
43
|
+
|
44
|
+
# @!attribute [rw] value
|
45
|
+
# @return [String] the identifier value. Cannot be nil.
|
46
|
+
text_node :value, 'text()'
|
47
|
+
end
|
48
|
+
|
49
|
+
class AwardNumber
|
50
|
+
include XML::Mapping
|
51
|
+
|
52
|
+
def initialize(uri: nil, value:)
|
53
|
+
self.uri = uri
|
54
|
+
self.value = value
|
55
|
+
end
|
56
|
+
|
57
|
+
def value=(value)
|
58
|
+
fail ArgumentError, 'Value cannot be empty or nil' unless value && !value.empty?
|
59
|
+
@value = value
|
60
|
+
end
|
61
|
+
|
62
|
+
# @!attribute [rw] uri
|
63
|
+
# @return [URI, nil] The URI leading to a page provided by the funder for more information about the award
|
64
|
+
uri_node :uri, '@awardURI', default_value: nil
|
65
|
+
|
66
|
+
# @!attribute [rw] value
|
67
|
+
# @return [String] the award number. Cannot be nil.
|
68
|
+
text_node :value, 'text()'
|
69
|
+
end
|
70
|
+
|
71
|
+
class FundingReference
|
72
|
+
include XML::Mapping
|
73
|
+
|
74
|
+
root_element_name 'fundingReference'
|
75
|
+
|
76
|
+
def initialize(name:, identifier: nil, award_number: nil, award_title: nil)
|
77
|
+
self.name = name
|
78
|
+
self.identifier = identifier
|
79
|
+
self.award_number = award_number
|
80
|
+
self.award_title = award_title
|
81
|
+
end
|
82
|
+
|
83
|
+
def award_number=(value)
|
84
|
+
if value.nil? || value.is_a?(AwardNumber)
|
85
|
+
@award_number = value
|
86
|
+
else
|
87
|
+
@award_number = AwardNumber.new(value: value.to_s)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
text_node :name, 'funderName'
|
92
|
+
object_node :identifier, 'funderIdentifier', class: FunderIdentifier, default_value: nil
|
93
|
+
object_node :award_number, 'awardNumber', class: AwardNumber, default_value: nil
|
94
|
+
text_node :award_title, 'awardTitle', default_value: nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -12,16 +12,18 @@ require 'datacite/mapping/title'
|
|
12
12
|
module Datacite
|
13
13
|
module Mapping
|
14
14
|
|
15
|
+
DATACITE_3_NAMESPACE = XML::MappingExtensions::Namespace.new(
|
16
|
+
uri: 'http://datacite.org/schema/kernel-3',
|
17
|
+
schema_location: 'http://schema.datacite.org/meta/kernel-3/metadata.xsd'
|
18
|
+
)
|
19
|
+
|
15
20
|
# A collection of metadata properties chosen for the accurate and consistent identification
|
16
21
|
# of a resource for citation and retrieval purposes, along with recommended use instructions.
|
17
22
|
# The resource that is being identified can be of any kind, but it is typically a dataset.
|
18
23
|
class Resource
|
19
24
|
include XML::MappingExtensions::Namespaced
|
20
25
|
|
21
|
-
namespace
|
22
|
-
uri: 'http://datacite.org/schema/kernel-3',
|
23
|
-
schema_location: 'http://schema.datacite.org/meta/kernel-3/metadata.xsd'
|
24
|
-
)
|
26
|
+
namespace DATACITE_3_NAMESPACE
|
25
27
|
|
26
28
|
# Initialies a new {Resource}
|
27
29
|
#
|
@@ -31,6 +33,7 @@ module Datacite
|
|
31
33
|
# @param publisher [String] the name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource.
|
32
34
|
# @param publication_year [Integer] year when the resource is made publicly available.
|
33
35
|
# @param subjects [Array<Subject>] subjects, keywords, classification codes, or key phrases describing the resource.
|
36
|
+
# @param funding_references [Array<FundingReference>] information about financial support (funding) for the resource being registered.
|
34
37
|
# @param contributors [Array<Contributor>] institutions or persons responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
|
35
38
|
# @param dates [Array<Date>] different dates relevant to the work.
|
36
39
|
# @param language [String] Primary language of the resource: an IETF BCP 47, ISO 639-1 language code.
|
@@ -44,13 +47,14 @@ module Datacite
|
|
44
47
|
# @param rights_list [Array<Rights>] rights information for this resource.
|
45
48
|
# @param descriptions [Array<Description>] all additional information that does not fit in any of the other categories.
|
46
49
|
# @param geo_locations [Array<GeoLocations>] spatial region or named place where the data was gathered or about which the data is focused.
|
47
|
-
def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], contributors: [], dates: [], language: 'en', resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Metrics/AbcSize
|
50
|
+
def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], funding_references: [], contributors: [], dates: [], language: 'en', resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Metrics/AbcSize
|
48
51
|
self.identifier = identifier
|
49
52
|
self.creators = creators
|
50
53
|
self.titles = titles
|
51
54
|
self.publisher = publisher
|
52
55
|
self.publication_year = publication_year
|
53
56
|
self.subjects = subjects
|
57
|
+
self.funding_references = funding_references
|
54
58
|
self.contributors = contributors
|
55
59
|
self.dates = dates
|
56
60
|
self.language = language
|
@@ -134,6 +138,10 @@ module Datacite
|
|
134
138
|
# @return [Array<Subject>] subjects, keywords, classification codes, or key phrases describing the resource.
|
135
139
|
array_node :subjects, 'subjects', 'subject', class: Subject, default_value: []
|
136
140
|
|
141
|
+
# @!attribute [rw] fundingReferences
|
142
|
+
# @return [Array<FundingReference>] information about financial support (funding) for the resource being registered.
|
143
|
+
array_node :funding_references, 'fundingReferences', 'fundingReference', class: FundingReference, default_value: []
|
144
|
+
|
137
145
|
# @!attribute [rw] contributors
|
138
146
|
# @return [Array<Contributor>] institutions or persons responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
|
139
147
|
array_node :contributors, 'contributors', 'contributor', class: Contributor, default_value: []
|
@@ -29,5 +29,33 @@ module Datacite
|
|
29
29
|
# @return [String] the rights statement. Cannot be empty or nil.
|
30
30
|
text_node :value, 'text()'
|
31
31
|
end
|
32
|
+
|
33
|
+
class Rights
|
34
|
+
CC_ZERO = Rights.new(
|
35
|
+
uri: URI('https://creativecommons.org/publicdomain/zero/1.0/'),
|
36
|
+
value: 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication'
|
37
|
+
)
|
38
|
+
|
39
|
+
CC_BY = Rights.new(
|
40
|
+
uri: URI('https://creativecommons.org/licenses/by/4.0/'),
|
41
|
+
value: 'Creative Commons Attribution 4.0 International (CC-BY)'
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
32
45
|
end
|
46
|
+
|
47
|
+
# class License
|
48
|
+
# # Convenience instance for the [CC-BY](https://creativecommons.org/licenses/by/4.0/legalcode) license
|
49
|
+
# CC_BY = License.new(
|
50
|
+
# name: 'Creative Commons Attribution 4.0 International (CC-BY)',
|
51
|
+
# uri: URI('https://creativecommons.org/licenses/by/4.0/')
|
52
|
+
# )
|
53
|
+
#
|
54
|
+
# # Convenience instance for the [CC0](https://creativecommons.org/publicdomain/zero/1.0/legalcode)
|
55
|
+
# # public domain declaration
|
56
|
+
# CC_ZERO = License.new(
|
57
|
+
# name: 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
|
58
|
+
# uri: URI('https://creativecommons.org/publicdomain/zero/1.0/')
|
59
|
+
# )
|
60
|
+
# end
|
33
61
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
2
|
+
<identifier identifierType="DOI">10.5281/zenodo.47394</identifier>
|
3
|
+
<creators>
|
4
|
+
<creator>
|
5
|
+
<creatorName>Dedeurwaerdere Tom</creatorName>
|
6
|
+
<affiliation>Université catholique de Louvain</affiliation>
|
7
|
+
</creator>
|
8
|
+
</creators>
|
9
|
+
<titles>
|
10
|
+
<title>Combining internal and external motivations in multi-actor governance arrangements for biodiversity and ecosystem services</title>
|
11
|
+
</titles>
|
12
|
+
<publisher>Zenodo</publisher>
|
13
|
+
<publicationYear>2016</publicationYear>
|
14
|
+
<subjects>
|
15
|
+
<subject>Internal motivations</subject>
|
16
|
+
<subject>Biodiversity</subject>
|
17
|
+
<subject>Multi-actor governance</subject>
|
18
|
+
<subject>Payment for ecosystem services</subject>
|
19
|
+
<subject>Crowding out</subject>
|
20
|
+
</subjects>
|
21
|
+
<fundingReferences>
|
22
|
+
<fundingReference>
|
23
|
+
<funderName>European Commission</funderName>
|
24
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/501100000780</funderIdentifier>
|
25
|
+
<awardNumber awardURI="http://cordis.europa.eu/project/rcn/100180_en.html">282625</awardNumber>
|
26
|
+
<awardTitle>MOTivational strength of ecosystem services and alternative ways to express the value of BIOdiversity</awardTitle>
|
27
|
+
</fundingReference>
|
28
|
+
<fundingReference>
|
29
|
+
<funderName>European Commission</funderName>
|
30
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/501100000780</funderIdentifier>
|
31
|
+
<awardNumber awardURI="http://cordis.europa.eu/project/rcn/100603_en.html">284382</awardNumber>
|
32
|
+
<awardTitle>Institutionalizing global genetic-resource commons. Global Strategies for accessingand using essential public knowledge assets in the life science</awardTitle>
|
33
|
+
</fundingReference>
|
34
|
+
</fundingReferences>
|
35
|
+
<dates>
|
36
|
+
<date dateType="Issued">2016-03-11</date>
|
37
|
+
</dates>
|
38
|
+
<resourceType resourceTypeGeneral="Dataset"/>
|
39
|
+
<alternateIdentifiers>
|
40
|
+
<alternateIdentifier alternateIdentifierType="URL">http://zenodo.org/record/47394</alternateIdentifier>
|
41
|
+
</alternateIdentifiers>
|
42
|
+
<relatedIdentifiers>
|
43
|
+
<relatedIdentifier relatedIdentifierType="URL" relationType="HasPart">https://zenodo.org/record/47394/files/Data_All_Internal_motivations.pdf</relatedIdentifier>
|
44
|
+
<relatedIdentifier relatedIdentifierType="URL" relationType="HasPart">https://zenodo.org/record/47394/files/survey_questionnaire_internal_motivations.pdf</relatedIdentifier>
|
45
|
+
</relatedIdentifiers>
|
46
|
+
<rightsList>
|
47
|
+
<rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights>
|
48
|
+
<rights rightsURI="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons Zero 1.0 Universal</rights>
|
49
|
+
</rightsList>
|
50
|
+
<descriptions>
|
51
|
+
<description descriptionType="Abstract"><p>These files provide the original survey data of the paper on motivations for biodiversity conservation in Europe. This paper analyses the possibility of building a mutually supportive dynamics between
|
52
|
+
internally and<br /> externally motivated behaviour for biodiversity conservation and ecosystem services provision. To this<br /> purpose a face to face survey amongst 169 key actors of 34 highly successful and prominent
|
53
|
+
biodiversity<br /> arrangements in seven EU countries was conducted. The main<br /> finding of the paper is the feasibility of<br /> combining inherently intrinsically motivated behaviours (providing enjoyment, pleasure from<br
|
54
|
+
/> experimentation and learning, aesthetic satisfaction) and internalized extrinsic motivations (related<br /> to the identification with the collective goals of conservation policy) through a common set of governance<br /> features.
|
55
|
+
Successful initiatives that combine internal and external motivations share the following<br /> features: inclusive decision making processes, a broad monitoring by &ldquo;peers&rdquo; beyond the core staff of the<br />
|
56
|
+
initiatives, and a context that is supportive for the building of autonomous actor competences. These<br /> findings are in line with the psycho-sociological theory of motivation, which shows the importance of a<br /> psycho-social
|
57
|
+
context leading to a subjective perception of autonomy and a sense of competence of the<br /> actors.</p></description>
|
58
|
+
</descriptions>
|
59
|
+
</resource>
|
@@ -0,0 +1,470 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Revision history
|
3
|
+
2010-08-26 Complete revision according to new common specification by the metadata work group after review. AJH, DTIC
|
4
|
+
2010-11-17 Revised to current state of kernel review, FZ, TIB
|
5
|
+
2011-01-17 Complete revsion after community review. FZ, TIB
|
6
|
+
2011-03-17 Release of v2.1: added a namespace; mandatory properties got minLength; changes in the definitions of relationTypes IsDocumentedBy/Documents and isCompiledBy/Compiles; changes type of property "Date" from xs:date to xs:string. FZ, TIB
|
7
|
+
2011-06-27 v2.2: namespace: kernel-2.2, additions to controlled lists "resourceType", "contributorType", "relatedIdentifierType", and "descriptionType". Removal of intermediate include-files.
|
8
|
+
2013-07-24 v3.0: namespace: kernel-3.0; delete LastMetadataUpdate & MetadateVersionNumber; additions to controlled lists "contributorType", "dateType", "descriptionType", "relationType", "relatedIdentifierType" & "resourceType"; deletion of "StartDate" & "EndDate" from list "dateType" and "Film" from "resourceType"; allow arbitrary order of elements; allow optional wrapper elements to be empty; include xml:lang attribute for title, subject & description; include attribute schemeURI for nameIdentifier of creator, contributor & subject; added new attributes "relatedMetadataScheme", "schemeURI" & "schemeType" to relatedIdentifier; included new property "geoLocation"
|
9
|
+
2014-08-20 v3.1: additions to controlled lists "relationType", contributorType" and "relatedIdentifierType"; introduction of new child element "affiliation" to "creator" and "contributor"
|
10
|
+
2016-05-14 v4.0: namespace: kernel-4.0; makes "resourceType" required field, added optional "givenName" and "familyName" to creator and contributor, added "funderReference", added "valueURI" for subject, added "geoLocationPolygon" -->
|
11
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified" xml:lang="EN">
|
12
|
+
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
|
13
|
+
<xs:include schemaLocation="include/datacite-titleType-v4.xsd"/>
|
14
|
+
<xs:include schemaLocation="include/datacite-contributorType-v4.xsd"/>
|
15
|
+
<xs:include schemaLocation="include/datacite-dateType-v4.xsd"/>
|
16
|
+
<xs:include schemaLocation="include/datacite-resourceType-v4.xsd"/>
|
17
|
+
<xs:include schemaLocation="include/datacite-relationType-v4.xsd"/>
|
18
|
+
<xs:include schemaLocation="include/datacite-relatedIdentifierType-v4.xsd"/>
|
19
|
+
<xs:include schemaLocation="include/datacite-funderIdentifierType-v4.xsd"/>
|
20
|
+
<xs:include schemaLocation="include/datacite-descriptionType-v4.xsd"/>
|
21
|
+
<xs:element name="resource">
|
22
|
+
<xs:annotation>
|
23
|
+
<xs:documentation>
|
24
|
+
Root element of a single record. This wrapper element is for XML implementation only and is not defined in the DataCite DOI standard.
|
25
|
+
Note: This is the case for all wrapper elements within this schema.</xs:documentation>
|
26
|
+
<xs:documentation>No content in this wrapper element.</xs:documentation>
|
27
|
+
</xs:annotation>
|
28
|
+
<xs:complexType>
|
29
|
+
<xs:all>
|
30
|
+
<!--REQUIRED FIELDS-->
|
31
|
+
<xs:element name="identifier">
|
32
|
+
<xs:annotation>
|
33
|
+
<xs:documentation>A persistent identifier that identifies a resource.</xs:documentation>
|
34
|
+
<xs:documentation>Currently, only DOI is allowed.</xs:documentation>
|
35
|
+
</xs:annotation>
|
36
|
+
<xs:complexType>
|
37
|
+
<xs:simpleContent>
|
38
|
+
<xs:extension base="doiType">
|
39
|
+
<xs:attribute name="identifierType" use="required" fixed="DOI"/>
|
40
|
+
</xs:extension>
|
41
|
+
</xs:simpleContent>
|
42
|
+
</xs:complexType>
|
43
|
+
</xs:element>
|
44
|
+
<xs:element name="creators">
|
45
|
+
<xs:complexType>
|
46
|
+
<xs:sequence>
|
47
|
+
<xs:element name="creator" maxOccurs="unbounded">
|
48
|
+
<xs:annotation>
|
49
|
+
<xs:documentation>The main researchers involved working on the data, or the authors of the publication in priority order. May be a corporate/institutional or personal name.</xs:documentation>
|
50
|
+
<xs:documentation>Format: Family, Given.</xs:documentation>
|
51
|
+
<xs:documentation>Personal names can be further specified using givenName and familyName.</xs:documentation>
|
52
|
+
</xs:annotation>
|
53
|
+
<xs:complexType>
|
54
|
+
<xs:sequence>
|
55
|
+
<xs:element name="creatorName">
|
56
|
+
<xs:simpleType>
|
57
|
+
<xs:restriction base="nonemptycontentStringType"/>
|
58
|
+
</xs:simpleType>
|
59
|
+
</xs:element>
|
60
|
+
<xs:element name="givenName" minOccurs="0"/>
|
61
|
+
<xs:element name="familyName" minOccurs="0"/>
|
62
|
+
<xs:element name="nameIdentifier" minOccurs="0" maxOccurs="unbounded">
|
63
|
+
<xs:complexType>
|
64
|
+
<xs:simpleContent>
|
65
|
+
<xs:extension base="nonemptycontentStringType">
|
66
|
+
<xs:attribute name="nameIdentifierScheme" use="required"/>
|
67
|
+
<xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
|
68
|
+
</xs:extension>
|
69
|
+
</xs:simpleContent>
|
70
|
+
</xs:complexType>
|
71
|
+
</xs:element>
|
72
|
+
<xs:element name="affiliation" minOccurs="0" maxOccurs="unbounded"/>
|
73
|
+
</xs:sequence>
|
74
|
+
</xs:complexType>
|
75
|
+
</xs:element>
|
76
|
+
</xs:sequence>
|
77
|
+
</xs:complexType>
|
78
|
+
</xs:element>
|
79
|
+
<xs:element name="titles">
|
80
|
+
<xs:complexType>
|
81
|
+
<xs:sequence>
|
82
|
+
<xs:element name="title" maxOccurs="unbounded">
|
83
|
+
<xs:annotation>
|
84
|
+
<xs:documentation>A name or title by which a resource is known.</xs:documentation>
|
85
|
+
</xs:annotation>
|
86
|
+
<xs:complexType>
|
87
|
+
<xs:simpleContent>
|
88
|
+
<xs:extension base="nonemptycontentStringType">
|
89
|
+
<xs:attribute name="titleType" type="titleType" use="optional"/>
|
90
|
+
<xs:attribute ref="xml:lang"/>
|
91
|
+
</xs:extension>
|
92
|
+
</xs:simpleContent>
|
93
|
+
</xs:complexType>
|
94
|
+
</xs:element>
|
95
|
+
</xs:sequence>
|
96
|
+
</xs:complexType>
|
97
|
+
</xs:element>
|
98
|
+
<xs:element name="publisher">
|
99
|
+
<xs:annotation>
|
100
|
+
<xs:documentation>The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource. This property will be used to formulate the citation, so consider the prominence of the role.</xs:documentation>
|
101
|
+
<xs:documentation>In the case of datasets, "publish" is understood to mean making the data available to the community of researchers.</xs:documentation>
|
102
|
+
</xs:annotation>
|
103
|
+
<xs:simpleType>
|
104
|
+
<xs:restriction base="nonemptycontentStringType"/>
|
105
|
+
</xs:simpleType>
|
106
|
+
</xs:element>
|
107
|
+
<xs:element name="publicationYear">
|
108
|
+
<xs:annotation>
|
109
|
+
<xs:documentation>Year when the data is made publicly available. If an embargo period has been in effect, use the date when the embargo period ends.</xs:documentation>
|
110
|
+
<xs:documentation>In the case of datasets, "publish" is understood to mean making the data available on a specific date to the community of researchers. If there is no standard publication year value, use the date that would be preferred from a citation perspective.</xs:documentation>
|
111
|
+
<xs:documentation>YYYY</xs:documentation>
|
112
|
+
</xs:annotation>
|
113
|
+
<xs:simpleType>
|
114
|
+
<xs:restriction base="yearType"/>
|
115
|
+
</xs:simpleType>
|
116
|
+
</xs:element>
|
117
|
+
<xs:element name="resourceType">
|
118
|
+
<xs:annotation>
|
119
|
+
<xs:documentation>The type of a resource. You may enter an additional free text description.</xs:documentation>
|
120
|
+
<xs:documentation>The format is open, but the preferred format is a single term of some detail so that a pair can be formed with the sub-property.</xs:documentation>
|
121
|
+
</xs:annotation>
|
122
|
+
<xs:complexType>
|
123
|
+
<xs:simpleContent>
|
124
|
+
<xs:extension base="xs:string">
|
125
|
+
<xs:attribute name="resourceTypeGeneral" type="resourceType" use="required"/>
|
126
|
+
</xs:extension>
|
127
|
+
</xs:simpleContent>
|
128
|
+
</xs:complexType>
|
129
|
+
</xs:element>
|
130
|
+
<!--OPTIONAL FIELDS-->
|
131
|
+
<xs:element name="subjects" minOccurs="0">
|
132
|
+
<xs:complexType>
|
133
|
+
<xs:sequence>
|
134
|
+
<xs:element name="subject" minOccurs="0" maxOccurs="unbounded">
|
135
|
+
<xs:annotation>
|
136
|
+
<xs:documentation>Subject, keywords, classification codes, or key phrases describing the resource.</xs:documentation>
|
137
|
+
</xs:annotation>
|
138
|
+
<xs:complexType>
|
139
|
+
<xs:simpleContent>
|
140
|
+
<xs:extension base="xs:string">
|
141
|
+
<xs:attribute name="subjectScheme" use="optional"/>
|
142
|
+
<xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
|
143
|
+
<xs:attribute name="valueURI" type="xs:anyURI" use="optional"/>
|
144
|
+
<xs:attribute ref="xml:lang"/>
|
145
|
+
</xs:extension>
|
146
|
+
</xs:simpleContent>
|
147
|
+
</xs:complexType>
|
148
|
+
</xs:element>
|
149
|
+
</xs:sequence>
|
150
|
+
</xs:complexType>
|
151
|
+
</xs:element>
|
152
|
+
<xs:element name="contributors" minOccurs="0">
|
153
|
+
<xs:complexType>
|
154
|
+
<xs:sequence>
|
155
|
+
<xs:element name="contributor" minOccurs="0" maxOccurs="unbounded">
|
156
|
+
<xs:annotation>
|
157
|
+
<xs:documentation>The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.</xs:documentation>
|
158
|
+
<xs:documentation>The personal name format should be: Family, Given.</xs:documentation>
|
159
|
+
</xs:annotation>
|
160
|
+
<xs:complexType>
|
161
|
+
<xs:sequence>
|
162
|
+
<xs:element name="contributorName">
|
163
|
+
<xs:simpleType>
|
164
|
+
<xs:restriction base="xs:string">
|
165
|
+
<xs:minLength value="1"/>
|
166
|
+
</xs:restriction>
|
167
|
+
</xs:simpleType>
|
168
|
+
</xs:element>
|
169
|
+
<xs:element name="givenName" minOccurs="0"/>
|
170
|
+
<xs:element name="familyName" minOccurs="0"/>
|
171
|
+
<xs:element name="nameIdentifier" minOccurs="0" maxOccurs="unbounded">
|
172
|
+
<xs:complexType>
|
173
|
+
<xs:simpleContent>
|
174
|
+
<xs:extension base="xs:string">
|
175
|
+
<xs:attribute name="nameIdentifierScheme" use="required"/>
|
176
|
+
<xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
|
177
|
+
</xs:extension>
|
178
|
+
</xs:simpleContent>
|
179
|
+
</xs:complexType>
|
180
|
+
</xs:element>
|
181
|
+
<xs:element name="affiliation" minOccurs="0" maxOccurs="unbounded"/>
|
182
|
+
</xs:sequence>
|
183
|
+
<xs:attribute name="contributorType" type="contributorType" use="required"/>
|
184
|
+
</xs:complexType>
|
185
|
+
</xs:element>
|
186
|
+
</xs:sequence>
|
187
|
+
</xs:complexType>
|
188
|
+
</xs:element>
|
189
|
+
<xs:element name="dates" minOccurs="0">
|
190
|
+
<xs:complexType>
|
191
|
+
<xs:sequence>
|
192
|
+
<xs:element name="date" minOccurs="0" maxOccurs="unbounded">
|
193
|
+
<xs:annotation>
|
194
|
+
<xs:documentation>Different dates relevant to the work.</xs:documentation>
|
195
|
+
<xs:documentation>YYYY,YYYY-MM-DD, YYYY-MM-DDThh:mm:ssTZD or any other format or level of granularity described in W3CDTF. Use RKMS-ISO8601 standard for depicting date ranges.</xs:documentation>
|
196
|
+
</xs:annotation>
|
197
|
+
<xs:complexType>
|
198
|
+
<xs:simpleContent>
|
199
|
+
<xs:extension base="xs:string">
|
200
|
+
<xs:attribute name="dateType" type="dateType" use="required"/>
|
201
|
+
</xs:extension>
|
202
|
+
</xs:simpleContent>
|
203
|
+
</xs:complexType>
|
204
|
+
</xs:element>
|
205
|
+
</xs:sequence>
|
206
|
+
</xs:complexType>
|
207
|
+
</xs:element>
|
208
|
+
<xs:element name="language" type="xs:language" minOccurs="0">
|
209
|
+
<xs:annotation>
|
210
|
+
<xs:documentation>Primary language of the resource. Allowed values are taken from IETF BCP 47, ISO 639-1 language codes.</xs:documentation>
|
211
|
+
</xs:annotation>
|
212
|
+
</xs:element>
|
213
|
+
<xs:element name="alternateIdentifiers" minOccurs="0">
|
214
|
+
<xs:complexType>
|
215
|
+
<xs:sequence>
|
216
|
+
<xs:element name="alternateIdentifier" minOccurs="0" maxOccurs="unbounded">
|
217
|
+
<xs:annotation>
|
218
|
+
<xs:documentation>An identifier or identifiers other than the primary Identifier applied to the resource being registered. This may be any alphanumeric string which is unique within its domain of issue. May be used for local identifiers. AlternateIdentifier should be used for another identifier of the same instance (same location, same file).</xs:documentation>
|
219
|
+
</xs:annotation>
|
220
|
+
<xs:complexType>
|
221
|
+
<xs:simpleContent>
|
222
|
+
<xs:extension base="xs:string">
|
223
|
+
<xs:attribute name="alternateIdentifierType" use="required"/>
|
224
|
+
</xs:extension>
|
225
|
+
</xs:simpleContent>
|
226
|
+
</xs:complexType>
|
227
|
+
</xs:element>
|
228
|
+
</xs:sequence>
|
229
|
+
</xs:complexType>
|
230
|
+
</xs:element>
|
231
|
+
<xs:element name="relatedIdentifiers" minOccurs="0">
|
232
|
+
<xs:complexType>
|
233
|
+
<xs:sequence>
|
234
|
+
<xs:element name="relatedIdentifier" minOccurs="0" maxOccurs="unbounded">
|
235
|
+
<xs:annotation>
|
236
|
+
<xs:documentation>Identifiers of related resources. Use this property to indicate subsets of properties, as appropriate.</xs:documentation>
|
237
|
+
</xs:annotation>
|
238
|
+
<xs:complexType>
|
239
|
+
<xs:simpleContent>
|
240
|
+
<xs:extension base="xs:string">
|
241
|
+
<xs:attribute name="relatedIdentifierType" type="relatedIdentifierType" use="required"/>
|
242
|
+
<xs:attribute name="relationType" type="relationType" use="required"/>
|
243
|
+
<xs:attribute name="relatedMetadataScheme" use="optional"/>
|
244
|
+
<xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
|
245
|
+
<xs:attribute name="schemeType" use="optional"/>
|
246
|
+
</xs:extension>
|
247
|
+
</xs:simpleContent>
|
248
|
+
</xs:complexType>
|
249
|
+
</xs:element>
|
250
|
+
</xs:sequence>
|
251
|
+
</xs:complexType>
|
252
|
+
</xs:element>
|
253
|
+
<xs:element name="sizes" minOccurs="0">
|
254
|
+
<xs:complexType>
|
255
|
+
<xs:sequence>
|
256
|
+
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="unbounded">
|
257
|
+
<xs:annotation>
|
258
|
+
<xs:documentation>Unstructures size information about the resource.</xs:documentation>
|
259
|
+
</xs:annotation>
|
260
|
+
</xs:element>
|
261
|
+
</xs:sequence>
|
262
|
+
</xs:complexType>
|
263
|
+
</xs:element>
|
264
|
+
<xs:element name="formats" minOccurs="0">
|
265
|
+
<xs:complexType>
|
266
|
+
<xs:sequence>
|
267
|
+
<xs:element name="format" type="xs:string" minOccurs="0" maxOccurs="unbounded">
|
268
|
+
<xs:annotation>
|
269
|
+
<xs:documentation>Technical format of the resource.</xs:documentation>
|
270
|
+
<xs:documentation>Use file extension or MIME type where possible.</xs:documentation>
|
271
|
+
</xs:annotation>
|
272
|
+
</xs:element>
|
273
|
+
</xs:sequence>
|
274
|
+
</xs:complexType>
|
275
|
+
</xs:element>
|
276
|
+
<xs:element name="version" type="xs:string" minOccurs="0">
|
277
|
+
<xs:annotation>
|
278
|
+
<xs:documentation>Version number of the resource. If the primary resource has changed the version number increases.</xs:documentation>
|
279
|
+
<xs:documentation>Register a new identifier for a major version change. Individual stewards need to determine which are major vs. minor versions. May be used in conjunction with properties 11 and 12 (AlternateIdentifier and RelatedIdentifier) to indicate various information updates. May be used in conjunction with property 17 (Description) to indicate the nature and file/record range of version.</xs:documentation>
|
280
|
+
</xs:annotation>
|
281
|
+
</xs:element>
|
282
|
+
<xs:element name="rightsList" minOccurs="0">
|
283
|
+
<xs:complexType>
|
284
|
+
<xs:sequence>
|
285
|
+
<xs:element name="rights" minOccurs="0" maxOccurs="unbounded">
|
286
|
+
<xs:annotation>
|
287
|
+
<xs:documentation>Any rights information for this resource. Provide a rights management statement for the resource or reference a service providing such information. Include embargo information if applicable.
|
288
|
+
Use the complete title of a license and include version information if applicable.</xs:documentation>
|
289
|
+
</xs:annotation>
|
290
|
+
<xs:complexType>
|
291
|
+
<xs:simpleContent>
|
292
|
+
<xs:extension base="xs:string">
|
293
|
+
<xs:attribute name="rightsURI" type="xs:anyURI" use="optional"/>
|
294
|
+
</xs:extension>
|
295
|
+
</xs:simpleContent>
|
296
|
+
</xs:complexType>
|
297
|
+
</xs:element>
|
298
|
+
</xs:sequence>
|
299
|
+
</xs:complexType>
|
300
|
+
</xs:element>
|
301
|
+
<xs:element name="descriptions" minOccurs="0">
|
302
|
+
<xs:complexType>
|
303
|
+
<xs:sequence>
|
304
|
+
<xs:element name="description" minOccurs="0" maxOccurs="unbounded">
|
305
|
+
<xs:annotation>
|
306
|
+
<xs:documentation>All additional information that does not fit in any of the other categories. May be used for technical information. It is a best practice to supply a description.</xs:documentation>
|
307
|
+
</xs:annotation>
|
308
|
+
<xs:complexType mixed="true">
|
309
|
+
<xs:choice>
|
310
|
+
<xs:element name="br" minOccurs="0" maxOccurs="unbounded">
|
311
|
+
<xs:simpleType>
|
312
|
+
<xs:restriction base="xs:string">
|
313
|
+
<xs:length value="0"/>
|
314
|
+
</xs:restriction>
|
315
|
+
</xs:simpleType>
|
316
|
+
</xs:element>
|
317
|
+
</xs:choice>
|
318
|
+
<xs:attribute name="descriptionType" type="descriptionType" use="required"/>
|
319
|
+
<xs:attribute ref="xml:lang"/>
|
320
|
+
</xs:complexType>
|
321
|
+
</xs:element>
|
322
|
+
</xs:sequence>
|
323
|
+
</xs:complexType>
|
324
|
+
</xs:element>
|
325
|
+
<xs:element name="geoLocations" minOccurs="0">
|
326
|
+
<xs:complexType>
|
327
|
+
<xs:sequence>
|
328
|
+
<xs:element name="geoLocation" minOccurs="0" maxOccurs="unbounded">
|
329
|
+
<xs:complexType>
|
330
|
+
<xs:all>
|
331
|
+
<xs:element name="geoLocationPlace" minOccurs="0">
|
332
|
+
<xs:annotation>
|
333
|
+
<xs:documentation>Spatial region or named place where the data was gathered or about which the data is focused.</xs:documentation>
|
334
|
+
</xs:annotation>
|
335
|
+
</xs:element>
|
336
|
+
<xs:element name="geoLocationPoint" type="point" minOccurs="0">
|
337
|
+
<xs:annotation>
|
338
|
+
<xs:documentation>A point contains a single latitude-longitude pair, separated by whitespace.</xs:documentation>
|
339
|
+
</xs:annotation>
|
340
|
+
</xs:element>
|
341
|
+
<xs:element name="geoLocationBox" type="box" minOccurs="0">
|
342
|
+
<xs:annotation>
|
343
|
+
<xs:documentation>A box contains two white space separated latitude-longitude pairs, with each pair separated by whitespace. The first pair is the lower corner, the second is the upper corner.</xs:documentation>
|
344
|
+
</xs:annotation>
|
345
|
+
</xs:element>
|
346
|
+
<xs:element name="geoLocationPolygon" minOccurs="0">
|
347
|
+
<xs:annotation>
|
348
|
+
<xs:documentation>A drawn polygon area, defined by a set of points and lines connecting the points in a closed chain.</xs:documentation>
|
349
|
+
</xs:annotation>
|
350
|
+
<xs:complexType>
|
351
|
+
<xs:sequence>
|
352
|
+
<xs:element name="polygonPoint" type="point" minOccurs="3" maxOccurs="unbounded"/>
|
353
|
+
</xs:sequence>
|
354
|
+
</xs:complexType>
|
355
|
+
</xs:element>
|
356
|
+
</xs:all>
|
357
|
+
</xs:complexType>
|
358
|
+
</xs:element>
|
359
|
+
</xs:sequence>
|
360
|
+
</xs:complexType>
|
361
|
+
</xs:element>
|
362
|
+
<xs:element name="fundingReferences" minOccurs="0">
|
363
|
+
<xs:complexType>
|
364
|
+
<xs:sequence>
|
365
|
+
<xs:element name="fundingReference" minOccurs="0" maxOccurs="unbounded">
|
366
|
+
<xs:annotation>
|
367
|
+
<xs:documentation>Information about financial support (funding) for the resource being registered.</xs:documentation>
|
368
|
+
</xs:annotation>
|
369
|
+
<xs:complexType>
|
370
|
+
<xs:all>
|
371
|
+
<xs:element name="funderName" minOccurs="1" maxOccurs="1">
|
372
|
+
<xs:annotation>
|
373
|
+
<xs:documentation>Name of the funding provider.</xs:documentation>
|
374
|
+
</xs:annotation>
|
375
|
+
<xs:simpleType>
|
376
|
+
<xs:restriction base="nonemptycontentStringType"/>
|
377
|
+
</xs:simpleType>
|
378
|
+
</xs:element>
|
379
|
+
<xs:element name="funderIdentifier" minOccurs="0">
|
380
|
+
<xs:annotation>
|
381
|
+
<xs:documentation>Uniquely identifies a funding entity, according to various types.</xs:documentation>
|
382
|
+
</xs:annotation>
|
383
|
+
<xs:complexType>
|
384
|
+
<xs:simpleContent>
|
385
|
+
<xs:extension base="xs:string">
|
386
|
+
<xs:attribute name="funderIdentifierType" type="funderIdentifierType" use="required"/>
|
387
|
+
</xs:extension>
|
388
|
+
</xs:simpleContent>
|
389
|
+
</xs:complexType>
|
390
|
+
</xs:element>
|
391
|
+
<xs:element name="awardNumber" minOccurs="0">
|
392
|
+
<xs:annotation>
|
393
|
+
<xs:documentation>The code assigned by the funder to a sponsored award (grant).</xs:documentation>
|
394
|
+
</xs:annotation>
|
395
|
+
<xs:complexType>
|
396
|
+
<xs:simpleContent>
|
397
|
+
<xs:extension base="xs:string">
|
398
|
+
<xs:attribute name="awardURI" type="xs:anyURI" use="optional"/>
|
399
|
+
</xs:extension>
|
400
|
+
</xs:simpleContent>
|
401
|
+
</xs:complexType>
|
402
|
+
</xs:element>
|
403
|
+
<xs:element name="awardTitle" minOccurs="0">
|
404
|
+
<xs:annotation>
|
405
|
+
<xs:documentation>The human readable title of the award (grant).</xs:documentation>
|
406
|
+
</xs:annotation>
|
407
|
+
<xs:simpleType>
|
408
|
+
<xs:restriction base="nonemptycontentStringType"/>
|
409
|
+
</xs:simpleType>
|
410
|
+
</xs:element>
|
411
|
+
</xs:all>
|
412
|
+
</xs:complexType>
|
413
|
+
</xs:element>
|
414
|
+
</xs:sequence>
|
415
|
+
</xs:complexType>
|
416
|
+
</xs:element>
|
417
|
+
</xs:all>
|
418
|
+
</xs:complexType>
|
419
|
+
</xs:element>
|
420
|
+
<!-- TYPE DECLARATIONS -->
|
421
|
+
<!-- defines the value for a DOI" -->
|
422
|
+
<xs:simpleType name="doiType">
|
423
|
+
<xs:restriction base="xs:token">
|
424
|
+
<xs:pattern value="10\..+/.+"/>
|
425
|
+
</xs:restriction>
|
426
|
+
</xs:simpleType>
|
427
|
+
<!-- defines value for mandatory fields -->
|
428
|
+
<xs:simpleType name="nonemptycontentStringType">
|
429
|
+
<xs:restriction base="xs:string">
|
430
|
+
<xs:minLength value="1"/>
|
431
|
+
</xs:restriction>
|
432
|
+
</xs:simpleType>
|
433
|
+
<xs:attributeGroup name="nameId">
|
434
|
+
<xs:attribute name="nameIdentifier" type="xs:string" use="optional"/>
|
435
|
+
<xs:attribute name="nameIdentifierScheme" type="xs:string" use="optional"/>
|
436
|
+
</xs:attributeGroup>
|
437
|
+
<!-- defines the value for a year -->
|
438
|
+
<xs:simpleType name="yearType">
|
439
|
+
<xs:restriction base="xs:token">
|
440
|
+
<xs:pattern value="[\d]{4}"/>
|
441
|
+
</xs:restriction>
|
442
|
+
</xs:simpleType>
|
443
|
+
<!-- definitions for geoLocation -->
|
444
|
+
<xs:complexType name="point">
|
445
|
+
<xs:all>
|
446
|
+
<xs:element name="pointLongitude" type="longitudeType" minOccurs="1"/>
|
447
|
+
<xs:element name="pointLatitude" type="latitudeType" minOccurs="1"/>
|
448
|
+
</xs:all>
|
449
|
+
</xs:complexType>
|
450
|
+
<xs:complexType name="box">
|
451
|
+
<xs:all>
|
452
|
+
<xs:element name="westBoundLongitude" type="longitudeType" minOccurs="1"/>
|
453
|
+
<xs:element name="eastBoundLongitude" type="longitudeType" minOccurs="1"/>
|
454
|
+
<xs:element name="southBoundLatitude" type="latitudeType" minOccurs="1"/>
|
455
|
+
<xs:element name="northBoundLatitude" type="latitudeType" minOccurs="1"/>
|
456
|
+
</xs:all>
|
457
|
+
</xs:complexType>
|
458
|
+
<xs:simpleType name="longitudeType">
|
459
|
+
<xs:restriction base="xs:float">
|
460
|
+
<xs:minInclusive value="-180"/>
|
461
|
+
<xs:maxInclusive value="180"/>
|
462
|
+
</xs:restriction>
|
463
|
+
</xs:simpleType>
|
464
|
+
<xs:simpleType name="latitudeType">
|
465
|
+
<xs:restriction base="xs:float">
|
466
|
+
<xs:minInclusive value="-90"/>
|
467
|
+
<xs:maxInclusive value="90"/>
|
468
|
+
</xs:restriction>
|
469
|
+
</xs:simpleType>
|
470
|
+
</xs:schema>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Datacite
|
4
|
+
module Mapping
|
5
|
+
describe FundingReference do
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
it 'accepts an AwardNumber object' do
|
9
|
+
award_number = AwardNumber.new(value: '9 3/4')
|
10
|
+
fref = FundingReference.new(name: 'Ministry of Magic', award_number: award_number)
|
11
|
+
expect(fref.award_number).to be(award_number)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'accepts a text award_number' do
|
15
|
+
fref = FundingReference.new(name: 'Ministry of Magic', award_number: '9 3/4')
|
16
|
+
award_number = fref.award_number
|
17
|
+
expect(award_number).to be_an(AwardNumber)
|
18
|
+
expect(award_number.value).to eq('9 3/4')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#parse_xml' do
|
23
|
+
attr_reader :fref_xml
|
24
|
+
attr_reader :fref
|
25
|
+
|
26
|
+
before(:all) do
|
27
|
+
@fref_xml = '<fundingReference>
|
28
|
+
<funderName>European Commission</funderName>
|
29
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/501100000780</funderIdentifier>
|
30
|
+
<awardNumber awardURI="http://cordis.europa.eu/project/rcn/100180_en.html">282625</awardNumber>
|
31
|
+
<awardTitle>MOTivational strength of ecosystem services and alternative ways to express the value of BIOdiversity</awardTitle>
|
32
|
+
</fundingReference>'.freeze
|
33
|
+
|
34
|
+
@fref = FundingReference.parse_xml(fref_xml)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'parses XML' do
|
38
|
+
expect(fref.name).to eq('European Commission')
|
39
|
+
|
40
|
+
id = fref.identifier
|
41
|
+
expect(id).to be_a(FunderIdentifier)
|
42
|
+
expect(id.type).to eq(FunderIdentifierType::CROSSREF_FUNDER_ID)
|
43
|
+
expect(id.value).to eq('http://doi.org/10.13039/501100000780')
|
44
|
+
|
45
|
+
award_number = fref.award_number
|
46
|
+
expect(award_number).to be_an(AwardNumber)
|
47
|
+
expect(award_number.value).to eq('282625')
|
48
|
+
expect(award_number.uri).to eq(URI('http://cordis.europa.eu/project/rcn/100180_en.html'))
|
49
|
+
|
50
|
+
expect(fref.award_title).to eq('MOTivational strength of ecosystem services and alternative ways to express the value of BIOdiversity')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'round-trips' do
|
54
|
+
xml = fref.write_xml
|
55
|
+
expect(xml).to be_xml(fref_xml)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -511,11 +511,28 @@ module Datacite
|
|
511
511
|
end
|
512
512
|
|
513
513
|
it 'correctly differentiates required and optional attributes'
|
514
|
+
|
515
|
+
it 'parses a Datacite 4.0 document with FundingReference' do
|
516
|
+
resource = Resource.parse_xml(File.read('spec/data/kernel-4.0/datacite-example-fundingReference-v.4.0.xml'))
|
517
|
+
funding_references = resource.funding_references
|
518
|
+
expect(funding_references.size).to eq(2)
|
519
|
+
funding_references.each do |fref|
|
520
|
+
expect(fref).to be_a(FundingReference)
|
521
|
+
end
|
522
|
+
end
|
514
523
|
end
|
515
524
|
|
516
525
|
describe '#save_to_xml' do
|
517
526
|
it 'sets the namespace to http://datacite.org/schema/kernel-3'
|
518
527
|
it "doesn't clobber the namespace on the various xml:lang attributes"
|
528
|
+
|
529
|
+
# TODO: make this work; maybe it's the language that's the issue?
|
530
|
+
xit 'round-trips a Datacite 4.0 document with FundingReference' do
|
531
|
+
xml_text = File.read('spec/data/kernel-4.0/datacite-example-fundingReference-v.4.0.xml')
|
532
|
+
resource = Resource.parse_xml(xml_text)
|
533
|
+
saved_xml = resource.save_to_xml
|
534
|
+
expect(saved_xml).to be_xml(xml_text)
|
535
|
+
end
|
519
536
|
end
|
520
537
|
|
521
538
|
describe 'identifier' do
|
@@ -688,7 +705,9 @@ module Datacite
|
|
688
705
|
|
689
706
|
describe '#parse_xml' do
|
690
707
|
it 'handles all Dash 1 documents' do
|
691
|
-
|
708
|
+
versions = []
|
709
|
+
|
710
|
+
Dir.glob('spec/data/dash1-datacite-xml/*mrt-datacite.xml') do |f|
|
692
711
|
basename = File.basename(f)
|
693
712
|
bad_contrib_regex = Regexp.new('<contributor contributorType="([^"]+)">\p{Space}*<contributor>([^<]+)</contributor>\p{Space}*</contributor>', Regexp::MULTILINE)
|
694
713
|
good_contrib_replacement = "<contributor contributorType=\"\\1\">\n<contributorName>\\2</contributorName>\n</contributor>"
|
@@ -704,6 +723,8 @@ module Datacite
|
|
704
723
|
end
|
705
724
|
next unless resource
|
706
725
|
|
726
|
+
versions << resource.version if resource.version
|
727
|
+
|
707
728
|
actual_xml = nil
|
708
729
|
begin
|
709
730
|
actual_xml = resource.write_xml
|
@@ -70,6 +70,16 @@ module Datacite
|
|
70
70
|
expected_xml = '<rights rightsURI="http://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal</rights>'
|
71
71
|
expect(rights.save_to_xml).to be_xml(expected_xml)
|
72
72
|
end
|
73
|
+
it 'works with convenience constants' do
|
74
|
+
rights = Rights::CC_ZERO
|
75
|
+
expected_xml = '<rights rightsURI="https://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal (CC0 1.0) Public Domain Dedication</rights>'
|
76
|
+
expect(rights.save_to_xml).to be_xml(expected_xml)
|
77
|
+
|
78
|
+
rights = Rights::CC_BY
|
79
|
+
expected_xml = '<rights rightsURI="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC-BY)</rights>'
|
80
|
+
expect(rights.save_to_xml).to be_xml(expected_xml)
|
81
|
+
end
|
82
|
+
|
73
83
|
end
|
74
84
|
end
|
75
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datacite-mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typesafe_enum
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- lib/datacite/mapping/creator.rb
|
217
217
|
- lib/datacite/mapping/date.rb
|
218
218
|
- lib/datacite/mapping/description.rb
|
219
|
+
- lib/datacite/mapping/funding_reference.rb
|
219
220
|
- lib/datacite/mapping/geo_location.rb
|
220
221
|
- lib/datacite/mapping/geo_location_box.rb
|
221
222
|
- lib/datacite/mapping/geo_location_point.rb
|
@@ -359,6 +360,8 @@ files:
|
|
359
360
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6w66hpn-mrt-datacite.xml
|
360
361
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6x63jt1-mrt-datacite.xml
|
361
362
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6z60kzd-mrt-datacite.xml
|
363
|
+
- spec/data/kernel-4.0/datacite-example-fundingReference-v.4.0.xml
|
364
|
+
- spec/data/kernel-4.0/metadata.xsd
|
362
365
|
- spec/data/metadata.xsd
|
363
366
|
- spec/data/mrt-datacite.xml
|
364
367
|
- spec/data/resource.xml
|
@@ -369,6 +372,7 @@ files:
|
|
369
372
|
- spec/unit/datacite/mapping/creator_spec.rb
|
370
373
|
- spec/unit/datacite/mapping/date_spec.rb
|
371
374
|
- spec/unit/datacite/mapping/description_spec.rb
|
375
|
+
- spec/unit/datacite/mapping/funding_reference_spec.rb
|
372
376
|
- spec/unit/datacite/mapping/geo_location_box_spec.rb
|
373
377
|
- spec/unit/datacite/mapping/geo_location_point_spec.rb
|
374
378
|
- spec/unit/datacite/mapping/geo_location_spec.rb
|
@@ -535,6 +539,8 @@ test_files:
|
|
535
539
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6w66hpn-mrt-datacite.xml
|
536
540
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6x63jt1-mrt-datacite.xml
|
537
541
|
- spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6z60kzd-mrt-datacite.xml
|
542
|
+
- spec/data/kernel-4.0/datacite-example-fundingReference-v.4.0.xml
|
543
|
+
- spec/data/kernel-4.0/metadata.xsd
|
538
544
|
- spec/data/metadata.xsd
|
539
545
|
- spec/data/mrt-datacite.xml
|
540
546
|
- spec/data/resource.xml
|
@@ -545,6 +551,7 @@ test_files:
|
|
545
551
|
- spec/unit/datacite/mapping/creator_spec.rb
|
546
552
|
- spec/unit/datacite/mapping/date_spec.rb
|
547
553
|
- spec/unit/datacite/mapping/description_spec.rb
|
554
|
+
- spec/unit/datacite/mapping/funding_reference_spec.rb
|
548
555
|
- spec/unit/datacite/mapping/geo_location_box_spec.rb
|
549
556
|
- spec/unit/datacite/mapping/geo_location_point_spec.rb
|
550
557
|
- spec/unit/datacite/mapping/geo_location_spec.rb
|