bolognese 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +85 -24
  4. data/bin/bolognese +5 -1
  5. data/lib/bolognese/bibtex.rb +5 -1
  6. data/lib/bolognese/cli.rb +22 -23
  7. data/lib/bolognese/metadata.rb +3 -21
  8. data/lib/bolognese/utils.rb +38 -21
  9. data/lib/bolognese/version.rb +1 -1
  10. data/spec/bibtex_spec.rb +3 -0
  11. data/spec/cli_spec.rb +94 -43
  12. data/spec/fixtures/crossref.bib +3 -1
  13. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/crossref/as_bibtex.yml +7 -7
  14. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/crossref/as_crossref.yml +7 -7
  15. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/crossref/as_datacite.yml +7 -723
  16. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/crossref/as_schema_org.yml +7 -723
  17. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/crossref/default.yml +7 -7
  18. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml +760 -0
  19. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_crossref.yml +760 -0
  20. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_datacite.yml +760 -0
  21. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_schema_org.yml +760 -0
  22. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/datacite/as_bibtex.yml +9 -9
  23. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/datacite/as_datacite.yml +9 -9
  24. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/datacite/as_schema_org.yml +9 -179
  25. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/datacite/default.yml +9 -9
  26. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_bibtex.yml +214 -0
  27. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_datacite.yml +214 -0
  28. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/datacite/to_schema_org.yml +214 -0
  29. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/schema_org/as_bibtex.yml +10 -10
  30. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/schema_org/as_datacite.yml +10 -10
  31. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/schema_org/as_schema_org.yml +10 -10
  32. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/{read → convert_from_id}/schema_org/default.yml +10 -10
  33. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_bibtex.yml +653 -0
  34. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_datacite.yml +653 -0
  35. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/schema_org/to_schema_org.yml +653 -0
  36. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider_by_ID/crossref.yml +44 -0
  37. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider_by_ID/crossref_doi_not_url.yml +44 -0
  38. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider_by_ID/datacite.yml +44 -0
  39. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider_by_ID/datacite_doi_http.yml +44 -0
  40. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref.yml +44 -0
  41. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml +44 -0
  42. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml +44 -0
  43. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml +44 -0
  44. data/spec/metadata_spec.rb +27 -7
  45. metadata +32 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c34a24e63743974fc6a09dca95d8dbdef85f592
4
- data.tar.gz: a12199e846b5c1598e181126d6c20f9c40341a79
3
+ metadata.gz: 019af5df5c06f424579440313912c3841dd717ae
4
+ data.tar.gz: 9cd1726770f9685335c7bc5afb7b053e618a1c4e
5
5
  SHA512:
6
- metadata.gz: b4fab385944d35dd6da5b1c39732e3196f88dc1c673e83ecc0c815256f66c2a8dd902fe6ea7eb9e8ff5f9dc0105a1cca3f17a68524a98b16e94ffbc99696202b
7
- data.tar.gz: 75783a83adabd791461eefb29b5810f636b848c1578daeecff977a650820339ef3bb62cb718e1f9201e7c1d619ccbe5d18f8414a65e5f6897c88ababd737d118
6
+ metadata.gz: 35f06b9c7e9e3960a54614fdc9c16da563da9cf9496b95279c5cb4258cc042d8fcd67214147f857f242e967be4eff83cb57e0143edbf2931e22e33572779ed20
7
+ data.tar.gz: 429b51e24ff0db4669d6f0d2a6e6c7aee00e7a7d35ba6e2b09f784b1da63533c1bcf83f4bd8907c03802073c53391d3cf71fd547abb201ee95d69775bd13a0ff
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.6.2)
4
+ bolognese (0.6.3)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  bibtex-ruby (~> 4.1)
7
7
  builder (~> 3.2, >= 3.2.2)
data/README.md CHANGED
@@ -4,24 +4,58 @@
4
4
 
5
5
  # Bolognese
6
6
 
