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.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +4 -0
  3. data/CHANGES.md +15 -0
  4. data/README.md +8 -3
  5. data/datacite-mapping.gemspec +2 -3
  6. data/lib/datacite/mapping.rb +1 -1
  7. data/lib/datacite/mapping/affiliation.rb +44 -0
  8. data/lib/datacite/mapping/alternate_identifier.rb +2 -0
  9. data/lib/datacite/mapping/contributor.rb +32 -6
  10. data/lib/datacite/mapping/contributor_name.rb +42 -0
  11. data/lib/datacite/mapping/creator.rb +39 -7
  12. data/lib/datacite/mapping/creator_name.rb +42 -0
  13. data/lib/datacite/mapping/date.rb +12 -0
  14. data/lib/datacite/mapping/date_value.rb +6 -0
  15. data/lib/datacite/mapping/description.rb +6 -2
  16. data/lib/datacite/mapping/empty_filtering_nodes.rb +1 -0
  17. data/lib/datacite/mapping/funding_reference.rb +14 -1
  18. data/lib/datacite/mapping/geo_location.rb +6 -1
  19. data/lib/datacite/mapping/geo_location_box.rb +5 -0
  20. data/lib/datacite/mapping/geo_location_node.rb +4 -2
  21. data/lib/datacite/mapping/geo_location_point.rb +3 -0
  22. data/lib/datacite/mapping/geo_location_polygon.rb +10 -1
  23. data/lib/datacite/mapping/identifier.rb +11 -9
  24. data/lib/datacite/mapping/module_info.rb +2 -2
  25. data/lib/datacite/mapping/name_identifier.rb +10 -6
  26. data/lib/datacite/mapping/name_type.rb +18 -0
  27. data/lib/datacite/mapping/publisher.rb +42 -0
  28. data/lib/datacite/mapping/read_only_nodes.rb +4 -0
  29. data/lib/datacite/mapping/related_identifier.rb +38 -1
  30. data/lib/datacite/mapping/resource.rb +25 -11
  31. data/lib/datacite/mapping/resource_type.rb +4 -0
  32. data/lib/datacite/mapping/rights.rb +33 -6
  33. data/lib/datacite/mapping/subject.rb +3 -2
  34. data/lib/datacite/mapping/title.rb +3 -2
  35. data/spec/data/datacite4/{datacite-example-Box_dateCollected_DataCollector-v4.0.xml → datacite-example-Box_dateCollected_DataCollector-v4.xml} +9 -11
  36. data/spec/data/datacite4/{datacite-example-GeoLocation-v4.0.xml → datacite-example-GeoLocation-v4.xml} +11 -10
  37. data/spec/data/datacite4/{datacite-example-HasMetadata-v4.0.xml → datacite-example-HasMetadata-v4.xml} +18 -13
  38. data/spec/data/datacite4/{datacite-example-ResearchGroup_Methods-v4.0.xml → datacite-example-ResearchGroup_Methods-v4.xml} +14 -12
  39. data/spec/data/datacite4/{datacite-example-ResourceTypeGeneral_Collection-v4.0.xml → datacite-example-ResourceTypeGeneral_Collection-v4.xml} +9 -9
  40. data/spec/data/datacite4/datacite-example-affiliation-v4.xml +114 -0
  41. data/spec/data/datacite4/{datacite-example-complicated-v4.0.xml → datacite-example-complicated-v4.xml} +14 -11
  42. data/spec/data/datacite4/datacite-example-datapaper-v4.xml +32 -0
  43. data/spec/data/datacite4/{datacite-example-dataset-v4.0.xml → datacite-example-dataset-v4.xml} +20 -14
  44. data/spec/data/datacite4/datacite-example-full-v4.xml +114 -0
  45. data/spec/data/datacite4/{datacite-example-fundingReference-v.4.0.xml → datacite-example-fundingReference-v4.xml} +16 -13
  46. data/spec/data/datacite4/datacite-example-polygon-advanced-v4.xml +141 -0
  47. data/spec/data/datacite4/datacite-example-polygon-v4.xml +161 -0
  48. data/spec/data/datacite4/{datacite-example-relationTypeIsIdenticalTo-v4.0.xml → datacite-example-relationTypeIsIdenticalTo-v4.xml} +17 -17
  49. data/spec/data/datacite4/datacite-example-software-v4.xml +66 -0
  50. data/spec/data/datacite4/{datacite-example-video-v4.0.xml → datacite-example-video-v4.xml} +7 -7
  51. data/spec/data/datacite4/{datacite-example-workflow-v4.0.xml → datacite-example-workflow-v4.xml} +13 -11
  52. data/spec/data/datacite4/metadata.xsd +102 -57
  53. data/spec/rspec_custom_matchers.rb +3 -0
  54. data/spec/unit/datacite/mapping/contributor_spec.rb +7 -1
  55. data/spec/unit/datacite/mapping/creator_spec.rb +9 -3
  56. data/spec/unit/datacite/mapping/resource_spec.rb +14 -17
  57. data/spec/unit/datacite/mapping/rights_spec.rb +0 -13
  58. metadata +42 -28
  59. data/spec/data/datacite4/datacite-example-full-v4.0.xml +0 -71
