bolognese 1.8.18 → 1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/changelog.yml +36 -0
  3. data/CHANGELOG.md +1708 -0
  4. data/Gemfile.lock +46 -44
  5. data/lib/bolognese/author_utils.rb +6 -5
  6. data/lib/bolognese/datacite_utils.rb +69 -3
  7. data/lib/bolognese/metadata.rb +10 -5
  8. data/lib/bolognese/metadata_utils.rb +3 -2
  9. data/lib/bolognese/readers/bibtex_reader.rb +5 -4
  10. data/lib/bolognese/readers/citeproc_reader.rb +1 -1
  11. data/lib/bolognese/readers/crossref_reader.rb +3 -3
  12. data/lib/bolognese/readers/datacite_reader.rb +57 -11
  13. data/lib/bolognese/readers/ris_reader.rb +3 -3
  14. data/lib/bolognese/utils.rb +163 -46
  15. data/lib/bolognese/version.rb +1 -1
  16. data/resources/kernel-4.4/include/datacite-contributorType-v4.xsd +35 -0
  17. data/resources/kernel-4.4/include/datacite-dateType-v4.xsd +25 -0
  18. data/resources/kernel-4.4/include/datacite-descriptionType-v4.xsd +19 -0
  19. data/resources/kernel-4.4/include/datacite-funderIdentifierType-v4.xsd +16 -0
  20. data/resources/kernel-4.4/include/datacite-nameType-v4.xsd +10 -0
  21. data/resources/kernel-4.4/include/datacite-numberType-v4.xsd +12 -0
  22. data/resources/kernel-4.4/include/datacite-relatedIdentifierType-v4.xsd +34 -0
  23. data/resources/kernel-4.4/include/datacite-relationType-v4.xsd +51 -0
  24. data/resources/kernel-4.4/include/datacite-resourceType-v4.xsd +43 -0
  25. data/resources/kernel-4.4/include/datacite-titleType-v4.xsd +14 -0
  26. data/resources/kernel-4.4/include/xml.xsd +286 -0
  27. data/resources/kernel-4.4/metadata.xsd +707 -0
  28. data/resources/kernel-4/include/datacite-contributorType-v4.xsd +21 -21
  29. data/resources/kernel-4/include/datacite-dateType-v4.xsd +11 -11
  30. data/resources/kernel-4/include/datacite-descriptionType-v4.xsd +6 -6
  31. data/resources/kernel-4/include/datacite-funderIdentifierType-v4.xsd +5 -5
  32. data/resources/kernel-4/include/datacite-nameType-v4.xsd +2 -2
  33. data/resources/kernel-4/include/datacite-numberType-v4.xsd +12 -0
  34. data/resources/kernel-4/include/datacite-relatedIdentifierType-v4.xsd +19 -19
  35. data/resources/kernel-4/include/datacite-relationType-v4.xsd +36 -34
  36. data/resources/kernel-4/include/datacite-resourceType-v4.xsd +32 -17
  37. data/resources/kernel-4/include/datacite-titleType-v4.xsd +4 -4
  38. data/resources/kernel-4/metadata.xsd +297 -105
  39. data/spec/fixtures/datacite-example-dissertation-v4.4.xml +56 -0
  40. data/spec/fixtures/datacite-example-full-v4.4.xml +114 -0
  41. data/spec/fixtures/datacite-example-relateditems.xml +61 -0
  42. data/spec/fixtures/datacite-example-xs-string.xml +28 -0
  43. data/spec/fixtures/datacite-geolocationpolygons-multiple.xml +56 -0
  44. data/spec/metadata_spec.rb +1 -1
  45. data/spec/readers/bibtex_reader_spec.rb +2 -2
  46. data/spec/readers/crossref_reader_spec.rb +37 -37
  47. data/spec/readers/datacite_json_reader_spec.rb +1 -1
  48. data/spec/readers/datacite_reader_spec.rb +255 -4
  49. data/spec/readers/ris_reader_spec.rb +3 -3
  50. data/spec/writers/crosscite_writer_spec.rb +3 -3
  51. data/spec/writers/csv_writer_spec.rb +4 -4
  52. data/spec/writers/datacite_json_writer_spec.rb +3 -3
  53. data/spec/writers/datacite_writer_spec.rb +4 -4
  54. data/spec/writers/schema_org_writer_spec.rb +3 -3
  55. metadata +22 -2
