bolognese 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2147a3c32ec026e4c0ce722966ec41f3c0e01438327aaba531145783c6a05c5
4
- data.tar.gz: 30784c9ba1c00c6a32b99776344acae20013825d2f83f47ccc6c90c787271131
3
+ metadata.gz: b97f37a5ebcbedcb33b6937353b9afe721084c52591033d04657c8ef1e3fa4b7
4
+ data.tar.gz: 119f596d499c6465304b91eb2ea4733a6d83be967d564bf0bc895e69312133d0
5
5
  SHA512:
6
- metadata.gz: 9e44e0aa498541fa0b906e4251748cd6efd8920f087fff13c46da45d31c863bf1dedcfe60808b9abf6e177610c55af95edb5b725ba07c9686c5c15535d55beec
7
- data.tar.gz: d6895acf2c12a883160082a06d80256fd3c73c03b02b5675eb311aedd12a4dbfc975bd42daea9c43ad051577a3951954ee26ac5c40a31345c63349dd1331a9b5
6
+ metadata.gz: 77194ea5ab5fac3555fad930a642081f4cb146dc804baed87b35be72f9c91cf88a72e44a1b2a8ab760f15ce5d49843dd65f2c41b24aa3ce840a940093705d715
7
+ data.tar.gz: 504322b19079059e7946043c087408237e48e1266f76cc4cb9bbfaf980d47d0f628dda1e1b35d20d79a27b07e18fb220b5a22234ee572b82020a31d98f52c196
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (2.0.2)
4
+ bolognese (2.1.0)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
@@ -235,4 +235,4 @@ DEPENDENCIES
235
235
  webmock (~> 3.0, >= 3.0.1)
236
236
 
237
237
  BUNDLED WITH
238
- 2.4.10
238
+ 2.4.22
@@ -96,7 +96,7 @@ module Bolognese
96
96
  if container.present?
97
97
  container["title"]
98
98
  elsif types["citeproc"] == "article-journal"
99
- publisher
99
+ publisher["name"] if publisher.present?
100
100
  else
101
101
  nil
102
102
  end
@@ -101,7 +101,7 @@ module Bolognese
101
101
  { "name" => r.strip }
102
102
  elsif r.is_a?(Hash)
103
103
  {
104
- "name" => r["__content__"].strip,
104
+ "name" => r["__content__"].present? ? r["__content__"].strip : nil,
105
105
  "publisherIdentifier" => r["publisherIdentifierScheme"] == "ROR" ? normalize_ror(r["publisherIdentifier"]) : r["publisherIdentifier"],
106
106
  "publisherIdentifierScheme" => r["publisherIdentifierScheme"],
107
107
  "schemeUri" => r["schemeURI"],
@@ -74,8 +74,11 @@ module Bolognese
74
74
  creators = get_authors(from_schema_org_creators(Array.wrap(authors)))
75
75
  end
76
76
  contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil))))
77
- publisher_name = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true)
78
- publisher = { "name" => publisher_name } if publisher_name.present?
77
+
78
+ publisher = {
79
+ "name" => parse_attributes(meta.fetch("publisher", nil), content: "name", first: true),
80
+ "publisherIdentifier" => parse_attributes(meta.fetch("publisher", nil), content: "@id", first: true),
81
+ }.compact if meta.fetch("publisher", nil).present?
79
82
 
80
83
  ct = (schema_org == "Dataset") ? "includedInDataCatalog" : "Periodical"
81
84
  container = if meta.fetch(ct, nil).present?
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -86,7 +86,10 @@ module Bolognese
86
86
  end
87
87
 
88
88
  def insert_publisher_name(xml)
89
- xml.send("publisher-name", publisher["name"])
89
+ attributes = {
90
+ "xml:lang" => publisher["lang"]
91
+ }.compact
92
+ xml.send("publisher-name", attributes, publisher["name"])
90
93
  end
91
94
 
92
95
  def insert_publication_date(xml)
@@ -37,7 +37,7 @@ module Bolognese
37
37
  "schemaVersion" => schema_version,
38
38
  "periodical" => types.present? ? ((types["schemaOrg"] != "Dataset") && container.present? ? to_schema_org(container) : nil) : nil,
39
39
  "includedInDataCatalog" => types.present? ? ((types["schemaOrg"] == "Dataset") && container.present? ? to_schema_org_container(container, type: "Dataset") : nil) : nil,
40
- "publisher" => publisher.present? ? { "@type" => "Organization", "name" => publisher["name"] } : nil,
40
+ "publisher" => publisher.present? ? { "@type" => "Organization", "@id" => publisher["publisherIdentifier"], "name" => publisher["name"] }.compact : nil,
41
41
  "funder" => to_schema_org_funder(funding_references),
42
42
  "provider" => agency.present? ? { "@type" => "Organization", "name" => agency } : nil
43
43
  }.compact.presence