@@ -3,27 +3,27 @@
3
3
  <identifier identifierType="DOI">10.5072/1153992</identifier>
4
4
  <creators>
5
5
  <creator>
6
- <creatorName>Lynn, Briscoe</creatorName>
6
+ <creatorName nameType="Personal">Lynn, Briscoe</creatorName>
7
7
  <givenName>Briscoe</givenName>
8
8
  <familyName>Lynn</familyName>
9
9
  </creator>
10
10
  </creators>
11
11
  <titles>
12
- <title>Walking Your Space, Evaluating Your Home</title>
13
- <title titleType="Subtitle">Making Energy Efficiency Work for You</title>
12
+ <title xml:lang="en">Walking Your Space, Evaluating Your Home</title>
13
+ <title xml:lang="en" titleType="Subtitle">Making Energy Efficiency Work for You</title>
14
14
  </titles>
15
- <publisher>Photovoltaic Institute</publisher>
15
+ <publisher xml:lang="en">Photovoltaic Institute</publisher>
16
16
  <publicationYear>2013</publicationYear>
17
17
  <subjects>
18
- <subject>Solar Energy</subject>
18
+ <subject xml:lang="en">Solar Energy</subject>
19
19
  </subjects>
20
- <language>eng</language>
20
+ <language>en</language>
21
21
  <resourceType resourceTypeGeneral="Audiovisual">narrated video</resourceType>
22
22
  <formats>
23
23
  <format>MP4</format>
24
24
  </formats>
25
25
  <descriptions>
26
- <description descriptionType="Abstract">
26
+ <description xml:lang="en" descriptionType="Abstract">
27
27
  This hour-long video features John Halter as the narrator. Mr. Halter is best known as a journalist rather than a TV star, and here he plays that role as he does an "expose" type of walkthrough a new home. The home has been advertised as a house with
28
28
  the very latest in state-of-the art energy efficiency, especially solar. Mr. Halter puts the home through an investigation and determines that it can, indeed, live up to its claims.
29
29
  </description>
@@ -3,33 +3,33 @@
3
3
  <identifier identifierType="DOI">10.5072/100044</identifier>
4
4
  <creators>
5
5
  <creator>
6
- <creatorName>Luo, R</creatorName>
6
+ <creatorName nameType="Personal">Luo, R</creatorName>
7
7
  </creator>
8
8
  <creator>
9
- <creatorName>Liu, B</creatorName>
9
+ <creatorName nameType="Personal">Liu, B</creatorName>
10
10
  </creator>
11
11
  <creator>
12
- <creatorName>Xie, Y</creatorName>
12
+ <creatorName nameType="Personal">Xie, Y</creatorName>
13
13
  </creator>
