bolognese 1.0.1 → 1.0.2

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: 14165d8b671c0f3e459bdf0c7ad0289f153a36de3265c692b3c80555d66130fe
4
- data.tar.gz: 127ac92957eb3acf0e394ed89dbfb336812cb64f8010a3c57db13aa4f415c28e
3
+ metadata.gz: acbbf45161f598000d9ff25bb9377c5332eb1482830a2e2b4137aab2fcc33043
4
+ data.tar.gz: 3a6c992a04626c916ec2f579aad4f9ab303756071db6a8178499a996834416cd
5
5
  SHA512:
6
- metadata.gz: 1361a1bd8634c0e43316341c07e6cc6f42f1ed4c996f9df1df9531d0068c1f79f6a3bdc735fdd5cac5969a367f8a066ba980ecf404658542d074a8bdea894667
7
- data.tar.gz: f0d26f6bcd599374ad657caf732b79f75ed4d28d2460b5af1486f9d47a7e85ac3d5768a7c13eed7d90b2d864c4065ed9251108b89d477d4ff2023b6e73a4a6ee
6
+ metadata.gz: 65dba0019f3401ae22dbd8d05da1cda01900ab0f865a3b37c8b4d7983e7d8616779e0ad7b7a123815eef252db8c5734982321bcf5cc2cc599e75a70dec436417
7
+ data.tar.gz: d856dea89a299b900acd9462cf01b2cb1c88fe0d8619cd003b6f2fb4da4e54624e86bb580db50488c7d31a256c9fbede5802b185b126c253328c714bc3dd1191
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.0.1)
4
+ bolognese (1.0.2)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -153,9 +153,9 @@ module Bolognese
153
153
  end
154
154
 
155
155
  def insert_version(xml)
156
- return xml unless b_version.present?
156
+ return xml unless version.present?
157
157
 
158
- xml.version(b_version)
158
+ xml.version(version)
159
159
  end
160
160
 
161
161
  def insert_related_identifiers(xml)
@@ -6,7 +6,13 @@ module Bolognese
6
6
  class Metadata
7
7
  include Bolognese::MetadataUtils
8
8
 
9
- attr_writer :id, :provider_id, :client_id, :doi
9
+ attr_writer :id, :provider_id, :client_id, :doi, :identifier, :creator, :title, :publisher, :rights, :dates, :date_published, :date_modified,
10
+ :date_updated, :journal, :volume, :first_page, :last_page, :url, :version, :resource_type_general,
11
+ :keywords, :editor, :description, :alternate_identifiers, :language, :size,
12
+ :formats, :schema_version, :resource_type_general, :meta, :periodical,
13
+ :format, :funding_references, :style, :locale, :state, :geo_location,
14
+ :type, :additional_type, :citeproc_type, :bibtex_type, :ris_type, :content_url, :related_identifiers
15
+
10
16
 
11
17
  def initialize(input: nil, from: nil, **options)
12
18
  id = normalize_id(input, options)
@@ -20,7 +26,7 @@ module Bolognese
20
26
  elsif input.present? && File.exist?(input)
21
27
  ext = File.extname(input)
22
28
  if %w(.bib .ris .xml .json).include?(ext)