@@ -15,7 +15,7 @@
15
15
  <title xml:lang="en">DOI Test 2 title content</title>
16
16
  <title xml:lang="en">AAPP</title>
17
17
  </titles>
18
- <publisher>OSI SAF</publisher>
18
+ <publisher xml:lang="en">OSI SAF</publisher>
19
19
  <publicationYear>2004</publicationYear>
20
20
  <resourceType resourceTypeGeneral="Collection">Climate Data Record</resourceType>
21
21
  <dates>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
3
+ <identifier identifierType="DOI">10.81360/4DVP-KR57</identifier>
4
+ <creators>
5
+ <creator>
6
+ <creatorName nameType="Personal">Møller, Jørgen</creatorName>
7
+ <givenName>Jørgen</givenName>
8
+ <familyName>Møller</familyName>
9
+ </creator>
10
+ </creators>
11
+ <titles>
12
+ <title xml:lang="en">Economic Crisis and Democratic Breakdown in the Interwar Years: A Reassessment</title>
13
+ <title xml:lang="de">Wirtschaftskrise und demokratischer Zusammenbruch in der Zwischenkriegszeit: Eine Neubewertung</title>
14
+ </titles>
15
+ <publisher publisherIdentifier="https://ror.org/04wxnsj81"></publisher>
16
+ <publicationYear>2015</publicationYear>
17
+ <resourceType resourceTypeGeneral="JournalArticle"/>
18
+ </resource>
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <resource
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
5
+ <identifier identifierType="DOI">10.60843/5EGY-VC42</identifier>
6
+ <creators>
7
+ <creator>
8
+ <creatorName nameType="Personal">Feldman, Heidi Li</creatorName>
9
+ <givenName>Heidi Li</givenName>
10
+ <familyName>Feldman</familyName>
11
+ <nameIdentifier nameIdentifierScheme="ORCID" schemeURI="https://orcid.org">https://orcid.org/0000-0003-1905-2698</nameIdentifier>
12
+ </creator>
13
+ </creators>
14
+ <titles>
15
+ <title xml:lang="en">Science and Uncertainty in Mass Exposure Litigation</title>
16
+ <title xml:lang="en">Science and Uncertainty in Mass Exposure Litigation, 74 Tex. L. Rev. 1 (1995)</title>
17
+ </titles>
18
+ <publisher>Texas Law Review</publisher>
19
+ <publicationYear>1995</publicationYear>
20
+ <resourceType resourceTypeGeneral="JournalArticle">Article</resourceType>
21
+ <subjects>
22
+ <subject subjectScheme="Fields of Science and Technology (FOS)" schemeURI="http://www.oecd.org/science/inno/38235147.pdf" classificationCode="5.5">FOS: Law</subject>
23
+ </subjects>
24
+ <contributors>
25
+ <contributor contributorType="HostingInstitution">
26
+ <contributorName nameType="Organizational">Georgetown Law Library</contributorName>
27
+ <nameIdentifier nameIdentifierScheme="" schemeURI=""/>
28
+ <affiliation affiliationIdentifier="https://ror.org/05vzafd60" affiliationIdentifierScheme="ROR" schemeURI="https://ror.org">Georgetown University</affiliation>
29
+ </contributor>
30
+ </contributors>
31
+ <dates>
32
+ <date dateType="Issued">1995-11</date>
33
+ <date dateType="Collected">2016-04-25</date>
34
+ </dates>
35
+ <language>en</language>
36
+ <relatedIdentifiers>
37
+ <relatedIdentifier relatedIdentifierType="ISSN" relationType="IsPublishedIn" resourceTypeGeneral="Journal">0040-4411</relatedIdentifier>
38
+ </relatedIdentifiers>
39
+ <relatedItems>
40
+ <relatedItem relatedItemType="Journal" relationType="IsSourceOf">
41
+ <relatedItemIdentifier relatedItemIdentifierType="ISSN">0040-4411</relatedItemIdentifier>
42
+ <creators>
43
+ <creator>
44
+ <creatorName>University of Texas School of Law</creatorName>
45
+ </creator>
46
+ </creators>
47
+ <titles>
48
+ <title>Texas Law Review</title>
49
+ </titles>
50
+ <publicationYear>1995</publicationYear>
51
+ <volume>74</volume>
52
+ <issue>1</issue>
53
+ </relatedItem>
54
+ </relatedItems>
55
+ <sizes/>
56
+ <formats>
57
+ <format>text/html</format>
58
+ <format>application/pdf</format>
59
+ </formats>
60
+ <version/>
61
+ <descriptions>
62
+ <description xml:lang="en" descriptionType="Abstract">Critics of the tort system have condemned courts for their alleged leniency in admitting scientific expert testimony, especially in mass exposure litigation. Claiming that this has resulted in an epidemic of "junk science" in the courtroom, these commentators have urged a more scientific approach to admissibility, intimating that employing more scientific standards would exclude scientific evidence favorable to plaintiffs, thereby demonstrating to factfinders that litigated substances are in fact safe or at least not unsafe.</description>
63
+ </descriptions>
64
+ </resource>
@@ -14,6 +14,7 @@
14
14
  }],