14
14
  <creator>
15
- <creatorName>Li, Z</creatorName>
15
+ <creatorName nameType="Personal">Li, Z</creatorName>
16
16
  </creator>
17
17
  </creators>
18
18
  <titles>
19
- <title>
19
+ <title xml:lang="en">
20
20
  Software and supporting material for "SOAPdenovo2: An empirically improved memory-efficient short read de novo assembly"
21
21
  </title>
22
22
  </titles>
23
- <publisher>GigaScience Database</publisher>
23
+ <publisher xml:lang="en">GigaScience Database</publisher>
24
24
  <publicationYear>2012</publicationYear>
25
25
  <subjects>
26
- <subject>DNA (Genetics)</subject>
27
- <subject>Computer Program</subject>
26
+ <subject xml:lang="en">DNA (Genetics)</subject>
27
+ <subject xml:lang="en">Computer Program</subject>
28
28
  </subjects>
29
29
  <dates>
30
30
  <date dateType="Available">2012-12-13</date>
31
31
  </dates>
32
- <language>eng</language>
32
+ <language>en</language>
33
33
  <resourceType resourceTypeGeneral="Workflow">Software</resourceType>
34
34
  <relatedIdentifiers>
35
35
  <relatedIdentifier relatedIdentifierType="DOI" relationType="IsReferencedBy">10.5072/2047-217X-1-1</relatedIdentifier>
@@ -39,10 +39,12 @@
39
39
  <size>31 MB</size>
40
40
  </sizes>
41
41
  <rightsList>
42
- <rights rightsURI="http://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal</rights>
42
+ <rights rightsIdentifier="CC0 1.0" xml:lang="en-US"
43
+ schemeURI="https://spdx.org/licenses/" rightsIdentifierScheme="SPDX"
44
+ rightsURI="http://creativecommons.org/publicdomain/zero/1.0/" />
43
45
  </rightsList>
44
46
  <descriptions>
45
- <description descriptionType="Abstract">
47
+ <description xml:lang="en" descriptionType="Abstract">
46
48
  SOAPdenovo2 is the latest de novo genome assembly package from BGI's SOAP (short oligonucleotide analysis package) suite of tools (homepage here: http://soap.genomics.org.cn/). Compared to SOAPdenovo1, this new version has the advantage of a new
47
49
  algorithm design that reduces memory consumption in graph construction, resolves more repeat regions in contig assembly, increases coverage and length in scaffold construction, improves gap closure, and is optimized for large genomes. Using new
48
50
  sequencing data from the YH (Homo sapiens) diploid genome - the first sequenced Han Chinese individual, an updated assembly was produced (see dataset here: doi:10.5524/100038), with the N50 scores for the contig and scaffold being 3-fold and 50-fold
@@ -7,9 +7,13 @@
7
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
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
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"/>
10
+ 2016-09-19 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
+ 2017-10-23 v4.1: Addition of dateType value "Other", relationType values "Describes", "IsDescribedBy", "HasVersion", "IsVersionOf", "Requires", "IsRequiredBy", resourceType value "DataPaper", new subproperties "dateInformation", "inPolygonPoint", new attribute "nameType", optional attribute "resourceTypeGeneral" for relatedIdentifier
12
+ 2018-09-08 v4.1.1 Make schema 4.1 backwards compatible to 4.0 by allowing geolocation elements in any order
13
+ 2019-02-14 v4.2: Addition of dateType value "Withdrawn", relationType values "Obsoletes", "isObsoletedBy", addition of new subproperties for Rights: rightsIdentifier, rightsIdentifierScheme, schemeURI, addition of the XML language attribute to the properties Creator, Contributor and Publisher for organizational names, don't check format of DOI
14
+ 2019-07-13 v4.3: Addition of new subproperties for Affiliation: "affiliationIdentifier", "affiliationIdentifierScheme", "schemeURI", addition of new sub-property for funderIdentifier: "schemeURI", addition of new funderIdentifierScheme: "ROR", added documentation for nameIdentifier -->
15
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified" xml:lang="EN">
16
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="include/xml.xsd"/>
13
17
  <xs:include schemaLocation="include/datacite-titleType-v4.xsd"/>