7
- Ruby gem and command-line utility for conversion of DOI metadata from and to [schema.org](https://schema.org) in JSON-LD.
7
+ Ruby gem and command-line utility for conversion of DOI metadata from and to different metadata formats, including [schema.org](https://schema.org).
8
8
 
9
9
  ## Features
10
10
 
11
- * convert [Crossref XML](https://support.crossref.org/hc/en-us/articles/214936283-UNIXREF-query-output-format) to schema.org/JSON-LD
12
- * convert [DataCite XML](http://schema.datacite.org/) to schema.org/JSON-LD
13
- * fetch schema.org/JSON-LD from a URL
14
- * convert schema.org/JSON-LD to [DataCite XML](http://schema.datacite.org/)
15
- * convert Crossref XML to [DataCite XML](http://schema.datacite.org/)
16
- * convert Crossref XML, DataCite XML or schema.org/JSON-LD to BibTeX
17
- * convert BibTeX to DataCite XML or schema.org/JSON-LD
18
-
19
- Conversion to Crossref XML is not yet supported.
11
+ Bolognese reads and writes these metadata formats.
12
+
13
+ <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides" class="table table-bordered table-striped">
14
+ <thead>
15
+ <tr>
16
+ <th>Format</th>
17
+ <th>Name</th>
18
+ <th>Content Type</th>
19
+ <th>Read</th>
20
+ <th>Write</th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <tr>
25
+ <td><a href='https://www.crossref.org/schema/documentation/unixref1.1/unixref1.1.html'>CrossRef Unixref XML</a></td>
26
+ <td>crossref</td>
27
+ <td>application/vnd.crossref.unixref+xml</td>
28
+ <td>Yes</td>
29
+ <td>No</td>
30
+ </tr>
31
+ <tr>
32
+ <td><a href='https://schema.datacite.org/'>DataCite XML</a></td>
33
+ <td>datacite</td>
34
+ <td>application/vnd.datacite.datacite+xml</td>
35
+ <td>Yes</td>
36
+ <td>Yes</td>
37
+ </tr>
38
+ <tr>
39
+ <td><a href='http://schema.org/'>Schema.org in JSON-LD</a></td>
40
+ <td>schema_org</td>
41
+ <td>application/vnd.schemaorg.ld+json</td>
42
+ <td>Yes</td>
43
+ <td>Yes</td>
44
+ </tr>
45
+ <tr>
46
+ <td><a href='http://en.wikipedia.org/wiki/BibTeX'>BibTeX</a></td>
47
+ <td>bibtex</td>
48
+ <td>application/x-bibtex</td>
49
+ <td>Yes</td>
50
+ <td>Yes</td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
20
54
 
21
55
  ## Installation
22
56
 
23
- The usual way with Bundler: add the following to your `Gemfile` to install the
24
- current version of the gem:
57
+ Requires Ruby 2.2 or later. Then add the following to your `Gemfile` to install the
58
+ latest version:
25
59
 
26
60
  ```ruby
27
61
  gem 'bolognese'
@@ -37,14 +71,41 @@ gem install bolognese
37
71
 
38
72
  ## Commands
39
73
 
40
- The `bolognese` commands understand URLs and DOIs as arguments. The `--as` command
41
- line flag sets the format, either `crossref`, `datacite`, or `schema_org` (default).
74
+ Run the `bolognese` command with either an identifier (DOI or URL) or filename:
75
+
76
+ ```
77
+ bolognese https://doi.org/10.7554/elife.01567
78
+ ```
79
+
80
+ ```
81
+ bolognese example.xml
82
+ ```
83
+
84
+ Bolognese can read BibTeX files (file extension `.bib`) and Crossref or DataCite
85
+ XML files (file extension `.xml`).
86
+
87
+ The input format (e.g. Crossref XML or BibteX) is automatically detected, but
88
+ you can also provide the format with the `--from` or `-f` flag. The supported
89
+ input formats are listed in the table above.
90
+
91
+ The output format is determined by the `--to` or `-t` flag, and defaults to `schema_org`.
92
+
93
+ Show all commands with `bolognese help`:
94
+
95
+ ```
96
+ Commands:
97
+ bolognese --version, -v # print the version
98
+ bolognese help [COMMAND] # Describe available commands or one specific command
99
+ bolognese open file # read metadata from file
100
+ bolognese read id # read metadata for ID
101
+ ```
42
102
 
43
103
  ## Examples
44
104
 
45
105
  Read Crossref XML:
106
+
46
107
  ```
47
- bolognese read https://doi.org/10.7554/elife.01567 --as crossref
108
+ bolognese https://doi.org/10.7554/elife.01567 -t crossref
48
109
 
49
110
  <?xml version="1.0" encoding="UTF-8"?>
50
111
  <doi_records>
@@ -167,7 +228,7 @@ bolognese read https://doi.org/10.7554/elife.01567 --as crossref
167
228
 
168
229
  Convert Crossref XML to schema.org/JSON-LD:
169
230
  ```
170
- bolognese read https://doi.org/10.7554/elife.01567
231
+ bolognese https://doi.org/10.7554/elife.01567
171
232
 
172
233
  {
173
234
  "@context": "http://schema.org",
@@ -364,7 +425,7 @@ bolognese read https://doi.org/10.7554/elife.01567
364
425
 
365
426
  Convert Crossref XML to DataCite XML:
366
427
  ```
367
- bolognese read https://doi.org/10.7554/elife.01567 --as datacite
428
+ bolognese https://doi.org/10.7554/elife.01567 -t datacite
368
429
 
369
430
  <?xml version="1.0" encoding="UTF-8"?>
370
431
  <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">
@@ -458,7 +519,7 @@ bolognese read https://doi.org/10.7554/elife.01567 --as datacite
458
519
  Convert Crossref XML to BibTeX:
459
520
 
460
521
  ```
461
- bolognese read https://doi.org/10.7554/elife.01567 --as bibtex
522
+ bolognese https://doi.org/10.7554/elife.01567 -t bibtex
462
523
 
463
524
  @article{https://doi.org/10.7554/elife.01567,
464
525
  doi = {10.7554/eLife.01567},
@@ -472,7 +533,7 @@ bolognese read https://doi.org/10.7554/elife.01567 --as bibtex
472
533
 
473
534
  Read DataCite XML:
474
535
  ```
475
- bolognese read 10.5061/DRYAD.8515 --as datacite
536
+ bolognese 10.5061/DRYAD.8515 -t datacite
476
537
 
477
538
  <?xml version="1.0" encoding="UTF-8"?>
478
539
  <resource
@@ -543,7 +604,7 @@ bolognese read 10.5061/DRYAD.8515 --as datacite
543
604
 
544
605
  Convert DataCite XML to schema.org/JSON-LD:
545
606
  ```sh
546
- bolognese read 10.5061/DRYAD.8515
607
+ bolognese 10.5061/DRYAD.8515
547
608
 
548
609
  {
549
610
  "@context": "http://schema.org",
@@ -614,7 +675,7 @@ bolognese read 10.5061/DRYAD.8515
614
675
 
615
676
  Convert DataCite XML to schema version 4.0:
616
677
  ```
617
- bolognese read 10.5061/DRYAD.8515 --as datacite --schema_version http://datacite.org/schema/kernel-4
678
+ bolognese 10.5061/DRYAD.8515 -t datacite --schema_version http://datacite.org/schema/kernel-4
618
679
 
619
680
  <?xml version="1.0" encoding="UTF-8"?>
620
681
  <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">
@@ -697,7 +758,7 @@ bolognese read 10.5061/DRYAD.8515 --as datacite --schema_version http://datacite
697
758
  Convert DataCite XML to BibTeX:
698
759
 
699
760
  ```
700
- bolognese read 10.5061/DRYAD.8515 --as bibtex
761
+ bolognese 10.5061/DRYAD.8515 -t bibtex
701
762
 
702
763
  @misc{https://doi.org/10.5061/dryad.8515,
703
764
  doi = {10.5061/DRYAD.8515},
@@ -712,7 +773,7 @@ bolognese read 10.5061/DRYAD.8515 --as bibtex
712
773
  Convert schema.org/JSON-LD to DataCite XML:
713
774
 
714
775
  ```
715
- bolognese read https://blog.datacite.org/eating-your-own-dog-food --as datacite
776
+ bolognese https://blog.datacite.org/eating-your-own-dog-food -t datacite
716
777
 
717
778
  <?xml version="1.0" encoding="UTF-8"?>
718
779
  <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">
@@ -763,7 +824,7 @@ bolognese read https://blog.datacite.org/eating-your-own-dog-food --as datacite
763
824
  Convert schema.org/JSON-LD to BibTeX:
764
825
 
765
826
  ```
766
- bolognese read https://blog.datacite.org/eating-your-own-dog-food --as bibtex
827
+ bolognese https://blog.datacite.org/eating-your-own-dog-food -t bibtex
767
828
 
768
829
  @article{https://doi.org/10.5438/4k3m-nyvg,
769
830
  doi = {10.5438/4k3m-nyvg},
@@ -2,4 +2,8 @@
2
2
 
3
3
  require File.expand_path("../../lib/bolognese", __FILE__)
4
4
 
5
- Bolognese::CLI.start
5
+ if (ARGV & %w(--version -v help --help)).empty?
6
+ Bolognese::CLI.start(ARGV.dup.unshift("convert"))
7
+ else
8
+ Bolognese::CLI.start
9
+ end
@@ -95,7 +95,11 @@ module Bolognese
95
95
  end
96
96
 
97
97
  def description
98
- metadata.note.to_s.presence
98
+ metadata.field?(:abstract) && metadata.abstract.to_s.presence
99
+ end
100
+
101
+ def license
102
+ metadata.field?(:copyright) && metadata.copyright.to_s.presence
99
103
  end
100
104
  end
101
105
  end
@@ -10,10 +10,8 @@ module Bolognese
10
10
  include Bolognese::DoiUtils
11
11
  include Bolognese::Utils
12
12
 
13
- default_task :open
14
-
15
13
  def self.exit_on_failure?
16
- true
14
+ false
17
15
  end
18
16
 
19
17
  # from http://stackoverflow.com/questions/22809972/adding-a-version-option-to-a-ruby-thor-cli
@@ -24,30 +22,31 @@ module Bolognese
24
22
  puts Bolognese::VERSION
25
23
  end
26
24
 
27
- desc "read id", "read metadata for ID"
28
- method_option :as, default: "schema_org"
29
- method_option :schema_version
30
- def read(id)
31
- id = normalize_id(id)
32
- provider = find_provider(id)
33
-
34
- set_metadata(id: id, provider: provider, as: options[:as], schema_version: options[:schema_version])
35
- end
36
-
37
- desc "open file", "read metadata from file"
38
- method_option :as, default: "schema_org"
25
+ desc "", "convert metadata"
26
+ method_option :from, aliases: "-f"
27
+ method_option :to, aliases: "-t", default: "schema_org"
39
28
  method_option :schema_version
40
- def open(file)
41
- ext = File.extname(file)
42
- unless %w(.bib).include? ext
43
- $stderr.puts "File type #{ext} not supported"
44
- exit 1
29
+ def convert(input)
30
+ id = normalize_id(input)
31
+
32
+ if id.present?
33
+ from = options[:from] || find_from_format(id: id)
34
+ else
35
+ ext = File.extname(input)
36
+ if %w(.bib .xml).include? ext
37
+ string = IO.read(input)
38
+ else
39
+ $stderr.puts "File type #{ext} not supported"
40
+ exit 1
41
+ end
42
+ from = options[:from] || find_from_format(string: string, ext: ext)
45
43
  end
46
44
 
47
- string = IO.read(file)
48
- provider = "bibtex"
45
+ to = options[:to] || "schema_org"
49
46
 
50
- set_metadata(string: string, provider: provider, as: options[:as], schema_version: options[:schema_version])
47
+ write(id: id, string: string, from: from, to: to, schema_version: options[:schema_version])
51
48
  end
49
+
50
+ default_task :convert
52
51
  end
53
52
  end
@@ -15,7 +15,8 @@ module Bolognese
15
15
  attr_reader :id, :raw, :provider, :schema_version, :license, :citation,
16
16
  :additional_type, :alternate_name, :url, :version, :keywords, :editor,
17
17
  :page_start, :page_end, :date_modified, :language, :spatial_coverage,
18
- :content_size, :funder, :journal, :bibtex_type
18
+ :content_size, :funder, :journal, :bibtex_type, :date_created, :has_part,
19
+ :publisher, :contributor, :schema_version
19
20
 
20
21
  alias_method :datacite, :as_datacite
21
22
 
@@ -23,30 +24,10 @@ module Bolognese
23
24
  date_published && date_published[0..3]
24
25
  end
25
26
 
26
- def date_created
27
-
28
- end
29
-
30
27
  def pagination
31
28
  [page_start, page_end].compact.join("-").presence
32
29
  end
33
30
 
34
- def has_part
35
-
36
- end
37
-
38
- def publisher
39
-
40
- end
41
-
42
- def contributor
43
-
44
- end
45
-
46
- def schema_version
47
-
48
- end
49
-
50
31
  def author_string
51
32
  author.map { |a| [a["familyName"], a["givenName"]].join(", ") }
52
33
  .join(" and ").presence
@@ -96,6 +77,7 @@ module Bolognese
96
77
  url: url,
97
78
  author: author_string,
98
79
  keywords: keywords,
80
+ language: language,
99
81
  title: name,
100
82
  journal: journal,
101
83
  pages: pagination,
@@ -1,22 +1,51 @@
1
1
  module Bolognese
2
2
  module Utils
3
- def set_metadata(id: nil, string: nil, provider: nil, **options)
4
- output = options[:as] || "schema_org"
5
3
 
6
- if provider.present?
7
- p = case provider
8
- when "crossref" then Crossref.new(id: id)
9
- when "datacite" then Datacite.new(id: id, schema_version: options[:schema_version])
4
+ def find_from_format(id: nil, string: nil, ext: nil)
5
+ if id.present?
6
+ find_from_format_by_id(id)
7
+ elsif string.present?
8
+ find_from_format_by_string(string, ext: ext)
9
+ end
10
+ end
11
+
12
+ def find_from_format_by_id(id)
13
+ id = normalize_id(id)
14
+
15
+ if /\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id)
16
+ get_doi_ra(id).fetch("id", nil)
17
+ elsif /\A(?:(http|https):\/\/orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id)
18
+ "orcid"
19
+ else
20
+ "schema_org"
21
+ end
22
+ end
23
+
24
+ def find_from_format_by_string(string, options={})
25
+ if options[:ext] == ".bib"
26
+ "bibtex"
27
+ elsif Maremma.from_xml(string).dig("doi_records", "doi_record", "crossref")
28
+ "crossref"
29
+ elsif Maremma.from_xml(string).dig("resource", "xmlns") == "http://datacite.org/schema/kernel-4"
30
+ "datacite"
31
+ end
32
+ end
33
+
34
+ def write(id: nil, string: nil, from: nil, to: nil, **options)
35
+ if from.present?
36
+ p = case from
37
+ when "crossref" then Crossref.new(id: id, string: string)
38
+ when "datacite" then Datacite.new(id: id, string: string, schema_version: options[:schema_version])
10
39
  when "bibtex" then Bibtex.new(string: string)
11
40
  else SchemaOrg.new(id: id)
12
41
  end
13
42
 
14
- puts p.send(output)
43
+ puts p.send(to)
15
44
  else
16
45
  puts "not implemented"
17
46
  end
18
47
  end
19
-
48
+
20
49
  def orcid_from_url(url)
21
50
  Array(/\Ahttp:\/\/orcid\.org\/(.+)/.match(url)).last
22
51
  end
@@ -61,22 +90,10 @@ module Bolognese
61
90
  end
62
91
  end
63
92
 
64
- def find_provider(id)
65
- id = normalize_id(id)
66
-
67
- if /\A(?:(http|https):\/\/(dx\.)?doi.org\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match(id)
68
- get_doi_ra(id).fetch("id", nil)
69
- elsif /\A(?:(http|https):\/\/orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(id)
70
- "orcid"
71
- else
72
- "schema_org"
73
- end
74
- end
75
-
76
93
  def normalize_id(id)
77
94
  return nil unless id.present?
78
95
 
79
- normalize_doi(id) || PostRank::URI.clean(id)
96
+ normalize_doi(id) || Addressable::URI.parse(id).host && PostRank::URI.clean(id)
80
97
  end
81
98
 
82
99
  def normalize_orcid(orcid)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -17,6 +17,8 @@ describe Bolognese::Bibtex, vcr: true do
17
17
  {"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
18
18
  {"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
19
19
  expect(subject.name).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
20
+ expect(subject.description).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
21
+ expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
20
22
  expect(subject.date_published).to eq("2014")
21
23
  expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
22
24
  end
@@ -28,6 +30,7 @@ describe Bolognese::Bibtex, vcr: true do
28
30
  datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
29
31
  expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
30
32
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
33
+ expect(datacite.dig("descriptions", "description", "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
31
34
  expect(datacite.dig("creators", "creator").count).to eq(5)
32
35
  expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar")
33
36
  end