bolognese 0.9.11 → 0.9.13

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
  SHA1:
3
- metadata.gz: 0276dc8cca601488c3abcf88faf4375b19ca9697
4
- data.tar.gz: 770cd88d5571911799e99bb52426784a552cacc6
3
+ metadata.gz: aaee569568f76b04f3c5707cb20c7c3b91b5c42b
4
+ data.tar.gz: d267f2d4b97689676b9986b698ea47b628ad07d2
5
5
  SHA512:
6
- metadata.gz: 071c0ea2fac32b1094792db83c30015a36bb93bd676478892733d14c696577f3aa77f29afc9aaaefca1ed721014dcbe5aa76091fa2b5d922de097846b50a6ef8
7
- data.tar.gz: 3897826b1cdcc2a106393224793ce9220cb1317bfc5cc637b7b1324be94c8ca9d888c62b2d282d195d0161e3ab437c2cafd933c01c2a3743f7de93ac4bebede6
6
+ metadata.gz: f9a881f202c52634a6e3e0d8d5fc033b337a507fe6755104e6602631407772add424670d12fde54e406e15941a4a9fb3cc63640f0bce16f180fba6b28501ff31
7
+ data.tar.gz: 9b91e62983d77e603a29cd9d458fbc95adddcaa18f27792397b1eca213daea240beab70511aed08a3d8258d2c8ed2a30536d9103963ebb1e8bd98e0b911c2680
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.11)
4
+ bolognese (0.9.13)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -167,7 +167,8 @@ module Bolognese
167
167
  { "__content__" => r["id"] || r["issn"],
168
168
  "related_identifier_type" => r["issn"].present? ? "ISSN" : validate_url(r["id"]),
169
169
  "relation_type" => r["relationType"],
170
- "resource_type_general" => r["resourceTypeGeneral"] }.compact
170
+ "resource_type_general" => r["resourceTypeGeneral"] || "Other",
171
+ "title" => r["title"] }.compact
171
172
  end
172
173
  end
173
174
 
@@ -179,7 +180,8 @@ module Bolognese
179
180
  attributes = {
180
181
  'relatedIdentifierType' => related_identifier["related_identifier_type"],
181
182
  'relationType' => related_identifier["relation_type"],
182
- 'resourceTypeGeneral' => related_identifier["resource_type_general"] }.compact
183
+ 'resourceTypeGeneral' => related_identifier["resource_type_general"],
184
+ 'title' => related_identifier["title"] }.compact
183
185
  xml.relatedIdentifier(related_identifier["__content__"], attributes)
184
186
  end
185
187
  end
@@ -320,7 +320,7 @@ module Bolognese
320
320
  end
321
321
 
322
322
  def container_title
323
- is_part_of.to_h.fetch("name", nil)
323
+ is_part_of.to_h.fetch("title", nil)
324
324
  end
325
325
 
326
326
  def descriptions
@@ -37,7 +37,7 @@ module Bolognese
37
37
 
38
38
  is_part_of = if meta.journal.present?
39
39
  { "type" => "Periodical",
40
- "name" => meta.journal.to_s,
40
+ "title" => meta.journal.to_s,
41
41
  "issn" => meta.issn.to_s.presence }.compact
42
42
  else
43
43
  nil
@@ -38,7 +38,7 @@ module Bolognese
38
38
  container_title = meta.fetch("container-title", nil)
39
39
  is_part_of = if container_title.present?
40
40
  { "type" => "Periodical",
41
- "name" => container_title,
41
+ "title" => container_title,
42
42
  "issn" => meta.fetch("ISSN", nil) }.compact
43
43
  else
44
44
  nil
@@ -190,7 +190,7 @@ module Bolognese
190
190
  def crossref_is_part_of(journal_metadata)
191
191
  if journal_metadata.present?
192
192
  { "type" => "Periodical",
193
- "name" => journal_metadata["full_title"],
193
+ "title" => journal_metadata["full_title"],
194
194
  "issn" => parse_attributes(journal_metadata.fetch("issn", nil)) }.compact
195
195
  else
196
196
  nil
@@ -201,7 +201,8 @@ module Bolognese
201
201
  refs = bibliographic_metadata.dig("citation_list", "citation")
202
202
  Array.wrap(refs).select { |a| a["doi"].present? }.map do |c|
203
203
  { "id" => normalize_id(c["doi"]),
204
- "type" => "CreativeWork" }.compact
204
+ "type" => "CreativeWork",
205
+ "title" => c["article_title"] }.compact
205
206
  end.unwrap
206
207
  end
207
208
  end
@@ -41,7 +41,7 @@ module Bolognese
41
41
  container_title = meta.fetch("T2", nil)
42
42
  is_part_of = if container_title.present?
43
43
  { "type" => "Periodical",
44
- "name" => container_title,
44
+ "title" => container_title,
45
45
  "issn" => meta.fetch("SN", nil) }.compact
46
46
  else
47
47
  nil