14
18
  <xs:include schemaLocation="include/datacite-contributorType-v4.xsd"/>
15
19
  <xs:include schemaLocation="include/datacite-dateType-v4.xsd"/>
@@ -18,6 +22,7 @@
18
22
  <xs:include schemaLocation="include/datacite-relatedIdentifierType-v4.xsd"/>
19
23
  <xs:include schemaLocation="include/datacite-funderIdentifierType-v4.xsd"/>
20
24
  <xs:include schemaLocation="include/datacite-descriptionType-v4.xsd"/>
25
+ <xs:include schemaLocation="include/datacite-nameType-v4.xsd"/>
21
26
  <xs:element name="resource">
22
27
  <xs:annotation>
23
28
  <xs:documentation>
@@ -31,12 +36,11 @@
31
36
  <xs:element name="identifier">
32
37
  <xs:annotation>
33
38
  <xs:documentation>A persistent identifier that identifies a resource.</xs:documentation>
34
- <xs:documentation>Currently, only DOI is allowed.</xs:documentation>
35
39
  </xs:annotation>
36
40
  <xs:complexType>
37
41
  <xs:simpleContent>
38
- <xs:extension base="doiType">
39
- <xs:attribute name="identifierType" use="required" fixed="DOI"/>
42
+ <xs:extension base="nonemptycontentStringType">
43
+ <xs:attribute name="identifierType" use="required"/>
40
44
  </xs:extension>
41
45
  </xs:simpleContent>
42
46
  </xs:complexType>
@@ -53,23 +57,19 @@
53
57
  <xs:complexType>
54
58
  <xs:sequence>
55
59
  <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
60
  <xs:complexType>
64
61
  <xs:simpleContent>
65
- <xs:extension base="nonemptycontentStringType">
66
- <xs:attribute name="nameIdentifierScheme" use="required"/>
67
- <xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
62
+ <xs:extension base="xs:string">
63
+ <xs:attribute name="nameType" type="nameType" use="optional"/>
64
+ <xs:attribute ref="xml:lang"/>
68
65
  </xs:extension>
69
66
  </xs:simpleContent>
70
67
  </xs:complexType>
71
68
  </xs:element>
72
- <xs:element name="affiliation" minOccurs="0" maxOccurs="unbounded"/>
69
+ <xs:element name="givenName" minOccurs="0"/>
70
+ <xs:element name="familyName" minOccurs="0"/>
71
+ <xs:element name="nameIdentifier" xsi:type="nameIdentifier" minOccurs="0" maxOccurs="unbounded"/>
72
+ <xs:element name="affiliation" xsi:type="affiliation" minOccurs="0" maxOccurs="unbounded"/>
73
73
  </xs:sequence>
74
74
  </xs:complexType>
75
75
  </xs:element>
@@ -85,7 +85,7 @@
85
85
  </xs:annotation>
86
86
  <xs:complexType>
87
87
  <xs:simpleContent>
88
- <xs:extension base="nonemptycontentStringType">
88
+ <xs:extension base="xs:string">
89
89
  <xs:attribute name="titleType" type="titleType" use="optional"/>
90
90
  <xs:attribute ref="xml:lang"/>
91
91
  </xs:extension>
@@ -100,9 +100,13 @@
100
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
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
102
  </xs:annotation>
103
- <xs:simpleType>
104
- <xs:restriction base="nonemptycontentStringType"/>
105
- </xs:simpleType>
103
+ <xs:complexType>
104
+ <xs:simpleContent>
105
+ <xs:extension base="nonemptycontentStringType">
106
+ <xs:attribute ref="xml:lang"/>
107
+ </xs:extension>
108
+ </xs:simpleContent>
109
+ </xs:complexType>
106
110
  </xs:element>
