bolognese 2.2.0 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/metadata_utils.rb +1 -0
- data/lib/bolognese/readers/citeproc_reader.rb +6 -0
- data/lib/bolognese/readers/crossref_reader.rb +37 -3
- data/lib/bolognese/readers/schema_org_reader.rb +21 -2
- data/lib/bolognese/utils.rb +12 -7
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/schema_org_writer.rb +4 -0
- data/resources/kernel-4/include/datacite-contributorType-v4.xsd +3 -1
- data/resources/kernel-4/include/datacite-dateType-v4.xsd +3 -1
- data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +5 -2
- data/resources/kernel-4/include/datacite-relationType-v4.xsd +7 -3
- data/resources/kernel-4/include/datacite-resourceType-v4.xsd +5 -1
- data/resources/kernel-4/include/datacite-titleType-v4.xsd +1 -1
- data/resources/kernel-4/metadata.xsd +2 -1
- data/resources/kernel-4.6/include/datacite-contributorType-v4.xsd +37 -0
- data/resources/kernel-4.6/include/datacite-dateType-v4.xsd +27 -0
- data/resources/kernel-4.6/include/datacite-descriptionType-v4.xsd +19 -0
- data/resources/kernel-4.6/include/datacite-funderIdentifierType-v4.xsd +16 -0
- data/resources/kernel-4.6/include/datacite-nameType-v4.xsd +10 -0
- data/resources/kernel-4.6/include/datacite-numberType-v4.xsd +12 -0
- data/resources/kernel-4.6/include/datacite-relatedIdentifierType-v4.xsd +37 -0
- data/resources/kernel-4.6/include/datacite-relationType-v4.xsd +57 -0
- data/resources/kernel-4.6/include/datacite-resourceType-v4.xsd +49 -0
- data/resources/kernel-4.6/include/datacite-titleType-v4.xsd +14 -0
- data/resources/kernel-4.6/include/xml.xsd +286 -0
- data/resources/kernel-4.6/metadata.xsd +712 -0
- data/spec/datacite_utils_spec.rb +109 -1
- data/spec/fixtures/citeproc.json +6 -2
- data/spec/fixtures/crossref_schema_4.6_values.xml +183 -0
- data/spec/fixtures/datacite-example-full-v4.6.xml +114 -0
- data/spec/fixtures/schema_org_4.6_attributes.json +108 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors_Translator/supports_Translator_contributorType.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates_with_Coverage/inserts_date_with_dateType_Coverage.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_CSTR/supports_CSTR_relatedIdentifierType.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_HasTranslation/supports_HasTranslation_relationType.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_RRID/supports_RRID_relatedIdentifierType.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Award/supports_Award_as_resourceTypeGeneral.yml +71 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Project/supports_Project_as_resourceTypeGeneral.yml +71 -0
- data/spec/readers/citeproc_reader_spec.rb +1 -0
- data/spec/readers/crossref_reader_spec.rb +31 -0
- data/spec/readers/datacite_reader_spec.rb +41 -0
- data/spec/readers/schema_org_reader_spec.rb +27 -0
- data/spec/writers/citeproc_writer_spec.rb +9 -0
- data/spec/writers/datacite_writer_spec.rb +71 -0
- data/spec/writers/jats_writer_spec.rb +1 -1
- data/spec/writers/schema_org_writer_spec.rb +36 -0
- metadata +24 -2
@@ -340,5 +340,32 @@ describe Bolognese::Metadata, vcr: true do
|
|
340
340
|
"funderIdentifierType"=>"Crossref Funder ID",
|
341
341
|
"funderName"=>"European Commission"}])
|
342
342
|
end
|
343
|
+
|
344
|
+
it "Schema 4.6 attributes" do
|
345
|
+
input = fixture_path + 'schema_org_4.6_attributes.json'
|
346
|
+
subject = Bolognese::Metadata.new(input: input)
|
347
|
+
|
348
|
+
expect(subject.related_identifiers).to eq(
|
349
|
+
[
|
350
|
+
{"relatedIdentifier"=>"10.1234/translated-version", "relatedIdentifierType"=>"DOI", "relationType"=>"HasTranslation"},
|
351
|
+
{"relatedIdentifier"=>"10.1234/other-version", "relatedIdentifierType"=>"DOI", "relationType"=>"IsTranslationOf"},
|
352
|
+
]
|
353
|
+
)
|
354
|
+
expect(subject.dates).to eq(
|
355
|
+
[
|
356
|
+
{"date"=>"2023-01-01", "dateType"=>"Issued"},
|
357
|
+
{"date"=>"2023-01-01", "dateType"=>"Created"},
|
358
|
+
{"date"=>"2023-01-01", "dateType"=>"Updated"},
|
359
|
+
{"date"=>"2020-01-01", "dateType"=>"Coverage"}
|
360
|
+
]
|
361
|
+
)
|
362
|
+
expect(subject.contributors).to eq(
|
363
|
+
[
|
364
|
+
{"name"=>"Doe, Jane", "givenName"=>"Jane", "familyName"=>"Doe", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}]},
|
365
|
+
{"name"=>"Smith, John", "givenName"=>"John", "familyName"=>"Smith", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}]},
|
366
|
+
{"name"=>"Ross, Cody", "givenName"=>"Cody", "familyName"=>"Ross", "nameType"=>"Personal", "affiliation"=>[{"name"=>"ExampleAffiliation", "affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR"}], "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}], "contributorType"=>"Translator"},
|
367
|
+
]
|
368
|
+
)
|
369
|
+
end
|
343
370
|
end
|
344
371
|
end
|
@@ -286,5 +286,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
286
286
|
expect(json["DOI"]).to eq("10.34747/g6yb-3412")
|
287
287
|
expect(json["issued"]).to eq("date-parts"=>[[2019]])
|
288
288
|
end
|
289
|
+
|
290
|
+
it "from Schema 4.6 with Translator contributor" do
|
291
|
+
input = fixture_path + 'datacite-example-full-v4.6.xml'
|
292
|
+
subject = Bolognese::Metadata.new(input: input)
|
293
|
+
json = JSON.parse(subject.citeproc)
|
294
|
+
expect(json["translator"]).to eq([
|
295
|
+
{"family"=>"Doe", "given"=>"Jane"},
|
296
|
+
])
|
297
|
+
end
|
289
298
|
end
|
290
299
|
end
|
@@ -286,6 +286,77 @@ describe Bolognese::Metadata, vcr: true do
|
|
286
286
|
)
|
287
287
|
end
|
288
288
|
|
289
|
+
it "Schema 4.6" do
|
290
|
+
input = fixture_path + 'datacite-example-full-v4.6.xml'
|
291
|
+
doi = "10.82433/B09Z-4K37"
|
292
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true)
|
293
|
+
expect(subject.valid?).to be true
|
294
|
+
|
295
|
+
datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
|
296
|
+
expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
|
297
|
+
expect(datacite.dig("contributors", "contributor").count).to eq(2)
|
298
|
+
expect(datacite.dig("contributors", "contributor")).to include(
|
299
|
+
{
|
300
|
+
"contributorType"=>"Translator",
|
301
|
+
"contributorName"=>{
|
302
|
+
"nameType"=>"Personal",
|
303
|
+
"__content__"=>"Doe, Jane"
|
304
|
+
},
|
305
|
+
"givenName"=>"Jane",
|
306
|
+
"familyName"=>"Doe",
|
307
|
+
"nameIdentifier"=>{
|
308
|
+
"nameIdentifierScheme"=>"ORCID",
|
309
|
+
"schemeURI"=>"https://orcid.org",
|
310
|
+
"__content__"=>"https://orcid.org/0000-0003-1419-2405"
|
311
|
+
},
|
312
|
+
"affiliation"=>{
|
313
|
+
"affiliationIdentifier"=>"https://ror.org/04wxnsj81",
|
314
|
+
"affiliationIdentifierScheme"=>"ROR",
|
315
|
+
"schemeURI"=>"https://ror.org",
|
316
|
+
"__content__"=>"ExampleAffiliation"
|
317
|
+
}
|
318
|
+
}
|
319
|
+
)
|
320
|
+
expect(datacite.dig("dates", "date").count).to eq(5)
|
321
|
+
expect(datacite.dig("dates", "date")).to include(
|
322
|
+
{
|
323
|
+
"dateType"=>"Coverage",
|
324
|
+
"__content__"=>"2020-01-01"
|
325
|
+
}
|
326
|
+
)
|
327
|
+
expect(datacite.dig("resourceType")).to eq(
|
328
|
+
{
|
329
|
+
"__content__"=>"Research Project",
|
330
|
+
"resourceTypeGeneral"=>"Project"
|
331
|
+
}
|
332
|
+
)
|
333
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(4)
|
334
|
+
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")).to eq(
|
335
|
+
[
|
336
|
+
{
|
337
|
+
"relatedIdentifierType"=>"RRID",
|
338
|
+
"relationType"=>"References",
|
339
|
+
"__content__"=>"RRID:AB_90755"
|
340
|
+
},
|
341
|
+
{
|
342
|
+
"relatedIdentifierType"=>"CSTR",
|
343
|
+
"relationType"=>"References",
|
344
|
+
"__content__"=>"CSTR:AB_12345"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
"relatedIdentifierType"=>"DOI",
|
348
|
+
"relationType"=>"HasTranslation",
|
349
|
+
"__content__"=>"10.1234/translated-version"
|
350
|
+
},
|
351
|
+
{
|
352
|
+
"relatedIdentifierType"=>"DOI",
|
353
|
+
"relationType"=>"IsTranslationOf",
|
354
|
+
"__content__"=>"10.1234/other-version"
|
355
|
+
}
|
356
|
+
]
|
357
|
+
)
|
358
|
+
end
|
359
|
+
|
289
360
|
it "Geolocations" do
|
290
361
|
input = fixture_path + 'datacite-example-full-v4.5.xml'
|
291
362
|
doi = "10.82433/B09Z-4K37"
|
@@ -87,7 +87,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
87
87
|
expect(jats.dig("publication_type")).to be_nil
|
88
88
|
expect(jats.dig("source")).to eq("Eating your own Dog Food")
|
89
89
|
expect(jats.dig("publisher_name")).to eq("DataCite")
|
90
|
-
expect(jats.dig("person_group", "name")).to eq("surname"=>"Fenner", "given_names"=>"Martin")
|
90
|
+
expect(jats.dig("person_group", 0, "name")).to eq("surname"=>"Fenner", "given_names"=>"Martin")
|
91
91
|
expect(jats.dig("year")).to eq("iso_8601_date"=>"2016-12-20", "__content__"=>"2016")
|
92
92
|
expect(jats.dig("month")).to eq("12")
|
93
93
|
expect(jats.dig("day")).to eq("20")
|
@@ -378,5 +378,41 @@ describe Bolognese::Metadata, vcr: true do
|
|
378
378
|
}
|
379
379
|
)
|
380
380
|
end
|
381
|
+
|
382
|
+
it "from Schema 4.6 with Translator contributor, workTranslation, translationOfWork, and temporalCoverage" do
|
383
|
+
input = fixture_path + 'datacite-example-full-v4.6.xml'
|
384
|
+
subject = Bolognese::Metadata.new(input: input)
|
385
|
+
json = JSON.parse(subject.schema_org)
|
386
|
+
|
387
|
+
expect(json["@type"]).to eq(
|
388
|
+
"Project"
|
389
|
+
)
|
390
|
+
expect(json["translator"]).to eq(
|
391
|
+
{
|
392
|
+
"name" => "Jane Doe",
|
393
|
+
"givenName" => "Jane",
|
394
|
+
"familyName" => "Doe",
|
395
|
+
"affiliation" => {
|
396
|
+
"@type" => "Organization",
|
397
|
+
"@id" => "https://ror.org/04wxnsj81",
|
398
|
+
"name" => "ExampleAffiliation"
|
399
|
+
},
|
400
|
+
"contributorType" => "Translator",
|
401
|
+
"@type" => "Person",
|
402
|
+
"@id" => "https://orcid.org/0000-0003-1419-2405"
|
403
|
+
}
|
404
|
+
)
|
405
|
+
expect(json["workTranslation"]).to eq(
|
406
|
+
"@id" => "https://doi.org/10.1234/translated-version",
|
407
|
+
"@type" => "CreativeWork"
|
408
|
+
)
|
409
|
+
expect(json["translationOfWork"]).to eq(
|
410
|
+
"@id" => "https://doi.org/10.1234/other-version",
|
411
|
+
"@type" => "CreativeWork"
|
412
|
+
)
|
413
|
+
expect(json["temporalCoverage"]).to eq(
|
414
|
+
"2020-01-01"
|
415
|
+
)
|
416
|
+
end
|
381
417
|
end
|
382
418
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2
|
4
|
+
version: 2.3.2
|
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-
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -754,6 +754,18 @@ files:
|
|
754
754
|
- resources/kernel-4.5/include/datacite-titleType-v4.xsd
|
755
755
|
- resources/kernel-4.5/include/xml.xsd
|
756
756
|
- resources/kernel-4.5/metadata.xsd
|
757
|
+
- resources/kernel-4.6/include/datacite-contributorType-v4.xsd
|
758
|
+
- resources/kernel-4.6/include/datacite-dateType-v4.xsd
|
759
|
+
- resources/kernel-4.6/include/datacite-descriptionType-v4.xsd
|
760
|
+
- resources/kernel-4.6/include/datacite-funderIdentifierType-v4.xsd
|
761
|
+
- resources/kernel-4.6/include/datacite-nameType-v4.xsd
|
762
|
+
- resources/kernel-4.6/include/datacite-numberType-v4.xsd
|
763
|
+
- resources/kernel-4.6/include/datacite-relatedIdentifierType-v4.xsd
|
764
|
+
- resources/kernel-4.6/include/datacite-relationType-v4.xsd
|
765
|
+
- resources/kernel-4.6/include/datacite-resourceType-v4.xsd
|
766
|
+
- resources/kernel-4.6/include/datacite-titleType-v4.xsd
|
767
|
+
- resources/kernel-4.6/include/xml.xsd
|
768
|
+
- resources/kernel-4.6/metadata.xsd
|
757
769
|
- resources/kernel-4/include/datacite-contributorType-v4.xsd
|
758
770
|
- resources/kernel-4/include/datacite-dateType-v4.xsd
|
759
771
|
- resources/kernel-4/include/datacite-descriptionType-v4.xsd
|
@@ -790,6 +802,7 @@ files:
|
|
790
802
|
- spec/fixtures/crossref.bib
|
791
803
|
- spec/fixtures/crossref.ris
|
792
804
|
- spec/fixtures/crossref.xml
|
805
|
+
- spec/fixtures/crossref_schema_4.6_values.xml
|
793
806
|
- spec/fixtures/datacite-empty-sizes.xml
|
794
807
|
- spec/fixtures/datacite-example-ROR-nameIdentifiers.xml
|
795
808
|
- spec/fixtures/datacite-example-affiliation.xml
|
@@ -802,6 +815,7 @@ files:
|
|
802
815
|
- spec/fixtures/datacite-example-escaped-text.xml
|
803
816
|
- spec/fixtures/datacite-example-full-v4.4.xml
|
804
817
|
- spec/fixtures/datacite-example-full-v4.5.xml
|
818
|
+
- spec/fixtures/datacite-example-full-v4.6.xml
|
805
819
|
- spec/fixtures/datacite-example-geolocation-2.xml
|
806
820
|
- spec/fixtures/datacite-example-geolocation.xml
|
807
821
|
- spec/fixtures/datacite-example-nameIdentifier-with-schemeURI.xml
|
@@ -845,6 +859,7 @@ files:
|
|
845
859
|
- spec/fixtures/ris_bug.ris
|
846
860
|
- spec/fixtures/schema_4.0.xml
|
847
861
|
- spec/fixtures/schema_org.json
|
862
|
+
- spec/fixtures/schema_org_4.6_attributes.json
|
848
863
|
- spec/fixtures/schema_org_geolocation.json
|
849
864
|
- spec/fixtures/schema_org_geoshape.json
|
850
865
|
- spec/fixtures/schema_org_gtex.json
|
@@ -1064,8 +1079,10 @@ files:
|
|
1064
1079
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/DOI_RA_not_Crossref_or_DataCite.yml
|
1065
1080
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/handle_input/unknown_DOI_prefix.yml
|
1066
1081
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors/none.yml
|
1082
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_contributors_Translator/supports_Translator_contributorType.yml
|
1067
1083
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_creators/insert.yml
|
1068
1084
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates/insert.yml
|
1085
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_dates_with_Coverage/inserts_date_with_dateType_Coverage.yml
|
1069
1086
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_descriptions/insert.yml
|
1070
1087
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_identifier/doi.yml
|
1071
1088
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_language/insert.yml
|
@@ -1074,8 +1091,13 @@ files:
|
|
1074
1091
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_publisher/insert.yml
|
1075
1092
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/insert.yml
|
1076
1093
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers/related_identifier.yml
|
1094
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_CSTR/supports_CSTR_relatedIdentifierType.yml
|
1095
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_HasTranslation/supports_HasTranslation_relationType.yml
|
1096
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_identifiers_RRID/supports_RRID_relatedIdentifierType.yml
|
1077
1097
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_related_items/insert.yml
|
1078
1098
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type/insert.yml
|
1099
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Award/supports_Award_as_resourceTypeGeneral.yml
|
1100
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_resource_type_with_Project/supports_Project_as_resourceTypeGeneral.yml
|
1079
1101
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_rights_list/insert.yml
|
1080
1102
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_sizes/insert.yml
|
1081
1103
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_subjects/insert.yml
|