@@ -21,12 +21,11 @@ module Bolognese
21
21
  resource_type_general = Bolognese::Utils::SO_TO_DC_TRANSLATIONS[type]
22
22
  author = get_authors(from_schema_org(Array.wrap(meta.fetch("author", nil))))
23
23
  editor = get_authors(from_schema_org(Array.wrap(meta.fetch("editor", nil))))
24
- publisher = meta.dig("publisher", "name")
25
- container_title = if publisher.is_a?(Hash)
26
- publisher.fetch("name", nil)
27
- elsif publisher.is_a?(String)
28
- publisher
29
- end
24
+ publisher = if meta.dig("publisher").is_a?(Hash)
25
+ meta.dig("publisher", "name")
26
+ elsif publisher.is_a?(String)
27
+ meta.dig("publisher")
28
+ end
30
29
  date_published = meta.fetch("datePublished", nil)
31
30
 
32
31
  { "id" => id,
@@ -41,7 +40,6 @@ module Bolognese
41
40
  "title" => meta.fetch("name", nil),
42
41
  "alternate_name" => meta.fetch("alternateName", nil),
43
42
  "author" => author,
44
- "container_title" => container_title,
45
43
  "publisher" => meta.dig("publisher", "name"),
46
44
  "provider" => meta.fetch("provider", nil),
47
45
  "is_identical_to" => schema_org_is_identical_to(meta),
@@ -321,7 +321,7 @@ module Bolognese
321
321
  Array.wrap(ids).map do |id|
322
322
  { "id" => normalize_id(id["@id"]),
323
323
  "type" => id["@type"] || Metadata::DC_TO_SO_TRANSLATIONS[id["resourceTypeGeneral"]] || "CreativeWork",
324
- "name" => id["name"] }.compact
324
+ "title" => id["title"] || id["name"] }.compact
325
325
  end.unwrap
326
326
  end
327
327
 
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.11"
2
+ VERSION = "0.9.13"
3
3
  end
@@ -24,7 +24,7 @@ module Bolognese
24
24
  "pagination" => pagination,
25
25
  "spatialCoverage" => spatial_coverage,
26
26
  "sameAs" => same_as,
27
- "isPartOf" => is_part_of,
27
+ "isPartOf" => is_part_of.present? ? is_part_of.merge("name" => is_part_of["title"]) : nil,
28
28
  "hasPart" => has_part,
29
29
  "predecessor_of" => is_previous_version_of,
30
30
  "successor_of" => is_new_version_of,
@@ -123,12 +123,15 @@ describe Bolognese::Metadata, vcr: true do
123
123
  response = Maremma.from_xml(xml)
124
124
  expect(response.dig("relatedIdentifiers", "relatedIdentifier")).to eq([{"relatedIdentifierType"=>"DOI",
125
125
  "relationType"=>"HasPart",
126
+ "resourceTypeGeneral"=>"Other",
126
127
  "__content__"=>"https://doi.org/10.5061/dryad.8515/1"},
127
128
  {"relatedIdentifierType"=>"DOI",
128
129
  "relationType"=>"HasPart",
130
+ "resourceTypeGeneral"=>"Other",
129
131
  "__content__"=>"https://doi.org/10.5061/dryad.8515/2"},
130
132
  {"relatedIdentifierType"=>"DOI",
131
133
  "relationType"=>"IsReferencedBy",
134
+ "resourceTypeGeneral"=>"Other",
132
135
  "__content__"=>"https://doi.org/10.1371/journal.ppat.1000446"}])
133
136
  end
134
137
  end
@@ -24,7 +24,7 @@ describe Bolognese::Metadata, vcr: true do
24
24
  expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
25
25
  expect(subject.license["id"]).to eq("http://creativecommons.org/licenses/by/3.0/")
26
26
  expect(subject.date_published).to eq("2014")
27
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
27
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife", "issn"=>"2050-084X")
28
28
  end
29
29
  end
30
30
  end
@@ -22,7 +22,7 @@ describe Bolognese::Metadata, vcr: true do
22
22
  expect(subject.title).to eq("Eating your own Dog Food")
23
23
  expect(subject.description["text"]).to start_with("Eating your own dog food")
24
24
  expect(subject.date_published).to eq("2016-12-20")
25
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"DataCite Blog")
25
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"DataCite Blog")
26
26
  end
27
27
  end
28
28
  end
@@ -26,7 +26,7 @@ describe Bolognese::Metadata, vcr: true do
26
26
  expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
27
27
  expect(subject.date_published).to eq("2014-02-11")
28
28
  expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
29
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
29
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife", "issn"=>"2050-084X")
30
30
  expect(subject.references.count).to eq(25)
31
31
  expect(subject.references[19]).to eq("id"=>"https://doi.org/10.5061/dryad.b835k", "type"=>"CreativeWork")