23
- hsh = { "b_url" => options[:b_url],
29
+ hsh = { "url" => options[:url],
24
30
  "state" => options[:state],
25
31
  "date_registered" => options[:date_registered],
26
32
  "date_updated" => options[:date_updated],
@@ -34,7 +40,7 @@ module Bolognese
34
40
  exit 1
35
41
  end
36
42
  else
37
- hsh = { "b_url" => options[:b_url],
43
+ hsh = { "url" => options[:url],
38
44
  "state" => options[:state],
39
45
  "date_registered" => options[:date_registered],
40
46
  "date_updated" => options[:date_updated],
@@ -57,7 +63,7 @@ module Bolognese
57
63
  @sandbox = options[:sandbox]
58
64
 
59
65
  # options that come from the datacite database
60
- @b_url = hsh.to_h["b_url"].presence || options[:b_url].presence
66
+ @url = hsh.to_h["url"].presence || options[:url].presence
61
67
  @state = hsh.to_h["state"].presence
62
68
  @date_registered = hsh.to_h["date_registered"].presence
63
69
  @date_updated = hsh.to_h["date_updated"].presence
@@ -119,8 +125,8 @@ module Bolognese
119
125
  @size ||= meta.fetch("size", nil)
120
126
  end
121
127
 
122
- def b_format
123
- @b_format ||= meta.fetch("b_format", nil)
128
+ def formats
129
+ @formats ||= meta.fetch("formats", nil)
124
130
  end
125
131
 
126
132
  def schema_version
@@ -135,12 +141,12 @@ module Bolognese
135
141
  @related_identifiers ||= meta.fetch("related_identifiers", nil)
136
142
  end
137
143
 
138
- def b_url
139
- @b_url ||= meta.fetch("b_url", nil)
144
+ def url
145
+ @url ||= meta.fetch("url", nil)
140
146
  end
141
147
 
142
- def b_version
143
- @b_version ||= meta.fetch("b_version", nil)
148
+ def version
149
+ @version ||= meta.fetch("version", nil)
144
150
  end
145
151
 
146
152
  def publication_year
@@ -62,15 +62,7 @@ module Bolognese
62
62
  include Bolognese::Writers::TurtleWriter
63
63
 
64
64
  attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :contributor
65
-
66
- attr_writer :identifier, :creator, :title, :publisher, :rights, :dates, :date_published, :date_modified,
67
- :date_updated, :journal, :volume, :first_page, :last_page, :b_url, :b_version, :resource_type_general,
68
- :keywords, :editor, :description, :alternate_identifiers, :language, :size,
69
- :b_format, :schema_version, :resource_type_general, :meta, :periodical,
70
- :format, :funding_references, :style, :locale, :state, :geo_location,
71
- :type, :additional_type, :citeproc_type, :bibtex_type, :ris_type, :content_url, :related_identifiers
72
-
73
- attr_reader :doc, :service_provider, :page_start, :page_end, :related_identifier, :reverse, :name_detector
65
+ attr_reader :doc, :service_provider, :page_start, :page_end, :reverse, :name_detector
74
66
 
75
67
  # replace DOI in XML if provided in options
76
68
  def raw
@@ -146,8 +138,8 @@ module Bolognese
146
138
  "page" => [first_page, last_page].compact.join("-").presence,
147
139
  "publisher" => publisher,
148
140
  "title" => parse_attributes(title, content: "text", first: true),
149
- "URL" => b_url,
150
- "version" => b_version,
141
+ "URL" => url,
142
+ "version" => version,
151
143
  "volume" => volume
152
144
  }.compact.symbolize_keys
153
145
  end
@@ -68,7 +68,7 @@ module Bolognese
68
68
  "resource_type_general" => Metadata::SO_TO_DC_TRANSLATIONS[type],
69
69
  "additional_type" => Bolognese::Utils::BIB_TO_CR_TRANSLATIONS[meta.try(:type).to_s] || meta.try(:type).to_s,
70
70
  "doi" => doi,
71
- "b_url" => meta.try(:url).to_s,
71
+ "url" => meta.try(:url).to_s,
72
72
  "title" => meta.try(:title).to_s,
73
73
  "creator" => author,
74
74
  "periodical" => periodical,
@@ -66,7 +66,7 @@ module Bolognese
66
66
  "ris_type" => CP_TO_RIS_TRANSLATIONS[type] || "GEN",
67
67
  "resource_type_general" => Bolognese::Utils::SO_TO_DC_TRANSLATIONS[type],
68
68
  "doi" => doi_from_url(doi),
69
- "b_url" => normalize_id(meta.fetch("URL", nil)),
69
+ "url" => normalize_id(meta.fetch("URL", nil)),
70
70
  "title" => meta.fetch("title", nil),
71
71
  "creator" => author,
72
72
  "periodical" => periodical,
@@ -77,7 +77,7 @@ module Bolognese
77
77
  #{}"pagination" => meta.pages.to_s.presence,
78
78
  "description" => meta.fetch("abstract", nil).present? ? { "text" => sanitize(meta.fetch("abstract")) } : nil,
79
79
  #{ }"rights" => { "id" => meta.field?(:copyright) && meta.copyright.to_s.presence },
80
- "b_version" => meta.fetch("version", nil),
80
+ "version" => meta.fetch("version", nil),
81
81
  "keywords" => meta.fetch("categories", nil),
82
82
  "state" => state
83
83
  }
@@ -42,7 +42,7 @@ module Bolognese
42
42
  "resource_type_general" => Bolognese::Utils::SO_TO_DC_TRANSLATIONS[type],
43
43
  "identifier" => identifier,
44
44
  "doi" => validate_doi(id),
45
- "b_url" => normalize_id(meta.fetch("codeRepository", nil)),
45
+ "url" => normalize_id(meta.fetch("codeRepository", nil)),
46
46
  "title" => meta.fetch("title", nil),
47
47
  "creator" => author,
48
48
  "editor" => editor,
@@ -53,7 +53,7 @@ module Bolognese
53
53
  "date_modified" => meta.fetch("dateModified", nil),
54
54
  "description" => meta.fetch("description", nil).present? ? { "text" => sanitize(meta.fetch("description")) } : nil,
55
55
  "rights" => { "id" => meta.fetch("license", nil) },
56
- "b_version" => meta.fetch("version", nil),
56
+ "version" => meta.fetch("version", nil),
57
57
  "keywords" => meta.fetch("tags", nil),
58
58
  "state" => state
59
59
  }
@@ -97,7 +97,7 @@ module Bolognese
97
97
  "ris_type" => Bolognese::Utils::CR_TO_RIS_TRANSLATIONS[additional_type] || "JOUR",
98
98
  "resource_type_general" => Bolognese::Utils::SO_TO_DC_TRANSLATIONS[type],
99
99
  "doi" => doi,
100
- "b_url" => bibliographic_metadata.dig("doi_data", "resource"),
100
+ "url" => bibliographic_metadata.dig("doi_data", "resource"),
101
101
  "title" => parse_attributes(bibliographic_metadata.dig("titles", "title")),
102
102
  "alternate_identifiers" => crossref_alternate_identifiers(bibliographic_metadata),
103
103
  "creator" => crossref_people(bibliographic_metadata, "author"),
@@ -115,7 +115,7 @@ module Bolognese
115
115
  "last_page" => bibliographic_metadata.dig("pages", "last_page"),
116
116
  "description" => crossref_description(bibliographic_metadata),
117
117
  "rights" => crossref_license(program_metadata),
118
- "b_version" => nil,
118
+ "version" => nil,
119
119
  "keywords" => nil,
120
120
  "language" => nil,
121
121
  "size" => nil,
@@ -27,7 +27,7 @@ module Bolognese
27
27
  "ris_type" => Bolognese::Utils::SO_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN",
28
28
  "resource_type_general" => resource_type_general,
29
29
  "doi" => validate_doi(meta.fetch("doi", nil)),
30
- "b_url" => normalize_id(meta.fetch("url", nil)),
30
+ "url" => normalize_id(meta.fetch("url", nil)),
31
31
  "title" => meta.fetch("title", nil),
32
32
  "alternate_identifiers" => meta.fetch("alternate-identifiers", nil),
33
33
  "creator" => meta.fetch("creator", nil),
@@ -42,11 +42,11 @@ module Bolognese
42
42
  "date_modified" => meta.fetch("date-modified", nil),
43
43
  "description" => meta.fetch("description", nil),
44
44
  "rights" => meta.fetch("rights", nil),
45
- "b_version" => meta.fetch("version", nil),
45
+ "version" => meta.fetch("version", nil),
46
46
  "keywords" => meta.fetch("subject", nil),
47
47
  "language" => meta.fetch("language", nil),
48
48
  "size" => meta.fetch("size", nil),
49
- "format" => meta.fetch("format", nil),
49
+ "formats" => meta.fetch("formats", nil),
50
50
  "geo_location" => meta.fetch("geo-location", nil),
51
51
  "schema_version" => meta.fetch("schema-version", nil),
52
52
  "state" => state
@@ -39,7 +39,7 @@ module Bolognese
39
39
  end.compact
40
40
 
41
41
  { "string" => string,
42
- "b_url" => attributes.fetch("url", nil),
42
+ "url" => attributes.fetch("url", nil),
43
43
  "state" => attributes.fetch("state", nil),
44
44
  "date_registered" => attributes.fetch("minted", nil),
45
45
  "date_updated" => attributes.fetch("updated", nil),
@@ -174,12 +174,12 @@ module Bolognese
174
174
  "date_modified" => datacite_date(dates, "Updated"),
175
175
  "description" => description,
176
176
  "rights" => rights,
177
- "b_version" => meta.fetch("version", nil),
177
+ "version" => meta.fetch("version", nil),
178
178
  "keywords" => keywords,
179
179
  "language" => meta.fetch("language", nil),
180
180
  "geo_location" => geo_location,
181
181
  "related_identifiers" => related_identifiers,
182
- "b_format" => formats,
182
+ "formats" => formats,
183
183
  "size" => sizes,
184
184
  "schema_version" => schema_version,
185
185
  "state" => state
@@ -67,7 +67,7 @@ module Bolognese
67
67
  "ris_type" => ris_type,
68
68
  "resource_type_general" => Metadata::SO_TO_DC_TRANSLATIONS[type],
69
69
  "doi" => doi,
70
- "b_url" => meta.fetch("UR", nil),
70
+ "url" => meta.fetch("UR", nil),
71
71
  "title" => meta.fetch("T1", nil),
72
72
  "creator" => get_authors(author),
73
73
  "publisher" => meta.fetch("PB", "(:unav)"),
@@ -123,10 +123,10 @@ module Bolognese
123
123
  "doi" => validate_doi(id),
124
124
  "identifier" => identifier,
125
125
  "alternate_identifiers" => alternate_identifiers,
126
- "b_url" => normalize_id(meta.fetch("url", nil)),
126
+ "url" => normalize_id(meta.fetch("url", nil)),
127
127
  "content_url" => Array.wrap(meta.fetch("contentUrl", nil)).unwrap,
128
128
  "size" => meta.fetch("contenSize", nil),
129
- "format" => Array.wrap(meta.fetch("encodingFormat", nil) || meta.fetch("fileFormat", nil)).unwrap,
129
+ "formats" => Array.wrap(meta.fetch("encodingFormat", nil) || meta.fetch("fileFormat", nil)).unwrap,
130
130
  "title" => meta.fetch("name", nil),
131
131
  "creator" => author,
132
132
  "editor" => editor,
@@ -139,7 +139,7 @@ module Bolognese
139
139
  "date_modified" => meta.fetch("dateModified", nil),
140
140
  "description" => meta.fetch("description", nil).present? ? { "text" => sanitize(meta.fetch("description")) } : nil,
141
141
  "rights" => rights,
142
- "b_version" => meta.fetch("version", nil),
142
+ "version" => meta.fetch("version", nil),
143
143
  "keywords" => meta.fetch("keywords", nil).to_s.split(", "),
144
144
  "state" => state,
145
145
  "schema_version" => meta.fetch("schemaVersion", nil),
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -10,7 +10,7 @@ module Bolognese
10
10
  bibtex_type: bibtex_type.presence || "misc",
11
11
  bibtex_key: identifier,
12
12
  doi: doi,
13
- url: b_url,
13
+ url: url,
14
14
  author: authors_as_string(creator),
15
15
  keywords: keywords.present? ? Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.join(", ") : nil,
16
16
  language: language,
@@ -11,11 +11,11 @@ module Bolognese
11
11
  "@type" => type,
12
12
  "@id" => identifier,
13
13
  "identifier" => identifier,
14
- "codeRepository" => b_url,
14
+ "codeRepository" => url,
15
15
  "title" => title,
16
16
  "agents" => creator,
17
17
  "description" => parse_attributes(description, content: "text", first: true),
18
- "version" => b_version,
18
+ "version" => version,
19
19
  "tags" => keywords.to_s.split(", ").presence,
20
20
  "datePublished" => date_published,
21
21
  "dateModified" => date_modified,
@@ -7,7 +7,7 @@ module Bolognese
7
7
  hsh = {
8
8
  "id" => identifier,
9
9
  "doi" => doi,
10
- "url" => b_url,
10
+ "url" => url,
11
11
  "type" => type,
12
12
  "additional_type" => additional_type,
13
13
  "citeproc_type" => citeproc_type,
@@ -27,8 +27,8 @@ module Bolognese
27
27
  "language" => language,
28
28
  "alternate_identifiers" => alternate_identifiers,
29
29
  "size" => size,
30
- "format" => b_format,
31
- "version" => b_version,
30
+ "formats" => formats,
31
+ "version" => version,
32
32
  "rights" => rights,
33
33
  "description" => description,
34
34
  "volume" => volume,
@@ -7,7 +7,7 @@ module Bolognese
7
7
  hsh = {
8
8
  "id" => identifier,
9
9
  "doi" => doi,
10
- "url" => b_url,
10
+ "url" => url,
11
11
  "creator" => creator,
12
12
  "title" => title,
13
13
  "publisher" => publisher,
@@ -24,8 +24,8 @@ module Bolognese
24
24
  "alternate-identifiers" => alternate_identifiers,
25
25
  "related-identifiers" => related_identifiers,
26
26
  "size" => size,
27
- "format" => b_format,
28
- "version" => b_version,
27
+ "formats" => formats,
28
+ "version" => version,
29
29
  "rights" => rights,
30
30
  "description" => description,
31
31
  "geo-location" => geo_location,
@@ -22,7 +22,7 @@ module Bolognese
22
22
  insert_issue(xml) if issue.present?
23
23
  insert_fpage(xml) if first_page.present?
24
24
  insert_lpage(xml) if last_page.present?
25
- insert_version(xml) if b_version.present?
25
+ insert_version(xml) if version.present?
26
26
  insert_pub_id(xml)
27
27
  end
28
28
 
@@ -112,7 +112,7 @@ module Bolognese
112
112
  end
113
113
 
114
114
  def insert_version(xml)
115
- xml.version(b_version)
115
+ xml.version(version)
116
116
  end
117
117
 
118
118
  def insert_pub_id(xml)
@@ -10,7 +10,7 @@ module Bolognese
10
10
  "T2" => periodical && periodical["title"],
11
11
  "AU" => to_ris(creator),
12
12
  "DO" => doi,
13
- "UR" => b_url,
13
+ "UR" => url,
14
14
  "AB" => parse_attributes(description, content: "text", first: true),
15
15
  "KW" => Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.presence,
16
16
  "PY" => publication_year,
@@ -8,18 +8,18 @@ module Bolognese
8
8
  "@type" => type,
9
9
  "@id" => identifier,
10
10
  "identifier" => to_schema_org_identifier(identifier, alternate_identifiers: alternate_identifiers),
11
- "url" => b_url,
11
+ "url" => url,
12
12
  "additionalType" => additional_type,
13
13
  "name" => parse_attributes(title, content: "text", first: true),
14
14
  "author" => to_schema_org(creator),
15
15
  "editor" => to_schema_org(editor),
16
16
  "description" => parse_attributes(description, content: "text", first: true),
17
17
  "license" => Array.wrap(rights).map { |l| l["id"] }.compact.unwrap,
18
- "version" => b_version,
18
+ "version" => version,
19
19
  "keywords" => keywords.present? ? Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.join(", ") : nil,
20
20
  "inLanguage" => language,
21
21
  "contentSize" => size,
22
- "encodingFormat" => b_format,
22
+ "encodingFormat" => formats,
23
23
  "dateCreated" => Array.wrap(dates).find { |d| d["type"] == "Created" }.to_h.fetch("__content__", nil),
24
24
  "datePublished" => date_published,
25
25
  "dateModified" => date_modified,
@@ -30,7 +30,7 @@ describe Bolognese::Metadata, vcr: true do
30
30
  expect(subject.valid?).to be true
31
31
  expect(subject.identifier).to eq("https://doi.org/10.7554/elife.01567")
32
32
  expect(subject.type).to eq("ScholarlyArticle")
33
- expect(subject.b_url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
33
+ expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
34
34
  expect(subject.resource_type_general).to eq("Text")
35
35
  expect(subject.creator.length).to eq(5)
36
36
  expect(subject.creator.first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
@@ -17,7 +17,7 @@ describe Bolognese::Metadata, vcr: true do
17
17
  it "BlogPosting" do
18
18
  expect(subject.valid?).to be true
19
19
  expect(subject.identifier).to eq("https://doi.org/10.5438/4k3m-nyvg")
20
- expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
20
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
21
21
  expect(subject.type).to eq("BlogPosting")
22
22
  expect(subject.resource_type_general).to eq("Text")
23
23
  expect(subject.creator).to eq("type"=>"Person", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
@@ -19,7 +19,7 @@ describe Bolognese::Metadata, vcr: true do
19
19
  it "maremma" do
20
20
  expect(subject.valid?).to be true
21
21
  expect(subject.identifier).to eq("https://doi.org/10.5438/qeg0-3gm3")
22
- expect(subject.b_url).to eq("https://github.com/datacite/maremma")
22
+ expect(subject.url).to eq("https://github.com/datacite/maremma")
23
23
  expect(subject.type).to eq("SoftwareSourceCode")
24
24
  expect(subject.creator).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
25
25
  expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
@@ -35,7 +35,7 @@ describe Bolognese::Metadata, vcr: true do
35
35
  input = fixture_path + 'codemeta.json'
36
36
  subject = Bolognese::Metadata.new(input: input)
37
37
  expect(subject.identifier).to eq("https://doi.org/10.5063/f1m61h5x")
38
- expect(subject.b_url).to eq("https://github.com/DataONEorg/rdataone")
38
+ expect(subject.url).to eq("https://github.com/DataONEorg/rdataone")
39
39
  expect(subject.type).to eq("SoftwareSourceCode")
40
40
  expect(subject.creator).to eq( [{"type"=>"Person",
41
41
  "id"=>"http://orcid.org/0000-0003-0077-4738",
@@ -51,7 +51,7 @@ describe Bolognese::Metadata, vcr: true do
51
51
  expect(subject.title).to eq("R Interface to the DataONE REST API")
52
52
  expect(subject.description["text"]).to start_with("Provides read and write access to data and metadata")
53
53
  expect(subject.keywords).to eq(["data sharing", "data repository", "DataONE"])
54
- expect(subject.b_version).to eq("2.0.0")
54
+ expect(subject.version).to eq("2.0.0")
55
55
  expect(subject.dates).to eq("2016-05-27")
56
56
  expect(subject.date_published).to eq("2016-05-27")
57
57
  expect(subject.date_modified).to eq("2016-05-27")
@@ -63,7 +63,7 @@ describe Bolognese::Metadata, vcr: true do
63
63
  subject = Bolognese::Metadata.new(input: input)
64
64
  expect(subject.valid?).to be true
65
65
  expect(subject.identifier).to eq("https://doi.org/10.5438/qeg0-3gm3")
66
- expect(subject.b_url).to eq("https://github.com/datacite/maremma")
66
+ expect(subject.url).to eq("https://github.com/datacite/maremma")
67
67
  expect(subject.type).to eq("SoftwareSourceCode")
68
68
  expect(subject.creator).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
69
69
  expect(subject.title).to eq("Maremma: a Ruby library for simplified network calls")
@@ -80,7 +80,7 @@ describe Bolognese::Metadata, vcr: true do
80
80
  subject = Bolognese::Metadata.new(input: input)
81
81
  expect(subject.valid?).to be true
82
82
  expect(subject.identifier).to eq("https://doi.org/10.5438/wr0x-e194")
83
- expect(subject.b_url).to eq("https://github.com/datacite/metadata-reports")
83
+ expect(subject.url).to eq("https://github.com/datacite/metadata-reports")
84
84
  expect(subject.type).to eq("SoftwareSourceCode")
85
85
  expect(subject.creator.size).to eq(4)
86
86
  expect(subject.creator.last).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0001-8135-3489", "name"=>"Lars Holm Nielsen", "givenName"=>"Lars Holm", "familyName"=>"Nielsen")
@@ -20,7 +20,7 @@ describe Bolognese::Metadata, vcr: true do
20
20
  expect(subject.valid?).to be true
21
21
  expect(subject.identifier).to eq("https://doi.org/10.7554/elife.01567")
22
22
  expect(subject.type).to eq("ScholarlyArticle")
23
- expect(subject.b_url).to eq("https://elifesciences.org/articles/01567")
23
+ expect(subject.url).to eq("https://elifesciences.org/articles/01567")
24
24
  expect(subject.additional_type).to eq("JournalArticle")
25
25
  expect(subject.bibtex_type).to eq("article")
26
26
  expect(subject.ris_type).to eq("JOUR")
@@ -55,7 +55,7 @@ describe Bolognese::Metadata, vcr: true do
55
55
  subject = Bolognese::Metadata.new(input: input)
56
56
  expect(subject.valid?).to be true
57
57
  expect(subject.identifier).to eq(input)
58
- expect(subject.b_url).to eq("http://dx.plos.org/10.1371/journal.pone.0000030")
58
+ expect(subject.url).to eq("http://dx.plos.org/10.1371/journal.pone.0000030")
59
59
  expect(subject.type).to eq("ScholarlyArticle")
60
60
  expect(subject.additional_type).to eq("JournalArticle")
61
61
  expect(subject.bibtex_type).to eq("article")
@@ -83,7 +83,7 @@ describe Bolognese::Metadata, vcr: true do
83
83
  subject = Bolognese::Metadata.new(input: input)
84
84
  expect(subject.valid?).to be true
85
85
  expect(subject.identifier).to eq(input)
86
- expect(subject.b_url).to eq("http://biorxiv.org/lookup/doi/10.1101/097196")
86
+ expect(subject.url).to eq("http://biorxiv.org/lookup/doi/10.1101/097196")
87
87
  expect(subject.type).to eq("ScholarlyArticle")
88
88
  expect(subject.additional_type).to eq("PostedContent")
89
89
  expect(subject.bibtex_type).to eq("article")
@@ -106,7 +106,7 @@ describe Bolognese::Metadata, vcr: true do
106
106
  subject = Bolognese::Metadata.new(input: input)
107
107
  expect(subject.valid?).to be true
108
108
  expect(subject.identifier).to eq("https://doi.org/10.1890/0012-9658(2006)87%5B2832:tiopma%5D2.0.co;2")
109
- expect(subject.b_url).to eq("http://doi.wiley.com/10.1890/0012-9658(2006)87[2832:TIOPMA]2.0.CO;2")
109
+ expect(subject.url).to eq("http://doi.wiley.com/10.1890/0012-9658(2006)87[2832:TIOPMA]2.0.CO;2")
110
110
  expect(subject.type).to eq("ScholarlyArticle")
111
111
  expect(subject.additional_type).to eq("JournalArticle")
112
112
  expect(subject.resource_type_general).to eq("Text")
@@ -129,7 +129,7 @@ describe Bolognese::Metadata, vcr: true do
129
129
  subject = Bolognese::Metadata.new(input: input)
130
130
  expect(subject.valid?).to be true
131
131
  expect(subject.identifier).to eq("https://doi.org/10.1155/2012/291294")
132
- expect(subject.b_url).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
132
+ expect(subject.url).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
133
133
  expect(subject.type).to eq("ScholarlyArticle")
134
134
  expect(subject.additional_type).to eq("JournalArticle")
135
135
  expect(subject.resource_type_general).to eq("Text")
@@ -153,7 +153,7 @@ describe Bolognese::Metadata, vcr: true do
153
153
  subject = Bolognese::Metadata.new(input: input)
154
154
  expect(subject.valid?).to be true
155
155
  expect(subject.identifier).to eq(input)
156
- expect(subject.b_url).to eq("http://linkinghub.elsevier.com/retrieve/pii/S0014299915002332")
156
+ expect(subject.url).to eq("http://linkinghub.elsevier.com/retrieve/pii/S0014299915002332")
157
157
  expect(subject.type).to eq("ScholarlyArticle")
158
158
  expect(subject.additional_type).to eq("JournalArticle")
159
159
  expect(subject.resource_type_general).to eq("Text")
@@ -172,7 +172,7 @@ describe Bolognese::Metadata, vcr: true do
172
172
  subject = Bolognese::Metadata.new(input: input)
173
173
  expect(subject.valid?).to be true
174
174
  expect(subject.identifier).to eq("https://doi.org/10.2210/pdb4hhb/pdb")
175
- expect(subject.b_url).to eq("ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/hh/pdb4hhb.ent.gz")
175
+ expect(subject.url).to eq("ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/hh/pdb4hhb.ent.gz")
176
176
  expect(subject.type).to eq("ScholarlyArticle")
177
177
  expect(subject.additional_type).to eq("SaComponent")
178
178
  expect(subject.resource_type_general).to eq("Text")
@@ -195,7 +195,7 @@ describe Bolognese::Metadata, vcr: true do
195
195
  subject = Bolognese::Metadata.new(input: input)
196
196
  expect(subject.valid?).to be true
197
197
  expect(subject.identifier).to eq("https://doi.org/10.1007/978-3-662-46370-3_13")
198
- expect(subject.b_url).to eq("http://link.springer.com/10.1007/978-3-662-46370-3_13")
198
+ expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-662-46370-3_13")
199
199
  expect(subject.type).to eq("Chapter")
200
200
  expect(subject.additional_type).to eq("BookChapter")
201
201
  expect(subject.resource_type_general).to eq("Text")
@@ -216,7 +216,7 @@ describe Bolognese::Metadata, vcr: true do
216
216
  subject = Bolognese::Metadata.new(input: input)
217
217
  expect(subject.valid?).to be true
218
218
  expect(subject.identifier).to eq(input)
219
- expect(subject.b_url).to eq("http://doi.wiley.com/10.1111/nph.14619")
219
+ expect(subject.url).to eq("http://doi.wiley.com/10.1111/nph.14619")
220
220
  expect(subject.type).to eq("ScholarlyArticle")
221
221
  expect(subject.additional_type).to eq("JournalArticle")
222
222
  expect(subject.resource_type_general).to eq("Text")
@@ -19,7 +19,7 @@ describe Bolognese::Metadata, vcr: true do
19
19
  it "Dataset" do
20
20
  expect(subject.valid?).to be true
21
21
  expect(subject.identifier).to eq("https://doi.org/10.5061/dryad.8515")
22
- expect(subject.b_url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
22
+ expect(subject.url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
23
23
  expect(subject.type).to eq("Dataset")
24
24
  expect(subject.additional_type).to eq("DataPackage")
25
25
  expect(subject.resource_type_general).to eq("Dataset")
@@ -441,7 +441,7 @@ describe Bolognese::Metadata, vcr: true do
441
441
  expect(subject.alternate_identifiers).to eq("type"=>"ISBN", "name"=>"937-0-4523-12357-6")
442
442
  expect(subject.date_published).to eq("2010")
443
443
  expect(subject.size).to eq("256 pages")
444
- expect(subject.b_format).to eq("pdf")
444
+ expect(subject.formats).to eq("pdf")
445
445
  expect(subject.content_url).to eq("https://example.org/report.pdf")
446
446
  expect(subject.publication_year).to eq(2010)
447
447
  expect(subject.related_identifiers.length).to eq(1)
@@ -568,7 +568,7 @@ describe Bolognese::Metadata, vcr: true do
568
568
  "givenName"=>"Henk",
569
569
  "familyName"=>"Eskes"}])
570
570
  expect(subject.title).to eq("Multi-Sensor Reanalysis (MSR) of total ozone, version 2")
571
- expect(subject.b_version).to eq("2")
571
+ expect(subject.version).to eq("2")
572
572
  expect(subject.date_published).to eq("2015")
573
573
  expect(subject.publisher).to eq("Royal Netherlands Meteorological Institute (KNMI)")
574
574
  expect(subject.service_provider).to eq("DataCite")
@@ -682,7 +682,7 @@ describe Bolognese::Metadata, vcr: true do
682
682
  expect(subject.valid?).to be true
683
683
  expect(subject.identifier).to eq("https://doi.org/10.5061/dryad.8515")
684
684
  expect(subject.doi).to eq("10.5061/dryad.8515")
685
- expect(subject.b_url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
685
+ expect(subject.url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
686
686
  expect(subject.type).to eq("Dataset")
687
687
  expect(subject.title).to eq("A new malaria agent in African hominids.")
688
688
  end
@@ -692,7 +692,7 @@ describe Bolognese::Metadata, vcr: true do
692
692
  expect(subject.valid?).to be true
693
693
  expect(subject.identifier).to eq("https://doi.org/10.5061/dryad.8515")
694
694
  expect(subject.doi).to eq("10.5061/dryad.8515")
695
- expect(subject.b_url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
695
+ expect(subject.url).to eq("http://datadryad.org/resource/doi:10.5061/dryad.8515")
696
696
  expect(subject.type).to eq("Dataset")
697
697
  expect(subject.title).to eq("Data from: A new malaria agent in African hominids.")
698
698
  expect(subject.state).to eq("registered")
@@ -716,13 +716,13 @@ describe Bolognese::Metadata, vcr: true do
716
716
 
717
717
  it "GTEx dataset" do
718
718
  input = fixture_path + 'gtex.xml'
719
- b_url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93"
719
+ url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93"
720
720
  content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"
721
- subject = Bolognese::Metadata.new(input: input, from: 'datacite', b_url: b_url, content_url: content_url)
721
+ subject = Bolognese::Metadata.new(input: input, from: 'datacite', url: url, content_url: content_url)
722
722
 
723
723
  expect(subject.valid?).to be true
724
724
  expect(subject.identifier).to eq("https://doi.org/10.25491/9hx8-ke93")
725
- expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.25491/9hx8-ke93")
725
+ expect(subject.url).to eq("https://ors.datacite.org/doi:/10.25491/9hx8-ke93")
726
726
  expect(subject.content_url).to eq("https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz")
727
727
  expect(subject.type).to eq("Dataset")
728
728
  expect(subject.additional_type).to eq("DroNc-seq data")
@@ -732,7 +732,7 @@ describe Bolognese::Metadata, vcr: true do
732
732
  expect(subject.date_published).to eq("2017")
733
733
  expect(subject.related_identifiers.length).to eq(4)
734
734
  expect(subject.related_identifiers.last).to eq("id"=>"https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663", "related_identifier_type"=>"URL", "relation_type"=>"IsPartOf")
735
- expect(subject.b_format).to eq("application/tar")
735
+ expect(subject.formats).to eq("application/tar")
736
736
  expect(subject.size).to eq("15.7M")
737
737
  expect(subject.periodical).to eq("id"=>"https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663", "title"=>"GTEx", "type"=>"DataCatalog")
738
738
  expect(subject.publisher).to eq("GTEx")
@@ -30,7 +30,7 @@ describe Bolognese::Metadata, vcr: true do
30
30
  expect(subject.valid?).to be true
31
31
  expect(subject.identifier).to eq("https://doi.org/10.7554/elife.01567")
32
32
  expect(subject.type).to eq("ScholarlyArticle")
33
- expect(subject.b_url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
33
+ expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
34
34
  expect(subject.resource_type_general).to eq("Text")
35
35
  expect(subject.creator.length).to eq(5)
36
36
  expect(subject.creator.first).to eq("type"=>"Person",
@@ -20,7 +20,7 @@ describe Bolognese::Metadata, vcr: true do
20
20
  it "BlogPosting" do
21
21
  expect(subject.valid?).to be true
22
22
  expect(subject.identifier).to eq("https://doi.org/10.5438/4k3m-nyvg")
23
- expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
23
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
24
24
  expect(subject.type).to eq("BlogPosting")
25
25
  expect(subject.creator).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
26
26
  expect(subject.title).to eq("Eating your own Dog Food")
@@ -38,7 +38,7 @@ describe Bolognese::Metadata, vcr: true do
38
38
  expect(subject.valid?).to be true
39
39
  expect(subject.identifier).to eq("https://doi.org/10.5438/0000-00ss")
40
40
  expect(subject.doi).to eq("10.5438/0000-00ss")
41
- expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
41
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
42
42
  expect(subject.type).to eq("BlogPosting")
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ describe Bolognese::Metadata, vcr: true do
49
49
  expect(subject.errors.first).to eq("43:0: ERROR: Element '{http://datacite.org/schema/kernel-4}publisher': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.")
50
50
  expect(subject.identifier).to eq("https://doi.org/10.5281/zenodo.1196821")
51
51
  expect(subject.doi).to eq("10.5281/zenodo.1196821")
52
- expect(subject.b_url).to eq("https://zenodo.org/record/1196821")
52
+ expect(subject.url).to eq("https://zenodo.org/record/1196821")
53
53
  expect(subject.type).to eq("Dataset")
54
54
  expect(subject.title).to eq("PsPM-SC4B: SCR, ECG, EMG, PSR and respiration measurements in a delay fear conditioning task with auditory CS and electrical US")
55
55
  expect(subject.creator.size).to eq(6)
@@ -62,7 +62,7 @@ describe Bolognese::Metadata, vcr: true do
62
62
  expect(subject.valid?).to be true
63
63
  expect(subject.identifier).to eq("https://doi.org/10.1594/pangaea.836178")
64
64
  expect(subject.doi).to eq("10.1594/pangaea.836178")
65
- expect(subject.b_url).to eq("https://doi.pangaea.de/10.1594/PANGAEA.836178")
65
+ expect(subject.url).to eq("https://doi.pangaea.de/10.1594/PANGAEA.836178")
66
66
  expect(subject.type).to eq("Dataset")
67
67
  expect(subject.title).to eq("Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland")
68
68
  expect(subject.creator.size).to eq(8)
@@ -77,7 +77,7 @@ describe Bolognese::Metadata, vcr: true do
77
77
  # #expect(subject.errors).to be true
78
78
  # expect(subject.identifier).to eq("https://doi.org/10.3334/ornldaac/1418")
79
79
  # expect(subject.doi).to eq("10.3334/ornldaac/1418")
80
- # expect(subject.b_url).to eq("https://doi.org/10.3334/ornldaac/1418")
80
+ # expect(subject.url).to eq("https://doi.org/10.3334/ornldaac/1418")
81
81
  # expect(subject.type).to eq("DataSet")
82
82
  # expect(subject.title).to eq("AirMOSS: L2/3 Volumetric Soil Moisture Profiles Derived From Radar, 2012-2015")
83
83
  # expect(subject.creator.size).to eq(8)
@@ -116,7 +116,7 @@ describe Bolognese::Metadata, vcr: true do
116
116
  subject = Bolognese::Metadata.new(input: input)
117
117
  expect(subject.valid?).to be true
118
118
  expect(subject.identifier).to eq("https://doi.org/10.5438/4k3m-nyvg")
119
- expect(subject.b_url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
119
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
120
120
  expect(subject.type).to eq("BlogPosting")
121
121
  expect(subject.creator).to eq("type"=>"Person", "id"=>"http://orcid.org/0000-0003-1419-2405", "name"=>"Martin Fenner", "givenName"=>"Martin", "familyName"=>"Fenner")
122
122
  expect(subject.title).to eq("Eating your own Dog Food")
@@ -136,13 +136,13 @@ describe Bolognese::Metadata, vcr: true do
136
136
  expect(subject.valid?).to be true
137
137
  expect(subject.identifier).to eq("https://doi.org/10.25491/d50j-3083")
138
138
  expect(subject.alternate_identifiers).to eq("name"=>"687610993", "type"=>"md5")
139
- expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.25491/d50j-3083")
139
+ expect(subject.url).to eq("https://ors.datacite.org/doi:/10.25491/d50j-3083")
140
140
  expect(subject.content_url).to eq("https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz")
141
141
  expect(subject.type).to eq("Dataset")
142
142
  expect(subject.additional_type).to eq("Gene expression matrices")
143
143
  expect(subject.creator).to eq("name"=>"The GTEx Consortium", "type"=>"Organization")
144
144
  expect(subject.title).to eq("Fully processed, filtered and normalized gene expression matrices (in BED format) for each tissue, which were used as input into FastQTL for eQTL discovery")
145
- expect(subject.b_version).to eq("v7")
145
+ expect(subject.version).to eq("v7")
146
146
  expect(subject.keywords).to eq(["gtex", "annotation", "phenotype", "gene regulation", "transcriptomics"])
147
147
  expect(subject.date_published).to eq("2017")
148
148
  expect(subject.periodical).to eq("title"=>"GTEx", "type"=>"DataCatalog")
@@ -158,7 +158,7 @@ describe Bolognese::Metadata, vcr: true do
158
158
  expect(subject.valid?).to be true
159
159
  expect(subject.identifier).to eq("https://doi.org/10.23725/8na3-9s47")
160
160
  expect(subject.alternate_identifiers).to eq([{"name"=>"3b33f6b9338fccab0901b7d317577ea3", "type"=>"md5"}, {"name"=>"ark:/99999/fk41CrU4eszeLUDe", "type"=>"minid"}, {"name"=>"dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7", "type"=>"dataguid"}])
161
- expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.23725/8na3-9s47")
161
+ expect(subject.url).to eq("https://ors.datacite.org/doi:/10.23725/8na3-9s47")
162
162
  expect(subject.content_url).to eq(["s3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram", "gs://topmed-irc-share/public/NWD165827.recab.cram"])
163
163
  expect(subject.type).to eq("Dataset")
164
164
  expect(subject.additional_type).to eq("CRAM file")
@@ -211,7 +211,7 @@ describe Bolognese::Metadata, vcr: true do
211
211
  expect(subject.valid?).to be true
212
212
  expect(subject.identifier).to eq("https://doi.org/10.23725/7jg3-v803")
213
213
  expect(subject.alternate_identifiers).to eq([{"name"=>"ark:/99999/fk4E1n6n1YHKxPk", "type"=>"minid"}, {"name"=>"dg.4503/01b048d0-e128-4cb0-94e9-b2d2cab7563d", "type"=>"dataguid"}, {"name"=>"f9e72bdf25bf4b4f0e581d9218fec2eb", "type"=>"md5"}])
214
- expect(subject.b_url).to eq("https://ors.datacite.org/doi:/10.23725/7jg3-v803")
214
+ expect(subject.url).to eq("https://ors.datacite.org/doi:/10.23725/7jg3-v803")
215
215
  expect(subject.content_url).to eq(["s3://cgp-commons-public/topmed_open_access/44a8837b-4456-5709-b56b-54e23000f13a/NWD100953.recab.cram","gs://topmed-irc-share/public/NWD100953.recab.cram","dos://dos.commons.ucsc-cgp.org/01b048d0-e128-4cb0-94e9-b2d2cab7563d?version=2018-05-26T133719.491772Z"])
216
216
  expect(subject.type).to eq("Dataset")
217
217
  expect(subject.additional_type).to eq("CRAM file")
@@ -119,9 +119,9 @@ describe Bolognese::Metadata, vcr: true do
119
119
 
120
120
  it "author is organization" do
121
121
  input = fixture_path + 'gtex.xml'
122
- b_url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93"
122
+ url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93"
123
123
  content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz"
124
- subject = Bolognese::Metadata.new(input: input, b_url: b_url, content_url: content_url, from: "datacite")
124
+ subject = Bolognese::Metadata.new(input: input, url: url, content_url: content_url, from: "datacite")
125
125
  json = JSON.parse(subject.schema_org)
126
126
  expect(json["@id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
127
127
  expect(json["author"]).to eq("@type"=>"Organization", "name"=>"The GTEx Consortium")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner