bolognese 0.4.3 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +326 -11
  5. data/lib/bolognese/author_utils.rb +7 -5
  6. data/lib/bolognese/cli.rb +20 -19
  7. data/lib/bolognese/crossref.rb +11 -49
  8. data/lib/bolognese/datacite.rb +16 -33
  9. data/lib/bolognese/datacite_utils.rb +28 -25
  10. data/lib/bolognese/doi_utils.rb +1 -1
  11. data/lib/bolognese/metadata.rb +55 -13
  12. data/lib/bolognese/schema_org.rb +12 -60
  13. data/lib/bolognese/utils.rb +24 -12
  14. data/lib/bolognese/version.rb +1 -1
  15. data/spec/cli_spec.rb +13 -0
  16. data/spec/crossref_spec.rb +6 -1
  17. data/spec/datacite_spec.rb +6 -1
  18. data/spec/fixtures/schema_org.json +44 -0
  19. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/default.yml +760 -0
  20. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/datacite/default.yml +214 -0
  21. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/schema_org/default.yml +653 -0
  22. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/Schema_org_JSON.yml +719 -0
  23. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/doi.yml +930 -0
  24. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/url.yml +930 -0
  25. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Schema_org_JSON.yml +173 -0
  26. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/crossref_doi_not_url.yml +2 -2
  27. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/BlogPosting.yml +42 -21
  28. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/BlogPosting_schema_org_JSON.yml +653 -0
  29. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata_as_datacite_xml/with_data_citation.yml +653 -0
  30. data/spec/metadata_spec.rb +9 -12
  31. data/spec/schema_org_spec.rb +41 -3
  32. data/spec/utils_spec.rb +3 -3
  33. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f368d772caba68f6a931b069036edd1fac3e15b
4
- data.tar.gz: 85312771808c2971a7b10004f5b77cf6f6276952
3
+ metadata.gz: d3f81c7d2d95a4c66adb94672309f22ffdae3f7c
4
+ data.tar.gz: 8c00d86fb7ee25359bbe568638674140d99a6d1d
5
5
  SHA512:
6
- metadata.gz: ed95b4b96238556e09a234defd26b402d72055204f31f4b9a0411774a5cca13079a91aeb80cccf3f812599a48b94c37fcffa1181ad324d730799894aafd37256
7
- data.tar.gz: 2f33f803a3a5ef8b1e957db914225f55fc460a60f5706406f9b43ce3ec5a9542c99fd393267723aed7d5c400b2213f6fb48c334a23d8d8ab1044b1e158b712ca
6
+ metadata.gz: a64a2cc22e1be39d8e94aa94ef2cbc2ba35300d322c74043153a81c81589f99a6e0fe49922fa1dd493ba6bd9aeb7eee9e72f7edfc141bee13367b1359589035c
7
+ data.tar.gz: af27b299a2b95bf3250bc7dce7941898f69f17eb7c85dad303057926ec0e94245de4ee1f5b7c3b8ea902d388dcee706098b992ef94462feeb02bab7cf49aa16f
@@ -2,13 +2,19 @@ language: ruby
2
2
  rvm:
3
3
  - 2.3.3
4
4
 
5
+ addons:
6
+ code_climate:
7
+ repo_token: $CODECLIMATE_REPO_TOKEN
8
+
5
9
  before_install:
6
10
  - export TZ=Europe/Berlin
7
11
 
8
12
  install:
9
13
  - travis_retry bundle install
10
14
 
11
- script: bundle exec rspec
15
+ script:
16
+ - bundle exec rspec
17
+ - bundle exec codeclimate-test-reporter
12
18
 
13
19
  notifications:
14
20
  email: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.4.3)