32
32
  expect(subject.funder).to eq([{"name"=>"SystemsX"},
@@ -55,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
55
55
  expect(subject.date_published).to eq("2006-12-20")
56
56
  expect(subject.date_modified).to eq("2016-12-31T21:37:08Z")
57
57
  expect(subject.pagination).to eq("e30")
58
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"PLoS ONE", "issn"=>"1932-6203")
58
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"PLoS ONE", "issn"=>"1932-6203")
59
59
  expect(subject.provider).to eq("Crossref")
60
60
  end
61
61
 
@@ -92,7 +92,7 @@ describe Bolognese::Metadata, vcr: true do
92
92
  expect(subject.date_published).to eq("2006-11")
93
93
  expect(subject.date_modified).to eq("2017-04-01T00:47:57Z")
94
94
  expect(subject.pagination).to eq("2832-2841")
95
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Ecology", "issn"=>"0012-9658")
95
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"Ecology", "issn"=>"0012-9658")
96
96
  expect(subject.provider).to eq("Crossref")
97
97
  end
98
98
 
@@ -111,7 +111,7 @@ describe Bolognese::Metadata, vcr: true do
111
111
  expect(subject.date_published).to eq("2012")
112
112
  expect(subject.date_modified).to eq("2016-08-02T12:42:41Z")
113
113
  expect(subject.pagination).to eq("1-7")
114
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"Pulmonary Medicine", "issn"=>["2090-1836", "2090-1844"])
114
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"Pulmonary Medicine", "issn"=>["2090-1836", "2090-1844"])
115
115
  expect(subject.provider).to eq("Crossref")
116
116
  end
117
117
 
@@ -128,7 +128,7 @@ describe Bolognese::Metadata, vcr: true do
128
128
  expect(subject.title).to eq("Paving the path to HIV neurotherapy: Predicting SIV CNS disease")
129
129
  expect(subject.date_published).to eq("2015-07")
130
130
  expect(subject.date_modified).to eq("2016-08-20T02:19:38Z")
131
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"European Journal of Pharmacology", "issn"=>"00142999")
131
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"European Journal of Pharmacology", "issn"=>"00142999")
132
132
  expect(subject.provider).to eq("Crossref")
133
133
  end
134
134
 
@@ -26,7 +26,7 @@ describe Bolognese::Metadata, vcr: true do
26
26
  expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
27
27
  expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
28
28
  expect(subject.date_published).to eq("2014")
29
- expect(subject.is_part_of).to eq("type"=>"Periodical", "name"=>"eLife")
29
+ expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife")
30
30
  end
31
31
  end
32
32
  end
@@ -27,7 +27,7 @@ describe Bolognese::Metadata, vcr: true do
27
27
  expect(subject.keywords).to eq("datacite, doi, metadata, featured")
28
28
  expect(subject.date_published).to eq("2016-12-20")
29
29
  expect(subject.date_modified).to eq("2016-12-20")
30
- expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "name"=>"DataCite Blog")
30
+ expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
31
31
  expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
32
32
  expect(subject.publisher).to eq("DataCite")
33
33
  end
@@ -55,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
55
55
  expect(subject.keywords).to eq("datacite, doi, metadata, featured")
56
56
  expect(subject.date_published).to eq("2016-12-20")
57
57
  expect(subject.date_modified).to eq("2016-12-20")
58
- expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "name"=>"DataCite Blog")
58
+ expect(subject.is_part_of).to eq("id"=>"https://doi.org/10.5438/0000-00ss", "type"=>"Blog", "title"=>"DataCite Blog")
59
59
  expect(subject.references).to eq([{"id"=>"https://doi.org/10.5438/0012", "type"=>"CreativeWork"}, {"id"=>"https://doi.org/10.5438/55e5-t5c0", "type"=>"CreativeWork"}])
60
60
  expect(subject.publisher).to eq("DataCite")
61
61
  end
@@ -9,8 +9,8 @@ describe Bolognese::Metadata, vcr: true do
9
9
  expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
10
10
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
11
11
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").length).to eq(26)
12
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "__content__"=>"2050-084X")
13
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "__content__"=>"https://doi.org/10.1038/nature02100")
12
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral" => "Other", "title"=>"eLife", "__content__"=>"2050-084X")
13
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier")[1]).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"References", "resourceTypeGeneral" => "Other", "__content__"=>"https://doi.org/10.1038/nature02100")
14
14
  expect(datacite.dig("rightsList")).to eq("rights"=>{"rightsURI"=>"http://creativecommons.org/licenses/by/3.0"})
15
15
  expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
16
16
  expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
@@ -119,7 +119,7 @@ describe Bolognese::Metadata, vcr: true do
119
119
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
120
120
  expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food")
121
121
  expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(3)
122
- expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "__content__"=>"https://doi.org/10.5438/0000-00ss")
122
+ expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").first).to eq("relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "title" => "DataCite Blog", "resourceTypeGeneral" => "Other", "__content__"=>"https://doi.org/10.5438/0000-00ss")
123
123
  end
124
124
  end
125
125
  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: 0.9.11
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-06 00:00:00.000000000 Z
11
+ date: 2017-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma