commonmeta-ruby 3.9.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -11
  3. data/lib/commonmeta/author_utils.rb +12 -5
  4. data/lib/commonmeta/readers/commonmeta_reader.rb +1 -1
  5. data/lib/commonmeta/readers/datacite_reader.rb +120 -108
  6. data/lib/commonmeta/schema_utils.rb +1 -1
  7. data/lib/commonmeta/utils.rb +47 -2
  8. data/lib/commonmeta/version.rb +1 -1
  9. data/lib/commonmeta/writers/commonmeta_writer.rb +1 -1
  10. data/resources/{commonmeta_v0.10.5.json → commonmeta_v0.10.7.json} +21 -5
  11. data/resources/{datacite-v4.json → datacite-v45.json} +26 -5
  12. data/resources/kernel-4/include/datacite-relationType-v4.xsd +2 -0
  13. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +2 -0
  14. data/resources/kernel-4/metadata.xsd +11 -7
  15. data/spec/author_utils_spec.rb +10 -0
  16. data/spec/fixtures/commonmeta.json +1 -1
  17. data/spec/fixtures/datacite-dataset_v4.5.json +736 -0
  18. data/spec/fixtures/datacite-instrument.json +135 -0
  19. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/SoftwareSourceCode.yml +8 -8
  20. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/dissertation.yml +12 -12
  21. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/funding_references.yml +12 -12
  22. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/subject_scheme.yml +22 -22
  23. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/medium_post_with_institutional_author.yml +317 -0
  24. data/spec/readers/commonmeta_reader_spec.rb +1 -1
  25. data/spec/readers/datacite_reader_spec.rb +68 -14
  26. data/spec/readers/json_feed_reader_spec.rb +25 -0
  27. data/spec/utils_spec.rb +30 -4
  28. data/spec/writers/commonmeta_writer_spec.rb +30 -3
  29. data/spec/writers/csl_writer_spec.rb +1 -0
  30. data/spec/writers/csv_writer_spec.rb +1 -0
  31. data/spec/writers/datacite_writer_spec.rb +0 -1
  32. metadata +7 -4
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "id": "datacite-v4.json",
4
- "title": "DataCite v4",
5
- "description": "JSON representation of the DataCite v4 schema.",
3
+ "id": "datacite-v45.json",
4
+ "title": "DataCite v4.5",
5
+ "description": "JSON representation of the DataCite v4.5 schema.",
6
6
  "additionalProperties": true,
7
7
  "definitions": {
8
8
  "nameType": {
@@ -110,6 +110,7 @@
110
110
  "Dissertation",
111
111
  "Event",
112
112
  "Image",
113
+ "Instrument",
113
114
  "InteractiveResource",
114
115
  "Journal",
115
116
  "JournalArticle",
@@ -123,6 +124,7 @@
123
124
  "Software",
124
125
  "Sound",
125
126
  "Standard",
127
+ "StudyRegistration",
126
128
  "Text",
127
129
  "Workflow",
128
130
  "Other"
@@ -187,7 +189,9 @@
187
189
  "IsRequiredBy",
188
190
  "Requires",
189
191
  "IsObsoletedBy",
190
- "Obsoletes"
192
+ "Obsoletes",
193
+ "Collects",
194
+ "IsCollectedBy"
191
195
  ]
192
196
  },
193
197
  "descriptionType": {
@@ -276,7 +280,24 @@
276
280
  "uniqueItems": true
277
281
  },
278
282
  "publisher": {
279
- "type": "string"
283
+ "type": ["object", "string"],
284
+ "anyOf": [
285
+ {
286
+ "type": "object",
287
+ "properties": {
288
+ "name": { "type": "string" },
289
+ "publisherIdentifier": { "type": "string", "format": "uri" },
290
+ "publisherIdentifierScheme": { "type": "string" },
291
+ "schemeUri": { "type": "string", "format": "uri" },
292
+ "lang": { "type": "string" }
293
+ },
294
+ "required": ["name"]
295
+ },
296
+ {
297
+ "type": "string",
298
+ "minLength": 1
299
+ }
300
+ ]
280
301
  },
281
302
  "publication_year": {
282
303
  "type": "integer"
@@ -46,6 +46,8 @@
46
46
  <xs:enumeration value="IsRequiredBy" />
47
47
  <xs:enumeration value="Obsoletes" />
48
48
  <xs:enumeration value="IsObsoletedBy" />
49
+ <xs:enumeration value="Collects" />
50
+ <xs:enumeration value="IsCollectedBy" />
49
51
  </xs:restriction>
50
52
  </xs:simpleType>
51
53
  </xs:schema>
@@ -22,6 +22,7 @@
22
22
  <xs:enumeration value="Dissertation" />
23
23
  <xs:enumeration value="Event" />
24
24
  <xs:enumeration value="Image" />
25
+ <xs:enumeration value="Instrument" />
25
26
  <xs:enumeration value="InteractiveResource" />
26
27
  <xs:enumeration value="Journal" />
27
28
  <xs:enumeration value="JournalArticle" />
@@ -35,6 +36,7 @@
35
36
  <xs:enumeration value="Software" />
36
37
  <xs:enumeration value="Sound" />
37
38
  <xs:enumeration value="Standard" />
39
+ <xs:enumeration value="StudyRegistration" />
38
40
  <xs:enumeration value="Text" />
39
41
  <xs:enumeration value="Workflow" />
40
42
  <xs:enumeration value="Other" />
@@ -2,7 +2,7 @@
2
2
  <!-- Revision history
3
3
  2010-08-26 Complete revision according to new common specification by the metadata work group after review. AJH, DTIC
4
4
  2010-11-17 Revised to current state of kernel review, FZ, TIB
5
- 2011-01-17 Complete revsion after community review. FZ, TIB
5
+ 2011-01-17 Complete revision after community review. FZ, TIB
6
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
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"
@@ -12,7 +12,8 @@
12
12
  2018-09-08 v4.1.1 Make schema 4.1 backwards compatible to 4.0 by allowing geolocation elements in any order
13
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
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
- 2021-03-08 v4.4: Addition of new property relatedItem, relationType value "isPublishedIn", subject subproperty "classificationCode", controlled list "numberType", additional 13 properties for controlled list "resourceType" -->
15
+ 2021-03-08 v4.4: Addition of new property relatedItem, relationType value "isPublishedIn", subject subproperty "classificationCode", controlled list "numberType", additional 13 properties for controlled list "resourceType"
16
+ 2024-01-22 v4.5: Addition of new subproperties for publisher: "publisherIdentifier", "publisherIdentifierScheme", and "schemeURI"; addition of new resourceTypeGeneral values "Instrument" and "StudyRegistration"; addition of new relationType values "Collects" and "IsCollectedBy".-->
16
17
  <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">
17
18
  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="include/xml.xsd" />
18
19
  <xs:include schemaLocation="include/datacite-titleType-v4.xsd" />
@@ -105,6 +106,9 @@
105
106
  <xs:complexType>
106
107
  <xs:simpleContent>
107
108
  <xs:extension base="nonemptycontentStringType">
109
+ <xs:attribute name="publisherIdentifier" type="xs:string" use="optional" />
110
+ <xs:attribute name="publisherIdentifierScheme" type="xs:string" use="optional" />
111
+ <xs:attribute name="schemeURI" type="xs:anyURI" use="optional" />
108
112
  <xs:attribute ref="xml:lang" />
109
113
  </xs:extension>
110
114
  </xs:simpleContent>
@@ -161,7 +165,7 @@
161
165
  <xs:sequence>
162
166
  <xs:element name="contributor" minOccurs="0" maxOccurs="unbounded">
163
167
  <xs:annotation>
164
- <xs:documentation>The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.</xs:documentation>
168
+ <xs:documentation>The institution or person responsible for collecting, creating, or otherwise contributing to the development of the dataset.</xs:documentation>
165
169
  <xs:documentation>The personal name format should be: Family, Given.</xs:documentation>
166
170
  </xs:annotation>
167
171
  <xs:complexType>
@@ -524,7 +528,7 @@ Use the complete title of a license and include version information if applicabl
524
528
  </xs:element>
525
529
  <xs:element name="number" minOccurs="0">
526
530
  <xs:annotation>
527
- <xs:documentation>Issue number or name of the related item.</xs:documentation>
531
+ <xs:documentation>Number of the related item e.g. report number of article number.</xs:documentation>
528
532
  </xs:annotation>
529
533
  <xs:complexType>
530
534
  <xs:simpleContent>
@@ -641,19 +645,19 @@ Use the complete title of a license and include version information if applicabl
641
645
  <xs:pattern value="\d{2}(\d{2}|\?\?|\d(\d|\?))(-(\d{2}|\?\?))?~?\??" />
642
646
  <!--
643
647
  The following pattern is for yearMonthDay - yyyymmdd, where 'dd' may be '??' so '200412??' means "some day during the month of 12/2004".
644
- The whole string may be followed by '?' or '~' to mean "questionable" or "approximate". Hypens are not allowed for this pattern.
648
+ The whole string may be followed by '?' or '~' to mean "questionable" or "approximate". Hyphens are not allowed for this pattern.
645
649
  -->
646
650
  <xs:pattern value="\d{6}(\d{2}|\?\?)~?\??" />
647
651
  <!--
648
652
 
649
653
  The following pattern is for date and time with T separator:'yyyymmddThhmmss'.
650
- Hypens in date and colons in time not allowed for this pattern.
654
+ Hyphens in date and colons in time not allowed for this pattern.
651
655
  -->
652
656
  <xs:pattern value="\d{8}T\d{6}" />
653
657
  <!--
654
658
 
655
659
  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'.
656
- Hypens mandatory when month is present.
660
+ Hyphens mandatory when month is present.
657
661
  -->
658
662
  <xs:pattern value="((-)?(\d{4}(-\d{2})?(-\d{2})?)|unknown)/((-)?(\d{4}(-\d{2})?(-\d{2})?)|unknown|open)" />
659
663
  </xs:restriction>
@@ -58,6 +58,16 @@ describe Commonmeta::Metadata, vcr: true do
58
58
  author = { "name" => "Tejas S. Sathe, MD" }
59
59
  expect(subject.is_personal_name?(name: author["name"])).to be true
60
60
  end
61
+
62
+ it "name with organization string" do
63
+ author = { "name" => "University of California, Santa Barbara" }
64
+ expect(subject.is_personal_name?(name: author["name"])).to be false
65
+ end
66
+
67
+ it "name with another organization string" do
68
+ author = { "name" => "Research Graph" }
69
+ expect(subject.is_personal_name?(name: author["name"])).to be false
70
+ end
61
71
  end
62
72
 
63
73
  context "cleanup_author" do
@@ -406,6 +406,6 @@
406
406
  ],
407
407
  "subjects": [],
408
408
  "provider": "Crossref",
409
- "schema_version": "https://commonmeta.org/commonmeta_v0.10.5.json",
409
+ "schema_version": "https://commonmeta.org/commonmeta_v0.10",
410
410
  "state": "findable"
411
411
  }