107
111
  <xs:element name="publicationYear">
108
112
  <xs:annotation>
@@ -160,25 +164,19 @@
160
164
  <xs:complexType>
161
165
  <xs:sequence>
162
166
  <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
167
  <xs:complexType>
173
168
  <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"/>
169
+ <xs:extension base="nonemptycontentStringType">
170
+ <xs:attribute name="nameType" type="nameType" use="optional"/>
171
+ <xs:attribute ref="xml:lang"/>
177
172
  </xs:extension>
178
173
  </xs:simpleContent>
179
174
  </xs:complexType>
180
175
  </xs:element>
181
- <xs:element name="affiliation" minOccurs="0" maxOccurs="unbounded"/>
176
+ <xs:element name="givenName" minOccurs="0"/>
177
+ <xs:element name="familyName" minOccurs="0"/>
178
+ <xs:element name="nameIdentifier" xsi:type="nameIdentifier" minOccurs="0" maxOccurs="unbounded"/>
179
+ <xs:element name="affiliation" xsi:type="affiliation" minOccurs="0" maxOccurs="unbounded"/>
182
180
  </xs:sequence>
183
181
  <xs:attribute name="contributorType" type="contributorType" use="required"/>
184
182
  </xs:complexType>
@@ -198,6 +196,7 @@
198
196
  <xs:simpleContent>
199
197
  <xs:extension base="xs:string">
200
198
  <xs:attribute name="dateType" type="dateType" use="required"/>
199
+ <xs:attribute name="dateInformation" use="optional"/>
201
200
  </xs:extension>
202
201
  </xs:simpleContent>
203
202
  </xs:complexType>
@@ -238,6 +237,7 @@
238
237
  <xs:complexType>
239
238
  <xs:simpleContent>
240
239
  <xs:extension base="xs:string">
240
+ <xs:attribute name="resourceTypeGeneral" type="resourceType" use="optional"/>
241
241
  <xs:attribute name="relatedIdentifierType" type="relatedIdentifierType" use="required"/>
242
242
  <xs:attribute name="relationType" type="relationType" use="required"/>
243
243
  <xs:attribute name="relatedMetadataScheme" use="optional"/>
@@ -291,6 +291,10 @@ Use the complete title of a license and include version information if applicabl
291
291
  <xs:simpleContent>
292
292
  <xs:extension base="xs:string">
293
293
  <xs:attribute name="rightsURI" type="xs:anyURI" use="optional"/>
294
+ <xs:attribute name="rightsIdentifier" use="optional"/>
295
+ <xs:attribute name="rightsIdentifierScheme" use="optional"/>
296
+ <xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
297
+ <xs:attribute ref="xml:lang"/>
294
298
  </xs:extension>
295
299
  </xs:simpleContent>
296
300
  </xs:complexType>
@@ -308,11 +312,7 @@ Use the complete title of a license and include version information if applicabl
308
312
  <xs:complexType mixed="true">
309
313
  <xs:choice>
310
314
  <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>
315
+ <xs:complexType/>
316
316
  </xs:element>
317
317
  </xs:choice>
318
318
  <xs:attribute name="descriptionType" type="descriptionType" use="required"/>
@@ -327,7 +327,7 @@ Use the complete title of a license and include version information if applicabl
327
327
  <xs:sequence>
328
328
  <xs:element name="geoLocation" minOccurs="0" maxOccurs="unbounded">
329
329
  <xs:complexType>
330
- <xs:all>
330
+ <xs:choice maxOccurs="unbounded">
331
331
  <xs:element name="geoLocationPlace" minOccurs="0">
332
332
  <xs:annotation>
333
333
  <xs:documentation>Spatial region or named place where the data was gathered or about which the data is focused.</xs:documentation>
@@ -335,7 +335,7 @@ Use the complete title of a license and include version information if applicabl
335
335
  </xs:element>
