commonmeta-ruby 3.9.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/commonmeta/author_utils.rb +9 -5
- data/lib/commonmeta/readers/commonmeta_reader.rb +1 -1
- data/lib/commonmeta/readers/datacite_reader.rb +7 -1
- data/lib/commonmeta/schema_utils.rb +1 -1
- data/lib/commonmeta/utils.rb +47 -2
- data/lib/commonmeta/version.rb +1 -1
- data/resources/{commonmeta_v0.10.5.json → commonmeta_v0.10.6.json} +12 -4
- data/resources/{datacite-v4.json → datacite-v45.json} +26 -5
- data/resources/kernel-4/include/datacite-relationType-v4.xsd +2 -0
- data/resources/kernel-4/include/datacite-resourceType-v4.xsd +2 -0
- data/resources/kernel-4/metadata.xsd +11 -7
- data/spec/fixtures/commonmeta.json +1 -1
- data/spec/fixtures/datacite-dataset_v4.5.json +736 -0
- data/spec/fixtures/datacite-instrument.json +135 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/SoftwareSourceCode.yml +8 -8
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/dissertation.yml +12 -12
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/funding_references.yml +12 -12
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/subject_scheme.yml +22 -22
- data/spec/readers/commonmeta_reader_spec.rb +1 -1
- data/spec/readers/datacite_reader_spec.rb +34 -9
- data/spec/utils_spec.rb +30 -4
- data/spec/writers/datacite_writer_spec.rb +0 -1
- metadata +6 -4
|
@@ -36,13 +36,12 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
36
36
|
# expect(subject.valid?).to be true
|
|
37
37
|
expect(subject.id).to eq("https://doi.org/10.5063/f1m61h5x")
|
|
38
38
|
expect(subject.type).to eq("Software")
|
|
39
|
-
expect(subject.contributors).to eq([{"contributorRoles"=>["Author"],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
expect(subject.
|
|
44
|
-
expect(subject.
|
|
45
|
-
expect(subject.publisher).to eq("name"=>"KNB Data Repository")
|
|
39
|
+
expect(subject.contributors).to eq([{ "contributorRoles" => ["Author"],
|
|
40
|
+
"name" => "Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott",
|
|
41
|
+
"type" => "Organization" }])
|
|
42
|
+
expect(subject.titles).to eq([{ "title" => "dataone: R interface to the DataONE network of data repositories" }])
|
|
43
|
+
expect(subject.date).to eq("created" => "2016-03-12", "published" => "2016", "registered" => "2016-03-12", "updated" => "2020-09-18")
|
|
44
|
+
expect(subject.publisher).to eq("name" => "KNB Data Repository")
|
|
46
45
|
expect(subject.provider).to eq("DataCite")
|
|
47
46
|
end
|
|
48
47
|
|
|
@@ -70,8 +69,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
70
69
|
expect(subject.type).to eq("Dissertation")
|
|
71
70
|
expect(subject.contributors.length).to eq(3)
|
|
72
71
|
expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
|
|
73
|
-
|
|
74
|
-
expect(subject.contributors.last).to eq("id"=>"https://orcid.org/0000-0002-8633-8234", "type"=>"Person", "contributorRoles"=>["Supervision"], "givenName"=>"Gerhard", "familyName"=>"Gruebel", "affiliation"=>[{"name"=>"Deutsches Elektronen-Synchrotron"}])
|
|
72
|
+
"givenName" => "Heiko", "familyName" => "Conrad")
|
|
73
|
+
expect(subject.contributors.last).to eq("id" => "https://orcid.org/0000-0002-8633-8234", "type" => "Person", "contributorRoles" => ["Supervision"], "givenName" => "Gerhard", "familyName" => "Gruebel", "affiliation" => [{ "name" => "Deutsches Elektronen-Synchrotron" }])
|
|
75
74
|
expect(subject.titles).to eq([{ "title" => "Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy" }])
|
|
76
75
|
expect(subject.date).to eq("created" => "2018-01-25", "published" => "2014",
|
|
77
76
|
"registered" => "2018-01-25", "updated" => "2020-09-19")
|
|
@@ -155,5 +154,31 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
155
154
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
|
156
155
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
|
157
156
|
end
|
|
157
|
+
|
|
158
|
+
it "dataset schema v4.5" do
|
|
159
|
+
input = "#{fixture_path}datacite-dataset_v4.5.json"
|
|
160
|
+
subject = described_class.new(input: input)
|
|
161
|
+
expect(subject.id).to eq("https://doi.org/10.82433/b09z-4k37")
|
|
162
|
+
expect(subject.type).to eq("Dataset")
|
|
163
|
+
expect(subject.contributors.length).to eq(23)
|
|
164
|
+
expect(subject.contributors[0]).to eq("contributorRoles" => ["Author"], "familyName" => "ExampleFamilyName", "givenName" => "ExampleGivenName", "type" => "Person")
|
|
165
|
+
expect(subject.contributors[2]).to eq("contributorRoles" => ["ContactPerson"], "familyName" => "ExampleFamilyName", "givenName" => "ExampleGivenName", "type" => "Person")
|
|
166
|
+
expect(subject.date).to eq("created"=>"2022-10-27", "published"=>"2022", "registered"=>"2022-10-27", "updated"=>"2024-01-02")
|
|
167
|
+
expect(subject.publisher).to eq("name" => "Example Publisher")
|
|
168
|
+
expect(subject.license).to eq("id"=>"CC-PDDC", "url"=>"https://creativecommons.org/licenses/publicdomain/")
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "instrument" do
|
|
172
|
+
input = "#{fixture_path}datacite-instrument.json"
|
|
173
|
+
subject = described_class.new(input: input)
|
|
174
|
+
expect(subject.valid?).to be true
|
|
175
|
+
expect(subject.id).to eq("https://doi.org/10.82433/08qf-ee96")
|
|
176
|
+
expect(subject.type).to eq("Instrument")
|
|
177
|
+
expect(subject.contributors.length).to eq(2)
|
|
178
|
+
expect(subject.contributors.first).to eq("contributorRoles" => ["Author"], "name" => "DECTRIS", "type" => "Organization", "id" => "https://www.wikidata.org/wiki/Q107529885")
|
|
179
|
+
expect(subject.date).to eq("created" => "2022-10-20", "published" => "2022", "registered" => "2022-10-20", "updated" => "2024-01-02")
|
|
180
|
+
expect(subject.publisher).to eq("name" => "Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences")
|
|
181
|
+
expect(subject.license).to be_nil
|
|
182
|
+
end
|
|
158
183
|
end
|
|
159
184
|
end
|
data/spec/utils_spec.rb
CHANGED
|
@@ -502,7 +502,7 @@ describe Commonmeta::Metadata do
|
|
|
502
502
|
links = [{ "rel" => "self", "type" => "application/atom+xml", "href" => "https://syldavia-gazette.org/atom/" },
|
|
503
503
|
{ "rel" => "alternate", "type" => "text/html", "href" => "https://syldavia-gazette.org" },
|
|
504
504
|
{ "rel" => "license", "type" => "text/html", "href" => "https://creativecommons.org/licenses/by/4.0/legalcode" }]
|
|
505
|
-
|
|
505
|
+
|
|
506
506
|
it "url" do
|
|
507
507
|
response = subject.get_link(links, "self")
|
|
508
508
|
expect(response).to eq("https://syldavia-gazette.org/atom/")
|
|
@@ -721,7 +721,7 @@ describe Commonmeta::Metadata do
|
|
|
721
721
|
it "decode doi to uuid" do
|
|
722
722
|
doi = "https://doi.org/10.53731/6315bn4-aqg82ja-4a9wxdt-29f7279"
|
|
723
723
|
response = subject.decode_doi(doi, uuid: true)
|
|
724
|
-
expect(response).to eq(
|
|
724
|
+
expect(response).to eq("255d48ab-c102-9288-a4f3-add092f388e9")
|
|
725
725
|
end
|
|
726
726
|
end
|
|
727
727
|
|
|
@@ -745,10 +745,36 @@ describe Commonmeta::Metadata do
|
|
|
745
745
|
end
|
|
746
746
|
end
|
|
747
747
|
|
|
748
|
-
context
|
|
749
|
-
it
|
|
748
|
+
context "json_feed_unregistered_url" do
|
|
749
|
+
it "all posts" do
|
|
750
750
|
response = subject.json_feed_unregistered_url
|
|
751
751
|
expect(response).to eq("https://api.rogue-scholar.org/posts/unregistered")
|
|
752
752
|
end
|
|
753
753
|
end
|
|
754
|
+
|
|
755
|
+
context "normalize_name_identifier" do
|
|
756
|
+
it "ORCID" do
|
|
757
|
+
hsh = {"schemeUri"=>"https://orcid.org", "nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID"}
|
|
758
|
+
response = subject.normalize_name_identifier(hsh)
|
|
759
|
+
expect(response).to eq("https://orcid.org/0000-0003-1419-2405")
|
|
760
|
+
end
|
|
761
|
+
|
|
762
|
+
it "ROR" do
|
|
763
|
+
hsh = { "schemeUri" => "https://ror.org", "nameIdentifier" => "https://ror.org/02aj13c28", "nameIdentifierScheme" => "ROR" }
|
|
764
|
+
response = subject.normalize_name_identifier(hsh)
|
|
765
|
+
expect(response).to eq("https://ror.org/02aj13c28")
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
it "ISNI" do
|
|
769
|
+
hsh = { "schemeUri" => "http://isni.org/isni/", "nameIdentifier" => "0000000134596520", "nameIdentifierScheme" => "ISNI" }
|
|
770
|
+
response = subject.normalize_name_identifier(hsh)
|
|
771
|
+
expect(response).to eq("https://isni.org/isni/0000000134596520")
|
|
772
|
+
end
|
|
773
|
+
|
|
774
|
+
it "Wikidata" do
|
|
775
|
+
hsh = {"schemeUri"=>"https://www.wikidata.org/wiki/", "nameIdentifier"=>"Q107529885", "nameIdentifierScheme"=>"Wikidata"}
|
|
776
|
+
response = subject.normalize_name_identifier(hsh)
|
|
777
|
+
expect(response).to eq("https://www.wikidata.org/wiki/Q107529885")
|
|
778
|
+
end
|
|
779
|
+
end
|
|
754
780
|
end
|
|
@@ -136,7 +136,6 @@ describe Commonmeta::Metadata, vcr: true do
|
|
|
136
136
|
it 'from schema.org' do
|
|
137
137
|
input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food/'
|
|
138
138
|
subject = described_class.new(input: input, from: 'schema_org')
|
|
139
|
-
puts subject.errors
|
|
140
139
|
expect(subject.valid?).to be true
|
|
141
140
|
datacite = JSON.parse(subject.datacite)
|
|
142
141
|
expect(datacite.fetch('titles')).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: commonmeta-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-01-
|
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -694,7 +694,7 @@ files:
|
|
|
694
694
|
- lib/commonmeta/xml_converter.rb
|
|
695
695
|
- resources/2008/09/xsd.xsl
|
|
696
696
|
- resources/cff.json
|
|
697
|
-
- resources/commonmeta_v0.10.
|
|
697
|
+
- resources/commonmeta_v0.10.6.json
|
|
698
698
|
- resources/crossref/AccessIndicators.xsd
|
|
699
699
|
- resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd
|
|
700
700
|
- resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd
|
|
@@ -720,7 +720,7 @@ files:
|
|
|
720
720
|
- resources/datacite-resourceType-v4.xsd
|
|
721
721
|
- resources/datacite-titleType-v4.xsd
|
|
722
722
|
- resources/datacite-v3.json
|
|
723
|
-
- resources/datacite-
|
|
723
|
+
- resources/datacite-v45.json
|
|
724
724
|
- resources/kernel-3.0/include/datacite-contributorType-v3.xsd
|
|
725
725
|
- resources/kernel-3.0/include/datacite-dateType-v3.xsd
|
|
726
726
|
- resources/kernel-3.0/include/datacite-descriptionType-v3.xsd
|
|
@@ -770,6 +770,8 @@ files:
|
|
|
770
770
|
- spec/fixtures/crossref.json
|
|
771
771
|
- spec/fixtures/crossref.ris
|
|
772
772
|
- spec/fixtures/crossref.xml
|
|
773
|
+
- spec/fixtures/datacite-dataset_v4.5.json
|
|
774
|
+
- spec/fixtures/datacite-instrument.json
|
|
773
775
|
- spec/fixtures/datacite.json
|
|
774
776
|
- spec/fixtures/datacite_software.json
|
|
775
777
|
- spec/fixtures/datacite_software_missing_comma.json
|