4
+ bolognese (0.5)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  builder (~> 3.2, >= 3.2.2)
7
7
  dotenv (~> 2.1, >= 2.1.1)
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  [![Build Status](https://travis-ci.org/datacite/bolognese.svg?branch=master)](https://travis-ci.org/datacite/bolognese)
2
+ [![Code Climate](https://codeclimate.com/github/datacite/bolognese/badges/gpa.svg)](https://codeclimate.com/github/datacite/bolognese)
3
+ [![Test Coverage](https://codeclimate.com/github/datacite/bolognese/badges/coverage.svg)](https://codeclimate.com/github/datacite/bolognese/coverage)
2
4
 
3
- # bolognese
5
+ # Bolognese
4
6
 
5
- 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 [schema.org](https://schema.org) in JSON-LD.
6
8
 
7
9
  ## Features
8
10
 
@@ -33,29 +35,271 @@ gem install bolognese
33
35
 
34
36
  ## Commands
35
37
 
36
- The bolognese commands understand URLs and DOIs as arguments. The `--as` command
38
+ The `bolognese` commands understand URLs and DOIs as arguments. The `--as` command
37
39
  line flag sets the format, either `crossref`, `datacite`, or `schema_org` (default).
38
40
 
39
41
  ## Examples
40
42
 
41
- Convert Crossref XML to schema.org/JSON-LD:
43
+ Read Crossref XML:
42
44
  ```
43
- bolognese read https://doi.org/10.7554/elife.01567
45
+ bolognese read https://doi.org/10.7554/elife.01567 --as crossref
44
46
  ```
45
47
 
46
- Read Crossref XML:
48
+ Convert Crossref XML to schema.org/JSON-LD:
47
49
  ```
48
- bolognese read https://doi.org/10.7554/elife.01567 --as crossref
50
+ bolognese read https://doi.org/10.7554/elife.01567
51
+
52
+ {
53
+ "@context": "http://schema.org",
54
+ "@type": "ScholarlyArticle",
55
+ "@id": "https://doi.org/10.7554/elife.01567",
56
+ "additionalType": "JournalArticle",
57
+ "name": "Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth",
58
+ "author": [{
59
+ "@type": "Person",
60
+ "givenName": "Martial",
61
+ "familyName": "Sankar"
62
+ }, {
63
+ "@type": "Person",
64
+ "givenName": "Kaisa",
65
+ "familyName": "Nieminen"
66
+ }, {
67
+ "@type": "Person",
68
+ "givenName": "Laura",
69
+ "familyName": "Ragni"
70
+ }, {
71
+ "@type": "Person",
72
+ "givenName": "Ioannis",
73
+ "familyName": "Xenarios"
74
+ }, {
75
+ "@type": "Person",
76
+ "givenName": "Christian S",
77
+ "familyName": "Hardtke"
78
+ }],
79
+ "license": "http://creativecommons.org/licenses/by/3.0/",
80
+ "datePublished": "2014-02-11",
81
+ "dateModified": "2015-08-11T05:35:02Z",
82
+ "isPartOf": {
83
+ "@type": "Periodical",
84
+ "name": "eLife",
85
+ "issn": "2050-084X"
86
+ },
87
+ "citation": [{
88
+ "@type": "CreativeWork",
89
+ "@id": "https://doi.org/10.1038/nature02100",
90
+ "position": "1",
91
+ "datePublished": "2003"
92
+ }, {
93
+ "@type": "CreativeWork",
94
+ "@id": "https://doi.org/10.1534/genetics.109.104976",
95
+ "position": "2",
96
+ "datePublished": "2009"
97
+ }, {
98
+ "@type": "CreativeWork",
99
+ "@id": "https://doi.org/10.1034/j.1399-3054.2002.1140413.x",
100
+ "position": "3",
101
+ "datePublished": "2002"
102
+ }, {
103
+ "@type": "CreativeWork",
104
+ "@id": "https://doi.org/10.1162/089976601750399335",
105
+ "position": "4",
106
+ "datePublished": "2001"
107
+ }, {
108
+ "@type": "CreativeWork",
109
+ "position": "5",
110
+ "datePublished": "1995"
111
+ }, {
112
+ "@type": "CreativeWork",
113
+ "position": "6",
114
+ "datePublished": "1993"
115
+ }, {
116
+ "@type": "CreativeWork",
117
+ "@id": "https://doi.org/10.1016/j.semcdb.2009.09.009",
118
+ "position": "7",
119
+ "datePublished": "2009"
120
+ }, {
121
+ "@type": "CreativeWork",
122
+ "@id": "https://doi.org/10.1242/dev.091314",
123
+ "position": "8",
124
+ "datePublished": "2013"
125
+ }, {
126
+ "@type": "CreativeWork",
127
+ "@id": "https://doi.org/10.1371/journal.pgen.1002997",
128
+ "position": "9",
129
+ "datePublished": "2012"
130
+ }, {
131
+ "@type": "CreativeWork",
132
+ "@id": "https://doi.org/10.1038/msb.2010.25",
133
+ "position": "10",
134
+ "datePublished": "2010"
135
+ }, {
136
+ "@type": "CreativeWork",
137
+ "@id": "https://doi.org/10.1016/j.biosystems.2012.07.004",
138
+ "position": "11",
139
+ "datePublished": "2012"
140
+ }, {
141
+ "@type": "CreativeWork",
142
+ "@id": "https://doi.org/10.1016/j.pbi.2005.11.013",
143
+ "position": "12",
144
+ "datePublished": "2006"
145
+ }, {
146
+ "@type": "CreativeWork",
147
+ "@id": "https://doi.org/10.1105/tpc.110.076083",
148
+ "position": "13",
149
+ "datePublished": "2010"
150
+ }, {
151
+ "@type": "CreativeWork",
152
+ "@id": "https://doi.org/10.1073/pnas.0808444105",
153
+ "position": "14",
154
+ "datePublished": "2008"
155
+ }, {
156
+ "@type": "CreativeWork",
157
+ "@id": "https://doi.org/10.1016/0092-8674(89)90900-8",
158
+ "position": "15",
159
+ "datePublished": "1989"
160
+ }, {
161
+ "@type": "CreativeWork",
162
+ "@id": "https://doi.org/10.1126/science.1066609",
163
+ "position": "16",
164
+ "datePublished": "2002"
165
+ }, {
166
+ "@type": "CreativeWork",
167
+ "@id": "https://doi.org/10.1104/pp.104.040212",
168
+ "position": "17",
169
+ "datePublished": "2004"
170
+ }, {
171
+ "@type": "CreativeWork",
172
+ "@id": "https://doi.org/10.1038/nbt1206-1565",
173
+ "position": "18",
174
+ "datePublished": "2006"
175
+ }, {
176
+ "@type": "CreativeWork",
177
+ "@id": "https://doi.org/10.1073/pnas.77.3.1516",
178
+ "position": "19",
179
+ "datePublished": "1980"
180
+ }, {
181
+ "@type": "CreativeWork",
182
+ "@id": "https://doi.org/10.1093/bioinformatics/btq046",
183
+ "position": "20",
184
+ "datePublished": "2010"
185
+ }, {
186
+ "@type": "CreativeWork",
187
+ "@id": "https://doi.org/10.1105/tpc.111.084020",
188
+ "position": "21",
189
+ "datePublished": "2011"
190
+ }, {
191
+ "@type": "CreativeWork",
192
+ "@id": "https://doi.org/10.5061/dryad.b835k",
193
+ "position": "22",
194
+ "datePublished": "2014"
195
+ }, {
196
+ "@type": "CreativeWork",
197
+ "@id": "https://doi.org/10.1016/j.cub.2008.02.070",
198
+ "position": "23",
199
+ "datePublished": "2008"
200
+ }, {
201
+ "@type": "CreativeWork",
202
+ "@id": "https://doi.org/10.1111/j.1469-8137.2010.03236.x",
203
+ "position": "24",
204
+ "datePublished": "2010"
205
+ }, {
206
+ "@type": "CreativeWork",
207
+ "@id": "https://doi.org/10.1007/s00138-011-0345-9",
208
+ "position": "25",
209
+ "datePublished": "2012"
210
+ }, {
211
+ "@type": "CreativeWork",
212
+ "@id": "https://doi.org/10.1016/j.cell.2012.02.048",
213
+ "position": "26",
214
+ "datePublished": "2012"
215
+ }, {
216
+ "@type": "CreativeWork",
217
+ "@id": "https://doi.org/10.1038/ncb2764",
218
+ "position": "27",
219
+ "datePublished": "2013"
220
+ }],
221
+ "provider": {
222
+ "@type": "Organization",
223
+ "name": "Crossref"
224
+ }
225
+ }
49
226
  ```
50
227
 
51
228
  Convert Crossref XML to DataCite XML:
52
229
  ```
53
230
  bolognese read https://doi.org/10.7554/elife.01567 --as datacite
54
- ```
55
231
 
56
- Convert DataCite XML to schema.org/JSON-LD:
57
- ```
58
- bolognese read 10.5061/DRYAD.8515
232
+ ?xml version="1.0" encoding="UTF-8"?>
233
+ <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">
234
+ <identifier identifierType="DOI">10.7554/eLife.01567</identifier>
235
+ <creators>
236
+ <creator>
237
+ <creatorName>Sankar, Martial</creatorName>
238
+ <givenName>Martial</givenName>
239
+ <familyName>Sankar</familyName>
240
+ </creator>
241
+ <creator>
242
+ <creatorName>Nieminen, Kaisa</creatorName>
243
+ <givenName>Kaisa</givenName>
244
+ <familyName>Nieminen</familyName>
245
+ </creator>
246
+ <creator>
247
+ <creatorName>Ragni, Laura</creatorName>
248
+ <givenName>Laura</givenName>
249
+ <familyName>Ragni</familyName>
250
+ </creator>
251
+ <creator>
252
+ <creatorName>Xenarios, Ioannis</creatorName>
253
+ <givenName>Ioannis</givenName>
254
+ <familyName>Xenarios</familyName>
255
+ </creator>
256
+ <creator>
257
+ <creatorName>Hardtke, Christian S</creatorName>
258
+ <givenName>Christian S</givenName>
259
+ <familyName>Hardtke</familyName>
260
+ </creator>
261
+ </creators>
262
+ <titles>
263
+ <title>Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth</title>
264
+ </titles>
265
+ <publisher>eLife</publisher>
266
+ <publicationYear>2014</publicationYear>
267
+ <resourceType resourceTypeGeneral="Text">JournalArticle</resourceType>
268
+ <dates>
269
+ <date dateType="Issued">2014-02-11</date>
270
+ <date dateType="Updated">2015-08-11T05:35:02Z</date>
271
+ </dates>
272
+ <relatedIdentifiers>
273
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1038/nature02100</relatedIdentifier>
274
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1534/genetics.109.104976</relatedIdentifier>
275
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1034/j.1399-3054.2002.1140413.x</relatedIdentifier>
276
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1162/089976601750399335</relatedIdentifier>
277
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/j.semcdb.2009.09.009</relatedIdentifier>
278
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1242/dev.091314</relatedIdentifier>
279
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1371/journal.pgen.1002997</relatedIdentifier>
280
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1038/msb.2010.25</relatedIdentifier>
281
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/j.biosystems.2012.07.004</relatedIdentifier>
282
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/j.pbi.2005.11.013</relatedIdentifier>
283
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1105/tpc.110.076083</relatedIdentifier>
284
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1073/pnas.0808444105</relatedIdentifier>
285
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/0092-8674(89)90900-8</relatedIdentifier>
286
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1126/science.1066609</relatedIdentifier>
287
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1104/pp.104.040212</relatedIdentifier>
288
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1038/nbt1206-1565</relatedIdentifier>
289
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1073/pnas.77.3.1516</relatedIdentifier>
290
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1093/bioinformatics/btq046</relatedIdentifier>
291
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1105/tpc.111.084020</relatedIdentifier>
292
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.5061/dryad.b835k</relatedIdentifier>
293
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/j.cub.2008.02.070</relatedIdentifier>
294
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1111/j.1469-8137.2010.03236.x</relatedIdentifier>
295
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1007/s00138-011-0345-9</relatedIdentifier>
296
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1016/j.cell.2012.02.048</relatedIdentifier>
297
+ <relatedIdentifier relatedIdentifierType="DOI" relationType="References">https://doi.org/10.1038/ncb2764</relatedIdentifier>
298
+ </relatedIdentifiers>
299
+ <rightsList>
300
+ <rights rightsURI="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 (CC-BY 3.0)</rights>
301
+ </rightsList>
302
+ </resource>
59
303
  ```
60
304
 
61
305
  Read DataCite XML:
@@ -63,6 +307,76 @@ Read DataCite XML:
63
307
  bolognese read 10.5061/DRYAD.8515 --as datacite
64
308
  ```
65
309
 
310
+ Convert DataCite XML to schema.org/JSON-LD:
311
+ ```sh
312
+ bolognese read 10.5061/DRYAD.8515
313
+
314
+ {
315
+ "@context": "http://schema.org",
316
+ "@type": "Dataset",
317
+ "@id": "https://doi.org/10.5061/dryad.8515",
318
+ "additionalType": "DataPackage",
319
+ "name": "Data from: A new malaria agent in African hominids.",
320
+ "alternateName": "Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.",
321
+ "author": [{
322
+ "@type": "Person",
323
+ "givenName": "Benjamin",
324
+ "familyName": "Ollomo"
325
+ }, {
326
+ "@type": "Person",
327
+ "givenName": "Patrick",
328
+ "familyName": "Durand"
329
+ }, {
330
+ "@type": "Person",
331
+ "givenName": "Franck",
332
+ "familyName": "Prugnolle"
333
+ }, {
334
+ "@type": "Person",
335
+ "givenName": "Emmanuel J. P.",
336
+ "familyName": "Douzery"
337
+ }, {
338
+ "@type": "Person",
339
+ "givenName": "Céline",
340
+ "familyName": "Arnathau"
341
+ }, {
342
+ "@type": "Person",
343
+ "givenName": "Dieudonné",
344
+ "familyName": "Nkoghe"
345
+ }, {
346
+ "@type": "Person",
347
+ "givenName": "Eric",
348
+ "familyName": "Leroy"
349
+ }, {
350
+ "@type": "Person",
351
+ "givenName": "François",
352
+ "familyName": "Renaud"
353
+ }],
354
+ "license": "http://creativecommons.org/publicdomain/zero/1.0/",
355
+ "version": "1",
356
+ "keywords": "Phylogeny, Malaria, Parasites, Taxonomy, Mitochondrial genome, Africa, Plasmodium",
357
+ "datePublished": "2011",
358
+ "hasPart": [{
359
+ "@type": "CreativeWork",
360
+ "@id": "https://doi.org/10.5061/dryad.8515/1"
361
+ }, {
362
+ "@type": "CreativeWork",
363
+ "@id": "https://doi.org/10.5061/dryad.8515/2"
364
+ }],
365
+ "citation": [{
366
+ "@type": "CreativeWork",
367
+ "@id": "https://doi.org/10.1371/journal.ppat.1000446"
368
+ }],
369
+ "publisher": {
370
+ "@type": "Organization",
371
+ "name": "Dryad Digital Repository"
372
+ },
373
+ "provider": {
374
+ "@type": "Organization",
375
+ "name": "DataCite"
376
+ }
377
+ }
378
+ ```
379
+
66
380
  ## Development
67
381
 
68
382
  We use rspec for unit testing:
@@ -72,6 +386,7 @@ bundle exec rspec
72
386
  ```
73
387
 
74
388
  Follow along via [Github Issues](https://github.com/datacite/bolognese/issues).
389
+ Please open an issue if conversion fails or metadata are not properly supported.
75
390
 
76
391
  ### Note on Patches/Pull Requests
77
392
 
@@ -3,11 +3,11 @@ require 'namae'
3
3
  module Bolognese
4
4
  module AuthorUtils
5
5
  # only assume personal name when using sort-order: "Turing, Alan"
6
- def get_one_author(author, options = {})
6
+ def get_one_author(author)
7
7
  orcid = get_name_identifier(author)
8
8
  author = author.fetch("creatorName", nil)
9
9
 
10
- return { "Name" => "" } if author.strip.blank?
10
+ return { "Name" => "" } if author.to_s.strip.blank?
11
11
 
12
12
  author = cleanup_author(author)
13
13
  names = Namae.parse(author)
@@ -44,15 +44,17 @@ module Bolognese
44
44
  end
45
45
 
46
46
  # parse array of author strings into CSL format
47
- def get_authors(authors, options={})
48
- Array(authors).map { |author| get_one_author(author, options) }
47
+ def get_authors(authors)
48
+ Array(authors).map { |author| get_one_author(author) }
49
49
  end
50
50
 
51
51
  # pase nameIdentifier from DataCite
52
52
  def get_name_identifier(author)
53
53
  name_identifier = author.dig("nameIdentifier", "text")
54
+ name_identifier = validate_orcid(name_identifier)
55
+
54
56
  name_identifier_scheme = author.dig("nameIdentifier", "nameIdentifierScheme") || "ORCID"
55
- if name_identifier_scheme.downcase == "orcid" && name_identifier = validate_orcid(name_identifier)
57
+ if name_identifier.present? && name_identifier_scheme.downcase == "orcid"
56
58
  "http://orcid.org/#{name_identifier}"
57
59
  else
58
60
  nil