336
336
  <xs:element name="geoLocationPoint" type="point" minOccurs="0">
337
337
  <xs:annotation>
338
- <xs:documentation>A point contains a single latitude-longitude pair, separated by whitespace.</xs:documentation>
338
+ <xs:documentation>A point contains a single latitude-longitude pair.</xs:documentation>
339
339
  </xs:annotation>
340
340
  </xs:element>
341
341
  <xs:element name="geoLocationBox" type="box" minOccurs="0">
@@ -343,17 +343,18 @@ Use the complete title of a license and include version information if applicabl
343
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
344
  </xs:annotation>
345
345
  </xs:element>
346
- <xs:element name="geoLocationPolygon" minOccurs="0">
346
+ <xs:element name="geoLocationPolygon" minOccurs="0" maxOccurs="unbounded">
347
347
  <xs:annotation>
348
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
349
  </xs:annotation>
350
350
  <xs:complexType>
351
351
  <xs:sequence>
352
- <xs:element name="polygonPoint" type="point" minOccurs="3" maxOccurs="unbounded"/>
352
+ <xs:element name="polygonPoint" type="point" minOccurs="4" maxOccurs="unbounded"/>
353
+ <xs:element name="inPolygonPoint" type="point" minOccurs="0" maxOccurs="1"/>
353
354
  </xs:sequence>
354
355
  </xs:complexType>
355
356
  </xs:element>
356
- </xs:all>
357
+ </xs:choice>
357
358
  </xs:complexType>
358
359
  </xs:element>
359
360
  </xs:sequence>
@@ -384,6 +385,7 @@ Use the complete title of a license and include version information if applicabl
384
385
  <xs:simpleContent>
385
386
  <xs:extension base="xs:string">
386
387
  <xs:attribute name="funderIdentifierType" type="funderIdentifierType" use="required"/>
388
+ <xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
387
389
  </xs:extension>
388
390
  </xs:simpleContent>
389
391
  </xs:complexType>
@@ -404,9 +406,6 @@ Use the complete title of a license and include version information if applicabl
404
406
  <xs:annotation>
405
407
  <xs:documentation>The human readable title of the award (grant).</xs:documentation>
406
408
  </xs:annotation>
407
- <xs:simpleType>
408
- <xs:restriction base="nonemptycontentStringType"/>
409
- </xs:simpleType>
410
409
  </xs:element>
411
410
  </xs:all>
412
411
  </xs:complexType>
@@ -418,22 +417,68 @@ Use the complete title of a license and include version information if applicabl
418
417
  </xs:complexType>
419
418
  </xs:element>
420
419
  <!-- 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
420
  <!-- defines value for mandatory fields -->
428
421
  <xs:simpleType name="nonemptycontentStringType">
429
422
  <xs:restriction base="xs:string">
430
423
  <xs:minLength value="1"/>
431
424
  </xs:restriction>
432
425
  </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>