15
15
  "publisher": {
16
16
  "@type": "Organization",
17
+ "@id": "https://ror.org/04wxnsj81",
17
18
  "name": "DataCite"
18
19
  },
19
20
  "dateCreated": "2016-12-20",
@@ -1801,4 +1801,12 @@ describe Bolognese::Metadata, vcr: true do
1801
1801
  ]
1802
1802
  )
1803
1803
  end
1804
+
1805
+ it "blank publisher" do
1806
+ input = fixture_path + "datacite_blank_publisher.xml"
1807
+ subject = Bolognese::Metadata.new(input: input)
1808
+ expect(subject.publisher).to eq(
1809
+ { "publisherIdentifier" => "https://ror.org/04wxnsj81" }
1810
+ )
1811
+ end
1804
1812
  end
@@ -169,7 +169,7 @@ describe Bolognese::Metadata, vcr: true do
169
169
  expect(subject.publication_year).to eq("2016")
170
170
  expect(subject.related_identifiers.length).to eq(3)
171
171
  expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References")
172
- expect(subject.publisher).to eq({"name"=>"DataCite"})
172
+ expect(subject.publisher).to eq({"name"=>"DataCite", "publisherIdentifier"=>"https://ror.org/04wxnsj81"})
173
173
  end
174
174
 
175
175
  it "GTEx dataset" do
@@ -48,5 +48,14 @@ describe Bolognese::Metadata, vcr: true do
48
48
  expect(subject.locale).to eq("en-US")
49
49
  expect(subject.citation).to eq("Clark, D. (2019). <i>Exploring the \"Many analysts, one dataset\" project from COS</i>. Gigantum, Inc. https://doi.org/10.34747/g6yb-3412")
50
50
  end
51
+
52
+ it "journal article with container title" do
53
+ input = fixture_path + "datacite_journal_article.xml"
54
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
55
+ expect(subject.types["citeproc"]).to eq("article-journal")
56
+ expect(subject.style).to eq("apa")
57
+ expect(subject.locale).to eq("en-US")
58
+ expect(subject.citation).to eq('Feldman, H. L. (1995). Science and Uncertainty in Mass Exposure Litigation. <i>Texas Law Review</i>. https://doi.org/10.60843/5egy-vc42')
59
+ end
51
60
  end
52
61
  end
@@ -179,6 +179,13 @@ describe Bolognese::Metadata, vcr: true do
179
179
  expect(jats.dig("day")).to be_nil
180
180
  expect(jats.dig("pub_id")).to eq("pub_id_type"=>"doi", "__content__"=>"10.34747/g6yb-3412")
181
181
  end
182
+
183
+ it "with publisher with language" do
184
+ input = fixture_path + 'datacite-xml-lang.xml'
185
+ subject = Bolognese::Metadata.new(input: input)
186
+ jats = Maremma.from_xml(subject.jats).fetch("element_citation", {})
187
+ expect(jats.dig("publisher_name")).to eq({"xml:lang"=>"en", "__content__"=>"OSI SAF"})
188
+ end
182
189
  end
183
190
 
184
191
  context "change metadata as datacite xml" do
@@ -365,5 +365,18 @@ describe Bolognese::Metadata, vcr: true do
365
365
  expect(json["@type"]).to eq("CreativeWork")
366
366
  expect(json["datePublished"]).to eq("2019")
367
367
  end
368
+
369
+ it "from Schema 4.5 with publisher attributes" do
370
+ input = fixture_path + 'datacite-example-full-v4.5.xml'
371
+ subject = Bolognese::Metadata.new(input: input)
372
+ json = JSON.parse(subject.schema_org)
373
+ expect(json["publisher"]).to eq(
374
+ {
375
+ "@type" => "Organization",
376
+ "@id" => "https://ror.org/04z8jg394",
377
+ "name" => "Example Publisher"
378
+ }
379
+ )
380
+ end
368
381
  end
369
382
  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.0.2
4
+ version: 2.1.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: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -829,7 +829,9 @@ files:
829
829
  - spec/fixtures/datacite.json
830
830
  - spec/fixtures/datacite.xml
831
831
  - spec/fixtures/datacite_blank_name_identifier.xml
832
+ - spec/fixtures/datacite_blank_publisher.xml
832
833
  - spec/fixtures/datacite_dataset.xml
834
+ - spec/fixtures/datacite_journal_article.xml
833
835
  - spec/fixtures/datacite_malformed_creator.xml
834
836
  - spec/fixtures/datacite_missing_creator.xml
835
837
  - spec/fixtures/datacite_schema_3.xml