@@ -46,7 +46,7 @@ describe Bolognese::Metadata, vcr: true do
46
46
  input = fixture_path + "datacite_software_missing_comma.json"
47
47
  subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
48
48
  expect(subject.valid?).to be false
49
- expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:370]"])
49
+ expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:364]"])
50
50
  expect(subject.codemeta).to be_nil
51
51
  end
52
52
 
@@ -280,7 +280,7 @@ describe Bolognese::Metadata, vcr: true do
280
280
  input = "10.4225/03/5a6931f57c654"
281
281
  subject = Bolognese::Metadata.new(input: input)
282
282
  expect(subject.valid?).to be true
283
- expect(subject.subjects).to eq([{"subject"=>"90301 Biomaterials", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
283
+ expect(subject.subjects).to eq([{"subject"=>"90301 Biomaterials", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
284
284
  {"subject"=>"FOS: Medical engineering", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}])
285
285
  end
286
286
 
@@ -289,8 +289,8 @@ describe Bolognese::Metadata, vcr: true do
289
289
  subject = Bolognese::Metadata.new(input: input)
290
290
  expect(subject.valid?).to be true
291
291
  expect(subject.subjects).to eq([{"subject"=>"130103 Higher Education", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
292
- {"subject"=>"FOS: Educational sciences", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"},
293
- {"subject"=>"130313 Teacher Education and Professional Development of Educators", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
292
+ {"subject"=>"FOS: Educational sciences", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"},
293
+ {"subject"=>"130313 Teacher Education and Professional Development of Educators", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
294
294
  {"subject"=>"80799 Library and Information Studies not elsewhere classified", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"},
295
295
  {"subject"=>"FOS: Media and communications", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}, {"subject"=>"Library and Information Studies"}])
296
296
  end
@@ -1314,6 +1314,257 @@ describe Bolognese::Metadata, vcr: true do
1314
1314
  expect(subject.agency).to eq("datacite")
1315
1315
  expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
1316
1316
  expect(subject.geo_locations.first["geoLocationPlace"]).to eq("Zandmotor, sand suppletion area on the Dutch coast.")
1317
- expect(subject.geo_locations.first["geoLocationPolygon"].first).to eq("polygonPoint"=>{"pointLatitude"=>"52.03913926329928", "pointLongitude"=>"4.1738852605822"})
1317
+ expect(subject.geo_locations.first["geoLocationPolygon"][0].first).to eq("polygonPoint"=>{"pointLatitude"=>"52.03913926329928", "pointLongitude"=>"4.1738852605822"})
1318
1318
  end
1319
+
1320
+ it "Schema 4.4 from string" do
1321
+ input = fixture_path + "datacite-example-full-v4.4.xml"
1322
+ subject = Bolognese::Metadata.new(input: input)
1323
+ expect(subject.valid?).to be true
1324
+ expect(subject.types["schemaOrg"]).to eq("SoftwareSourceCode")
1325
+ expect(subject.types["resourceType"]).to eq("XML")
1326
+ expect(subject.types["resourceTypeGeneral"]).to eq("Software")
1327
+ expect(subject.creators).to eq(
1328
+ [
1329
+ {
1330
+ "name"=>"Miller, Elizabeth", "givenName"=>"Elizabeth", "familyName"=>"Miller",
1331
+ "nameType" => "Personal",
1332
+ "nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0001-5000-0007",
1333
+ "schemeUri"=>"https://orcid.org",
1334
+ "nameIdentifierScheme"=>"ORCID"}],
1335
+ "affiliation" => [{ "name" => "DataCite" }]
1336
+ }
1337
+ ]
1338
+ )
1339
+ expect(subject.titles).to eq(
1340
+ [
1341
+ {"title"=>"Full DataCite XML Example", "lang"=>"en-US"},
1342
+ {"title"=>"Demonstration of DataCite Properties.", "titleType"=>"Subtitle", "lang"=>"en-US"}
1343
+ ]
1344
+ )
1345
+ expect(subject.identifiers).to eq([{"identifier"=>"https://schema.datacite.org/meta/kernel-4.4/example/datacite-example-full-v4.4.xml", "identifierType"=>"URL"}])
1346
+ expect(subject.dates).to eq(
1347
+ [
1348
+ {"date"=>"2021-01-26", "dateInformation"=>"Updated with 4.4 properties", "dateType"=>"Updated"},
1349
+ {"date"=>"2014", "dateType"=>"Issued"}
1350
+ ]
1351
+ )
1352
+ expect(subject.publication_year).to eq("2014")
1353
+ expect(subject.subjects).to eq(
1354
+ [{
1355
+ "subject"=>"computer science",
1356
+ "subjectScheme"=>"dewey",
1357
+ "schemeUri"=>"http://dewey.info/",
1358
+ "lang"=>"en-US",
1359
+ "classificationCode"=>"000"
1360
+ }]
1361
+ )
1362
+ expect(subject.related_identifiers.length).to eq(2)
1363
+ expect(subject.related_identifiers.last).to eq(
1364
+ "relatedIdentifier"=>"arXiv:0706.0001",
1365
+ "relatedIdentifierType"=>"arXiv",
1366
+ "relationType"=>"IsReviewedBy",
1367
+ "resourceTypeGeneral"=>"Text"
1368
+ )
1369
+ expect(subject.rights_list).to eq([
1370
+ {
1371
+ "lang"=>"en-US",
1372
+ "rights"=>"Creative Commons Zero v1.0 Universal",
1373
+ "rightsIdentifier"=>"cc0-1.0",
1374
+ "rightsIdentifierScheme"=>"SPDX",
1375
+ "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode",
1376
+ "schemeUri"=>"https://spdx.org/licenses/"
1377
+ }
1378
+ ])
1379
+ expect(subject.publisher).to eq("DataCite")
1380
+ expect(subject.agency).to eq("datacite")
1381
+ expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
1382
+ expect(subject.related_items.last).to eq(
1383
+ {
1384
+ "relatedItemType"=>"Journal",
1385
+ "relationType"=>"IsPublishedIn",
1386
+ "relatedItemIdentifier"=>
1387
+ {
1388
+ "relatedItemIdentifier"=>"10.1016/j.physletb.2017.11.044",
1389
+ "relatedItemIdentifierType"=>"DOI",
1390
+ },
1391
+ "titles"=>
1392
+ [
1393
+ {"title"=>"Physics letters / B"},
1394
+ ],
1395
+ "volume"=>"776",
1396
+ "firstPage"=>"249",
1397
+ "lastPage"=>"264",
1398
+ "publicationYear"=>"2018",
1399
+ "contributors"=>[],
1400
+ "creators"=>[],
1401
+ }
1402
+ )
1403
+ end
1404
+
1405
+ it "Schema 4.4 related items from string" do
1406
+ input = fixture_path + "datacite-example-relateditems.xml"
1407
+ subject = Bolognese::Metadata.new(input: input)
1408
+ expect(subject.valid?).to be true
1409
+
1410
+ expect(subject.related_items.last).to eq(
1411
+ {
1412
+ "relatedItemType"=>"Journal",
1413
+ "relationType"=>"IsPublishedIn",
1414
+ "relatedItemIdentifier"=>
1415
+ {
1416
+ "relatedItemIdentifier"=>"10.5072/john-smiths-1234",
1417
+ "relatedItemIdentifierType"=>"DOI",
1418
+ "relatedMetadataScheme"=>"citeproc+json",
1419
+ "schemeURI"=>"https://github.com/citation-style-language/schema/raw/master/csl-data.json",
1420
+ "schemeType"=>"URL"
1421
+ },
1422
+ "creators" =>
1423
+ [
1424
+ {"nameType"=>"Personal", "name"=>"Smith, John", "givenName"=>"John", "familyName"=>"Smith"}
1425
+ ],
1426
+ "titles"=>
1427
+ [
1428
+ {"title"=>"Understanding the fictional John Smith"},
1429
+ {"title"=>"A detailed look", "titleType"=>"Subtitle"}
1430
+ ],
1431
+ "volume"=>"776",
1432
+ "issue"=>"1",
1433
+ "number"=>"1",
1434
+ "numberType"=>"Chapter",
1435
+ "firstPage"=>"50",
1436
+ "lastPage"=>"60",
1437
+ "publisher"=>"Example Inc",
1438
+ "publicationYear"=>"1776",
1439
+ "edition"=>"1",
1440
+ "contributors"=>
1441
+ [
1442
+ {"name"=>"Hallett, Richard", "givenName"=>"Richard", "familyName"=>"Hallett", "contributorType"=>"ProjectLeader"}
1443
+ ]
1444
+ }
1445
+ )
1446
+ end
1447
+
1448
+ it "Schema 4.4 dissertation from string" do
1449
+ input = fixture_path + "datacite-example-dissertation-v4.4.xml"
1450
+ subject = Bolognese::Metadata.new(input: input)
1451
+ expect(subject.valid?).to be true
1452
+ expect(subject.types["resourceType"]).to eq(nil)
1453
+ expect(subject.types["resourceTypeGeneral"]).to eq("Dissertation")
1454
+ expect(subject.types["schemaOrg"]).to eq("Thesis")
1455
+ expect(subject.types["ris"]).to eq("THES")
1456
+ expect(subject.types["citeproc"]).to eq("thesis")
1457
+ expect(subject.creators).to eq(
1458
+ [
1459
+ {
1460
+ "name"=>"Luo, R",
1461
+ "familyName"=>"Luo",
1462
+ "givenName"=>"R",
1463
+ "nameIdentifiers"=>[],
1464
+ "affiliation"=>[],
1465
+ "nameType" => "Personal"
1466
+ },
1467
+ {
1468
+ "name"=>"Liu, B",
1469
+ "familyName"=>"Liu",
1470
+ "givenName"=>"B",
1471
+ "nameIdentifiers"=>[],
1472
+ "affiliation"=>[],
1473
+ "nameType" => "Personal"
1474
+ },
1475
+ {
1476
+ "name"=>"Xie, Y",
1477
+ "familyName"=>"Xie",
1478
+ "givenName"=>"Y",
1479
+ "nameIdentifiers"=>[],
1480
+ "affiliation"=>[],
1481
+ "nameType" => "Personal"
1482
+ },
1483
+ {
1484
+ "name"=>"Li, Z",
1485
+ "familyName"=>"Li",
1486
+ "givenName"=>"Z",
1487
+ "nameIdentifiers"=>[],
1488
+ "affiliation"=>[],
1489
+ "nameType" => "Personal"
1490
+ }
1491
+ ]
1492
+ )
1493
+ expect(subject.titles).to eq(
1494
+ [
1495
+ {"title"=>"Software and supporting material for \"SOAPdenovo2: An empirically improved memory-efficient short read de novo assembly\"", "lang"=>"en"},
1496
+ ]
1497
+ )
1498
+ expect(subject.dates).to eq(
1499
+ [
1500
+ {"date"=>"2012-12-13", "dateType"=>"Available"},
1501
+ {"date"=>"2012", "dateType"=>"Issued"}
1502
+ ]
1503
+ )
1504
+ expect(subject.publication_year).to eq("2012")
1505
+ expect(subject.subjects).to eq(
1506
+ [
1507
+ {
1508
+ "subject"=>"DNA (Genetics)",
1509
+ "lang"=>"en"
1510
+ },
1511
+ {
1512
+ "subject"=>"Computer Program",
1513
+ "lang"=>"en"
1514
+ }
1515
+ ]
1516
+ )
1517
+ expect(subject.related_identifiers).to eq(
1518
+ [
1519
+ {"relatedIdentifier"=>"10.5072/2047-217x-1-1", "relatedIdentifierType"=>"DOI", "relationType"=>"IsReferencedBy"},
1520
+ {"relatedIdentifier"=>"10.5072/100038", "relatedIdentifierType"=>"DOI", "relationType"=>"Compiles"}
1521
+ ]
1522
+ )
1523
+ expect(subject.rights_list).to eq([
1524
+ {
1525
+ "lang"=>"en-US",
1526
+ "rights"=>"Creative Commons Zero v1.0 Universal",
1527
+ "rightsIdentifier"=>"cc0-1.0",
1528
+ "rightsIdentifierScheme"=>"SPDX",
1529
+ "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode",
1530
+ "schemeUri"=>"https://spdx.org/licenses/"
1531
+ }
1532
+ ])
1533
+ expect(subject.publisher).to eq("GigaScience Database")
1534
+ expect(subject.agency).to eq("datacite")
1535
+ expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
1536
+ end
1537
+
1538
+
1539
+ it "Parsing xs-string attribute correctly" do
1540
+ input = fixture_path + "datacite-example-xs-string.xml"
1541
+ subject = Bolognese::Metadata.new(input: input)
1542
+ expect(subject.valid?).to be true
1543
+ expect(subject.id).to eq("https://doi.org/10.4225/13/511c71f8612c3")
1544
+ expect(subject.sizes.first).to eq("1.7 GB")
1545
+ expect(subject.formats.first).to eq("application/xml")
1546
+ end
1547
+
1548
+ it "Parsing multiple geolocationpolygon elements" do
1549
+ input = fixture_path + "datacite-geolocationpolygons-multiple.xml"
1550
+ subject = Bolognese::Metadata.new(input: input)
1551
+ expect(subject.valid?).to be true
1552
+ expect(subject.id).to eq("https://doi.org/10.5072/multiplegeopolygons")
1553
+ expect(subject.geo_locations).to eq([
1554
+ { "geoLocationPolygon"=> [
1555
+ [ {"polygonPoint"=>{"pointLatitude"=>"71", "pointLongitude"=>"41"}},
1556
+ {"polygonPoint"=>{"pointLatitude"=>"75", "pointLongitude"=>"45"}},
1557
+ {"polygonPoint"=>{"pointLatitude"=>"85", "pointLongitude"=>"55"}},
1558
+ {"polygonPoint"=>{"pointLatitude"=>"71", "pointLongitude"=>"41"}}],
1559
+ [
1560
+ {"polygonPoint"=>{"pointLatitude"=>"80", "pointLongitude"=>"65"}},
1561
+ {"polygonPoint"=>{"pointLatitude"=>"75", "pointLongitude"=>"55"}},
1562
+ {"polygonPoint"=>{"pointLatitude"=>"73", "pointLongitude"=>"45"}},
1563
+ {"polygonPoint"=>{"pointLatitude"=>"80", "pointLongitude"=>"65"}}
1564
+ ]
1565
+ ] }
1566
+ ]
1567
+ )
1568
+ end
1569
+
1319
1570
  end
@@ -29,14 +29,14 @@ describe Bolognese::Metadata, vcr: true do
29
29
  it "Crossref DOI" do
30
30
  expect(subject.valid?).to be true
31
31
  expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
32
- expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
32
+ expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
33
33
  expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
34
34
  expect(subject.creators.length).to eq(5)
35
35
  expect(subject.creators.first).to eq("nameType"=>"Personal",
36
36
  "name"=>"Sankar, Martial",
37
37
  "givenName"=>"Martial",
38
38
  "familyName"=>"Sankar",
39
- "nameIdentifiers" => [],
39
+ "nameIdentifiers" => [],
40
40
  "affiliation" => [])
41
41
  expect(subject.titles).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
42
42
  expect(subject.descriptions.first["description"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
@@ -53,7 +53,7 @@ describe Bolognese::Metadata, vcr: true do
53
53
  expect(subject.valid?).to be false
54
54
  expect(subject.state).to eq("not_found")
55
55
  expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
56
- expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Text", "ris"=>"THES", "schemaOrg"=>"Thesis")
56
+ expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Dissertation", "ris"=>"THES", "schemaOrg"=>"Thesis")
57
57
  expect(subject.creators).to eq([{"nameType"=>"Personal", "name"=>"Toparlar, Y.", "givenName"=>"Y.", "familyName"=>"Toparlar", "nameIdentifiers" => [], "affiliation" => []}])
58
58
  expect(subject.titles).to eq([{"title"=>"A multiscale analysis of the urban heat island effect"}])
59
59
  expect(subject.descriptions.first["description"]).to start_with("Designing the climates of cities")
@@ -9,7 +9,7 @@ describe Bolognese::Metadata, vcr: true do
9
9
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
10
10
  crosscite = JSON.parse(subject.crosscite)
11
11
  expect(crosscite.fetch("url")).to eq("https://elifesciences.org/articles/01567")
12
- expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
12
+ expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
13
13
  expect(crosscite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
14
14
  expect(crosscite.fetch("related_identifiers").length).to eq(27)
15
15
  expect(crosscite.fetch("related_identifiers").first).to eq("relatedIdentifier"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection")
@@ -25,7 +25,7 @@ describe Bolognese::Metadata, vcr: true do
25
25
  input = "https://doi.org/10.1155/2012/291294"
26
26
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
27
27
  crosscite = JSON.parse(subject.crosscite)
28
- expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
28
+ expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
29
29
  expect(crosscite.fetch("creators").count).to eq(7)
30
30
  expect(crosscite.fetch("creators")[2]).to eq("nameType"=>"Personal", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-2043-4925", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Hernandez, Beatriz", "givenName"=>"Beatriz", "familyName"=>"Hernandez", "affiliation" => [{"name"=>"War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA"}, {"name"=>"Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Stanford, CA 94304, USA"}])
31
31
  end
@@ -41,7 +41,7 @@ describe Bolognese::Metadata, vcr: true do
41
41
  input = fixture_path + "crossref.bib"
42
42
  subject = Bolognese::Metadata.new(input: input, from: "bibtex")
43
43
  crosscite = JSON.parse(subject.crosscite)
44
- expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "resourceType"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
44
+ expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"JournalArticle", "resourceType"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
45
45
  expect(crosscite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
46
46
  expect(crosscite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
47
47
  expect(crosscite.fetch("creators").count).to eq(5)
@@ -8,12 +8,12 @@ describe Bolognese::Metadata, vcr: true do
8
8
  input = "10.7554/eLife.01567"
9
9
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
10
10
  csv = (subject.csv).parse_csv
11
-
11
+
12
12
  expect(csv[0]).to eq("10.7554/elife.01567")
13
13
  expect(csv[1]).to eq("https://elifesciences.org/articles/01567")
14
14
  expect(csv[2]).to eq("2018-08-23")
15
15
  expect(csv[3]).to eq("findable")
16
- expect(csv[4]).to eq("Text")
16
+ expect(csv[4]).to eq("JournalArticle")
17
17
  expect(csv[5]).to eq("JournalArticle")
18
18
  expect(csv[6]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
19
19
  expect(csv[7]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
@@ -30,7 +30,7 @@ describe Bolognese::Metadata, vcr: true do
30
30
  expect(csv[1]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
31
31
  expect(csv[2]).to eq("2016-08-02")
32
32
  expect(csv[3]).to eq("findable")
33
- expect(csv[4]).to eq("Text")
33
+ expect(csv[4]).to eq("JournalArticle")
34
34
  expect(csv[5]).to eq("JournalArticle")
35
35
  expect(csv[6]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
36
36
  expect(csv[7]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
@@ -73,7 +73,7 @@ describe Bolognese::Metadata, vcr: true do
73
73
  expect(csv[8]).to eq("NASA Physical Oceanography DAAC")
74
74
  expect(csv[9]).to eq("2012")
75
75
  end
76
-
76
+
77
77
  it "maremma" do
78
78
  input = "https://github.com/datacite/maremma"
79
79
  subject = Bolognese::Metadata.new(input: input, from: "codemeta")
@@ -9,7 +9,7 @@ describe Bolognese::Metadata, vcr: true do
9
9
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
10
10
  datacite = JSON.parse(subject.datacite_json)
11
11
  expect(datacite.fetch("url")).to eq("https://elifesciences.org/articles/01567")
12
- expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
12
+ expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
13
13
  expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
14
14
  expect(datacite.fetch("relatedIdentifiers").length).to eq(27)
15
15
  expect(datacite.fetch("relatedIdentifiers").first).to eq("relatedIdentifier"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection")
@@ -25,7 +25,7 @@ describe Bolognese::Metadata, vcr: true do
25
25
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
26
26
  datacite = JSON.parse(subject.datacite_json)
27
27
  expect(datacite.fetch("url")).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
28
- expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
28
+ expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
29
29
  expect(datacite.fetch("creators").length).to eq(7)
30
30
  expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi", "affiliation" => [{"name"=>"Department of Medicine, Veterans Affairs Palo Alto Health Care System, 3801 Miranda Avenue MC-, Palo Alto, CA 94304-1207, USA"}, {"name"=>"Occupational Health Strategic Health Care Group, Office of Public Health, Veterans Health Administration, Washington, DC 20006, USA"}, {"name"=>"Division of Emergency Medicine, Stanford University School of Medicine, Stanford, CA 94304, USA"}, {"name"=>"War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA"}])
31
31
  end
@@ -34,7 +34,7 @@ describe Bolognese::Metadata, vcr: true do
34
34
  input = fixture_path + "crossref.bib"
35
35
  subject = Bolognese::Metadata.new(input: input, from: "bibtex")
36
36
  datacite = JSON.parse(subject.datacite_json)
37
- expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
37
+ expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
38
38
  expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
39
39
  expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
40
40
  expect(datacite.fetch("creators").length).to eq(5)
@@ -9,7 +9,7 @@ describe Bolognese::Metadata, vcr: true do
9
9
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
10
10
  expect(subject.valid?).to be true
11
11
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
12
- expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
12
+ expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("JournalArticle")
13
13
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
14
14
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(27)
15
15
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X", "resourceTypeGeneral"=>"Collection")
@@ -24,7 +24,7 @@ describe Bolognese::Metadata, vcr: true do
24
24
  subject = Bolognese::Metadata.new(input: input, from: "crossref")
25
25
  expect(subject.valid?).to be true
26
26
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
27
- expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
27
+ expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("JournalArticle")
28
28
  expect(datacite.dig("creators", "creator").count).to eq(7)
29
29
  expect(datacite.dig("creators", "creator")[2]).to eq("creatorName" => {"__content__"=>"Hernandez, Beatriz", "nameType"=>"Personal"},
30
30
  "familyName" => "Hernandez",
@@ -46,7 +46,7 @@ describe Bolognese::Metadata, vcr: true do
46
46
  subject = Bolognese::Metadata.new(input: input, from: "bibtex")
47
47
  expect(subject.valid?).to be true
48
48
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
49
- expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
49
+ expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("JournalArticle")
50
50
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
51
51
  expect(datacite.dig("descriptions", "description").first).to eq("__content__"=>"eLife, 3", "descriptionType"=>"SeriesInformation")
52
52
  expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
@@ -341,7 +341,7 @@ describe Bolognese::Metadata, vcr: true do
341
341
  expect(datacite.dig("identifier", "__content__")).to eq("10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1")
342
342
  expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Dataset")
343
343
  expect(datacite.dig("titles", "title")).to eq("Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
344
-
344
+
345
345
  end
346
346
 
347
347
  it "change license" do
@@ -145,7 +145,7 @@ describe Bolognese::Metadata, vcr: true do
145
145
  it "author is organization" do
146
146
  input = fixture_path + 'gtex.xml'
147
147
  url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93"
148
- content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"
148
+ content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"
149
149
  subject = Bolognese::Metadata.new(input: input, url: url, content_url: content_url, from: "datacite")
150
150
  json = JSON.parse(subject.schema_org)
151
151
  expect(json["@id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
@@ -281,8 +281,8 @@ describe Bolognese::Metadata, vcr: true do
281
281
  expect(json["name"]).to eq("Meteo measurements at the Sand Motor")
282
282
  expect(json["author"]).to eq("@type"=>"Person", "familyName"=>"Den Heijer", "givenName"=>"C", "name"=>"C Den Heijer")
283
283
  expect(json["includedInDataCatalog"]).to be_nil
284
- expect(json["spatialCoverage"].dig("geo", "polygon").length).to eq(34)
285
- expect(json["spatialCoverage"].dig("geo", "polygon").first).to eq(["4.1738852605822", "52.03913926329928"])
284
+ expect(json["spatialCoverage"].dig("geo", "polygon")[0].length).to eq(34)
285
+ expect(json["spatialCoverage"].dig("geo", "polygon")[0].first).to eq(["4.1738852605822", "52.03913926329928"])
286
286
  end
287
287
 
288
288
  it "from schema_org gtex" do