426
+ <!-- definition for nameIdentifier -->
427
+ <xs:complexType name="nameIdentifier">
428
+ <xs:annotation>
429
+ <xs:documentation>Uniquely identifies a creator or contributor, according to various identifier schemes.</xs:documentation>
430
+ </xs:annotation>
431
+ <xs:simpleContent>
432
+ <xs:extension base="nonemptycontentStringType">
433
+ <xs:attribute name="nameIdentifierScheme" type="xs:string" use="required"/>
434
+ <xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
435
+ </xs:extension>
436
+ </xs:simpleContent>
437
+ </xs:complexType>
438
+ <!-- definition for EDTF dates, modified from PREMIS 2.0 -->
439
+ <xs:simpleType name="edtf">
440
+ <xs:restriction base="xs:string">
441
+ <!-- pattern for iso8601 dateTime -->
442
+ <xs:pattern value="(-)?[0-9]{4}(-[0-9]{2})?(-[0-9]{2})?(T([0-9]{2}:){2}[0-9]{2}Z)?"/>
443
+
444
+ <!--
445
+ The following pattern is for year (yyyy) or year-month (yyyy-mm)
446
+ The last or last two digits of year may be '?' meaning "one year in that range but not sure which year", for example 19?? means some year from 1990 to 1999. Similarly month may be '??' so that 2004-?? "means some month in 2004". And the entire string may end with '?' or '~' for "uncertain" or "approximate".
447
+ Hyphen must separate year and month.
448
+ -->
449
+ <xs:pattern value="\d{2}(\d{2}|\?\?|\d(\d|\?))(-(\d{2}|\?\?))?~?\??"/>
450
+ <!--
451
+ The following pattern is for yearMonthDay - yyyymmdd, where 'dd' may be '??' so '200412??' means "some day during the month of 12/2004".
452
+ The whole string may be followed by '?' or '~' to mean "questionable" or "approximate". Hypens are not allowed for this pattern.
453
+ -->
454
+ <xs:pattern value="\d{6}(\d{2}|\?\?)~?\??"/>
455
+ <!--
456
+
457
+ The following pattern is for date and time with T separator:'yyyymmddThhmmss'.
458
+ Hypens in date and colons in time not allowed for this pattern.
459
+ -->
460
+ <xs:pattern value="\d{8}T\d{6}"/>
461
+ <!--
462
+
463
+ The following pattern is for a date range. in years: 'yyyy/yyyy'; or year/month: yyyy-mm/yyyy-mm, or year/month/day: yyyy-mm-dd/yyyy-mm-dd. Beginning or end of range value may be 'unknown'. End of range value may be 'open'.
464
+ Hypens mandatory when month is present.
465
+ -->
466
+ <xs:pattern value="((-)?(\d{4}(-\d{2})?(-\d{2})?)|unknown)/((-)?(\d{4}(-\d{2})?(-\d{2})?)|unknown|open)"/>
467
+ </xs:restriction>
468
+ </xs:simpleType>
469
+ <!-- definition for affiliation -->
470
+ <xs:complexType name="affiliation">
471
+ <xs:annotation>
472
+ <xs:documentation>Uniquely identifies an affiliation, according to various identifier schemes.</xs:documentation>
473
+ </xs:annotation>
474
+ <xs:simpleContent>
475
+ <xs:extension base="nonemptycontentStringType">
476
+ <xs:attribute name="affiliationIdentifier" type="xs:string" use="optional"/>
477
+ <xs:attribute name="affiliationIdentifierScheme" type="xs:string" use="optional"/>
478
+ <xs:attribute name="schemeURI" type="xs:anyURI" use="optional"/>
479
+ </xs:extension>
480
+ </xs:simpleContent>
481
+ </xs:complexType>
437
482
  <!-- defines the value for a year -->
438
483
  <xs:simpleType name="yearType">
439
484
  <xs:restriction base="xs:token">
@@ -7,6 +7,7 @@ RSpec::Matchers.define :be_xml do |expected|
7
7
 
8
8
  def to_nokogiri(xml)
9
9
  return nil unless xml
10
+
10
11
  case xml
11
12
  when Nokogiri::XML::Element
12
13
  xml
@@ -23,6 +24,7 @@ RSpec::Matchers.define :be_xml do |expected|
23
24
 
24
25
  def to_pretty(nokogiri)
25
26
  return nil unless nokogiri
27
+
26
28
  out = StringIO.new
27
29
  save_options = Nokogiri::XML::Node::SaveOptions::FORMAT | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
28
30
  nokogiri.write_xml_to(out, encoding: 'UTF-8', indent: 2, save_with: save_options)
@@ -62,6 +64,7 @@ RSpec::Matchers.define :be_time do |expected|
62
64
  return actual.nil? unless expected
63
65
 
64
66
  raise "Expected value #{expected} is not a Time" unless expected.is_a?(Time)
67
+
65
68
  actual.is_a?(Time) && (to_string(expected) == to_string(actual))
66
69
  end
67
70
 
@@ -57,6 +57,13 @@ module Datacite
57
57
  contrib.name = 'Hershlag, Natalie'
58
58
  expect(contrib.name).to eq('Hershlag, Natalie')
59
59
  end
60
+ it 'sets the name with ContributorName' do
61
+ contributor = Contributor.allocate
62
+ contributor.contributor_name = ContributorName.new(value: 'Spencer Tracy')
63
+ expect(contributor.name).to eq('Spencer Tracy')
64
+ contributor.name = ContributorName.new(value: 'Katharine Hepburn')
65
+ expect(contributor.name).to eq('Katharine Hepburn')
66
+ end
60
67
  it 'rejects nil' do
61
68
  contrib = Contributor.new(name: 'Hershlag, Natalie', type: ContributorType::PROJECT_MEMBER)
62
69
  expect { contrib.name = nil }.to raise_error(ArgumentError)
@@ -99,7 +106,6 @@ module Datacite
99
106
  </contributor>'
100
107
  contributor = Contributor.parse_xml(xml_text)
101
108
  expect(contributor.name).to eq('Hershlag, Natalie')
102
- expect(contributor.affiliations).to eq(['Gaumont Buena Vista International', '20th Century Fox'])
103
109
  id = contributor.identifier
104
110
  expect(id.scheme).to eq('ISNI')
105
111
  expect(id.scheme_uri).to eq(URI('http://isni.org'))
@@ -20,7 +20,7 @@ module Datacite
20
20
 
21
21
  it 'sets affiliations' do
22
22
  creator = Creator.new(name: 'Hedy Lamarr', affiliations: ['United Artists', 'Metro-Goldwyn-Mayer'])
23
- expect(creator.affiliations).to eq(['United Artists', 'Metro-Goldwyn-Mayer'])
23
+ expect(creator.affiliation_names).to eq(['United Artists', 'Metro-Goldwyn-Mayer'])
24
24
  end
25
25
 
26
26
  it 'defaults to an empty affiliation array' do
@@ -45,6 +45,13 @@ module Datacite
45
45
  creator.name = 'Hedy Lamarr'
46
46
  expect(creator.name).to eq('Hedy Lamarr')
47
47
  end
48
+ it 'sets the name with CreatorName' do
49
+ creator = Creator.allocate
50
+ creator.creator_name = CreatorName.new(value: 'Spencer Tracy')
51
+ expect(creator.name).to eq('Spencer Tracy')
52
+ creator.name = CreatorName.new(value: 'Katharine Hepburn')
53
+ expect(creator.name).to eq('Katharine Hepburn')
54
+ end
48
55
  it 'rejects nil' do
49
56
  creator = Creator.new(name: 'Hedy Lamarr')
50
57
  expect { creator.name = nil }.to raise_error(ArgumentError)
@@ -113,7 +120,7 @@ module Datacite
113
120
  creator = Creator.allocate
114
121
  affiliations = ['United Artists', 'Metro-Goldwyn-Mayer']
115
122
  creator.affiliations = affiliations
116
- expect(creator.affiliations).to eq(affiliations)
123
+ expect(creator.affiliation_names).to eq(affiliations)
117
124
  end
118
125
  it 'treats nil as empty' do
119
126
  creator = Creator.new(name: 'Hedy Lamarr', affiliations: ['United Artists', 'Metro-Goldwyn-Mayer'])
@@ -137,7 +144,6 @@ module Datacite
137
144
  </creator>'
138
145
  creator = Creator.parse_xml(xml_text)
139
146
  expect(creator.name).to eq('Hedy Lamarr')
140
- expect(creator.affiliations).to eq(['United Artists', 'Metro-Goldwyn-Mayer'])
141
147
  id = creator.identifier
142
148
  expect(id.scheme).to eq('ISNI')
143
149
  expect(id.scheme_uri).to eq(URI('http://isni.org'))