bolognese 0.8.13 → 0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +53 -8
  3. data/README.md +22 -1
  4. data/bolognese.gemspec +5 -1
  5. data/lib/bolognese.rb +5 -0
  6. data/lib/bolognese/citeproc.rb +6 -2
  7. data/lib/bolognese/codemeta.rb +6 -2
  8. data/lib/bolognese/crossref.rb +1 -1
  9. data/lib/bolognese/datacite.rb +2 -2
  10. data/lib/bolognese/datacite_json.rb +9 -5
  11. data/lib/bolognese/datacite_utils.rb +1 -1
  12. data/lib/bolognese/metadata.rb +32 -10
  13. data/lib/bolognese/schema_org.rb +9 -4
  14. data/lib/bolognese/version.rb +1 -1
  15. data/resources/schema_org/jsonldcontext.json +6640 -0
  16. data/spec/bibtex_spec.rb +18 -0
  17. data/spec/citeproc_spec.rb +18 -0
  18. data/spec/codemeta_spec.rb +20 -0
  19. data/spec/crossref_spec.rb +44 -0
  20. data/spec/datacite_json_spec.rb +41 -0
  21. data/spec/datacite_spec.rb +35 -0
  22. data/spec/datacite_utils_spec.rb +15 -15
  23. data/spec/fixtures/datacite_software_missing_comma.json +18 -0
  24. data/spec/fixtures/datacite_software_overlapping_keys.json +18 -0
  25. data/spec/fixtures/vcr_cassettes/Bolognese_Bibtex/get_metadata_as_rdf_xml/Crossref_DOI.yml +9163 -0
  26. data/spec/fixtures/vcr_cassettes/Bolognese_Bibtex/get_metadata_as_turtle/Crossref_DOI.yml +5303 -0
  27. data/spec/fixtures/vcr_cassettes/Bolognese_Citeproc/get_metadata_as_rdf_xml/BlogPosting.yml +9163 -0
  28. data/spec/fixtures/vcr_cassettes/Bolognese_Citeproc/get_metadata_as_turtle/BlogPosting.yml +4583 -0
  29. data/spec/fixtures/vcr_cassettes/Bolognese_Codemeta/get_metadata_as_rdf_xml/maremma.yml +9260 -0
  30. data/spec/fixtures/vcr_cassettes/Bolognese_Codemeta/get_metadata_as_turtle/maremma.yml +9260 -0
  31. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_rdf_xml/journal_article.yml +5303 -0
  32. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_rdf_xml/with_pages.yml +4950 -0
  33. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_turtle/journal_article.yml +5303 -0
  34. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_turtle/with_pages.yml +9530 -0
  35. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_microdata/BlogPosting.yml +4735 -0
  36. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_rdf/xml/BlogPosting.yml +4735 -0
  37. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_rdf/xml/Dataset.yml +4753 -0
  38. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_rdf_xml/BlogPosting.yml +4735 -0
  39. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_rdfa/BlogPosting.yml +4735 -0
  40. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_rdfxml/BlogPosting.yml +9315 -0
  41. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_turtle/BlogPosting.yml +4735 -0
  42. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_turtle/Dataset.yml +4753 -0
  43. data/spec/fixtures/vcr_cassettes/Bolognese_DataciteJson/BlogPosting.yml +4735 -0
  44. data/spec/fixtures/vcr_cassettes/Bolognese_DataciteJson/get_metadata_as_rdf_xml/BlogPosting.yml +4735 -0
  45. data/spec/fixtures/vcr_cassettes/Bolognese_DataciteJson/get_metadata_as_turtle/BlogPosting.yml +4583 -0
  46. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata_as_rdf_xml/BlogPosting.yml +5233 -0
  47. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata_as_turtle/BlogPosting.yml +5233 -0
  48. data/spec/metadata_spec.rb +20 -0
  49. data/spec/schema_org_spec.rb +26 -1
  50. metadata +94 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2369ba9f739cdf61b879479f95a5732f967eb37e
4
- data.tar.gz: 6d707dfe7018625eec5fcb0717562be17cabebdf
3
+ metadata.gz: 290c7cb9287a0b5e018ff3392821d45d41af4360
4
+ data.tar.gz: 9e687bbe98ed2bafc223bb49044b8fc2ea2a44d3
5
5
  SHA512:
6
- metadata.gz: 3f634c7a9ca25143d6d0af60e147a753de70471d55016f98bf2f5f75fbd2cc509c19c731ddca33ce25823ae37674763c674689a316491363c5af1bf73886ef5a
7
- data.tar.gz: 1958c1d8d9938e8c26ed04b3f39100f3f0a95822ff3959f3ad6ac501ee3f0c85654f47f5c1deb579e73d07f4c657ae4c67c6d9ed470a8a9c7961d6a9405c01a3
6
+ metadata.gz: 2dcaac0f7918491a15d02f08154e94130cdd2c5579c65669e04bce2ec27643f3a4376c70537a700ea61ce3bc18d634bab3de152555d6c68ac5110ccfa43bf96e
7
+ data.tar.gz: 2add919c630f4c2f211337d36366a556b3e9e00c6b41e5a82cf145064c8bf7ca1ad815eeaae155fd20d7fcee3d431af34fd4ed024726cf43a64e3278cc89bc55
data/Gemfile.lock CHANGED
@@ -1,16 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.8.13)
4
+ bolognese (0.9)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  bibtex-ruby (~> 4.1)
7
7
  builder (~> 3.2, >= 3.2.2)
8
8
  colorize (~> 0.8.1)
9
+ json-ld (~> 2.1, >= 2.1.2)
10
+ jsonlint (~> 0.2.0)
9
11
  loofah (~> 2.0, >= 2.0.3)
10
12
  maremma (~> 3.5)
11
13
  namae (~> 0.10.2)
12
- nokogiri (~> 1.7, >= 1.7.1)
14
+ nokogiri (~> 1.6, >= 1.6.8)
13
15
  postrank-uri (~> 1.0, >= 1.0.18)
16
+ rdf-rdfxml (~> 2.0)
17
+ rdf-turtle (~> 2.2)
14
18
  thor (~> 0.19)
15
19
 
16
20
  GEM
@@ -29,10 +33,14 @@ GEM
29
33
  codeclimate-test-reporter (1.0.8)
30
34
  simplecov (<= 0.13)
31
35
  colorize (0.8.1)
36
+ concurrent-ruby (1.0.5)
32
37
  crack (0.4.3)
33
38
  safe_yaml (~> 1.0.0)
34
39
  diff-lcs (1.3)
35
40
  docile (1.1.5)
41
+ ebnf (1.1.0)
42
+ rdf (~> 2.0)
43
+ sxp (~> 1.0)
36
44
  excon (0.45.4)
37
45
  faraday (0.9.2)
38
46
  multipart-post (>= 1.2, < 3)
@@ -40,14 +48,26 @@ GEM
40
48
  faraday
41
49
  faraday_middleware (0.10.1)
42
50
  faraday (>= 0.7.4, < 1.0)
51
+ haml (4.0.7)
52
+ tilt
53
+ hamster (3.0.0)
54
+ concurrent-ruby (~> 1.0)
43
55
  hashdiff (0.3.2)
56
+ htmlentities (4.3.4)
44
57
  i18n (0.8.1)
45
- json (2.0.3)
58
+ json (2.0.4)
59
+ json-ld (2.1.2)
60
+ multi_json (~> 1.12)
61
+ rdf (~> 2.1)
62
+ jsonlint (0.2.0)
63
+ oj (~> 2)
64
+ trollop (~> 2)
46
65
  latex-decode (0.2.2)
47
66
  unicode (~> 0.4)
67
+ link_header (0.0.8)
48
68
  loofah (2.0.3)
49
69
  nokogiri (>= 1.5.9)
50
- maremma (3.5.4)
70
+ maremma (3.5.6)
51
71
  activesupport (~> 4.2, >= 4.2.5)
52
72
  addressable (>= 2.3.6)
53
73
  builder (~> 3.2, >= 3.2.2)
@@ -55,12 +75,12 @@ GEM
55
75
  faraday (~> 0.9.2)
56
76
  faraday-encoding (~> 0.0.1)
57
77
  faraday_middleware (~> 0.10.0)
58
- multi_json (~> 1.11.2)
59
- nokogiri (~> 1.7, >= 1.7.1)
78
+ multi_json (~> 1.12)
79
+ nokogiri (~> 1.6, >= 1.6.8)
60
80
  oj (~> 2.18, >= 2.18.1)
61
81
  mini_portile2 (2.1.0)
62
82
  minitest (5.10.1)
63
- multi_json (1.11.3)
83
+ multi_json (1.12.1)
64
84
  multipart-post (2.0.0)
65
85
  namae (0.10.2)
66
86
  nokogiri (1.7.1)
@@ -75,6 +95,27 @@ GEM
75
95
  rack-test (0.6.3)
76
96
  rack (>= 1.0)
77
97
  rake (12.0.0)
98
+ rdf (2.2.5)
99
+ hamster (~> 3.0)
100
+ link_header (~> 0.0, >= 0.0.8)
101
+ rdf-aggregate-repo (2.2.0)
102
+ rdf (~> 2.0)
103
+ rdf-rdfa (2.1.1)
104
+ haml (~> 4.0)
105
+ htmlentities (~> 4.3)
106
+ rdf (~> 2.0)
107
+ rdf-aggregate-repo (~> 2.0)
108
+ rdf-xsd (~> 2.0)
109
+ rdf-rdfxml (2.0.0)
110
+ htmlentities (~> 4.3)
111
+ rdf (~> 2.0)
112
+ rdf-rdfa (~> 2.0)
113
+ rdf-xsd (~> 2.0)
114
+ rdf-turtle (2.2.0)
115
+ ebnf (~> 1.1)
116
+ rdf (~> 2.2)
117
+ rdf-xsd (2.1.0)
118
+ rdf (~> 2.1)
78
119
  rspec (3.5.0)
79
120
  rspec-core (~> 3.5.0)
80
121
  rspec-expectations (~> 3.5.0)
@@ -97,8 +138,12 @@ GEM
97
138
  json (>= 1.8, < 3)
98
139
  simplecov-html (~> 0.10.0)
99
140
  simplecov-html (0.10.0)
141
+ sxp (1.0.0)
142
+ rdf (~> 2.0)
100
143
  thor (0.19.4)
101
144
  thread_safe (0.3.6)
145
+ tilt (2.0.7)
146
+ trollop (2.1.2)
102
147
  tzinfo (1.2.3)
103
148
  thread_safe (~> 0.1)
104
149
  unicode (0.4.4.4)
@@ -124,4 +169,4 @@ DEPENDENCIES
124
169
  webmock (~> 1.22, >= 1.22.3)
125
170
 
126
171
  BUNDLED WITH
127
- 1.14.6
172
+ 1.12.5
data/README.md CHANGED
@@ -51,6 +51,20 @@ Bolognese reads and/or writes these metadata formats:
51
51
  <td>Yes</td>
52
52
  <td>Yes</td>
53
53
  </tr>
54
+ <tr>
55
+ <td><a href='http://www.w3.org/TR/rdf-syntax-grammar/'>RDF XML</a></td>
56
+ <td>rdf_xml</td>
57
+ <td>application/rdf+xml</td>
58
+ <td>No</td>
59
+ <td>Yes</td>
60
+ </tr>
61
+ <tr>
62
+ <td><a href='http://www.w3.org/TeamSubmission/turtle/'>RDF Turtle</a></td>
63
+ <td>turtle</td>
64
+ <td>text/turtle</td>
65
+ <td>No</td>
66
+ <td>Yes</td>
67
+ </tr>
54
68
  <tr>
55
69
  <td><a href='http://gsl-nagoya-u.net/http/pub/citeproc-doc.html'>Citeproc JSON</a></td>
56
70
  <td>citeproc</td>
@@ -61,8 +75,15 @@ Bolognese reads and/or writes these metadata formats:
61
75
  <tr>
62
76
  <td><a href='https://codemeta.github.io/'>Codemeta</a></td>
63
77
  <td>codemeta</td>
64
- <td>application/ld+json</td>
78
+ <td>application/vnd.codemeta.ld+json</td>
79
+ <td>Yes</td>
65
80
  <td>Yes</td>
81
+ </tr>
82
+ <tr>
83
+ <td><a href='https://github.com/scholix/schema'>Scholix</a></td>
84
+ <td>scholix</td>
85
+ <td>application/vnd.scholix+json</td>
86
+ <td>No</td>
66
87
  <td>Yes</td>
67
88
  </tr>
68
89
  <tr>
data/bolognese.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  # Declary dependencies here, rather than in the Gemfile
18
18
  s.add_dependency 'maremma', '~> 3.5'
19
- s.add_dependency 'nokogiri', '~> 1.7', '>= 1.7.1'
19
+ s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
20
20
  s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
21
21
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
22
22
  s.add_dependency 'activesupport', '~> 4.2', '>= 4.2.5'
@@ -25,6 +25,10 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'colorize', '~> 0.8.1'
26
26
  s.add_dependency 'namae', '~> 0.10.2'
27
27
  s.add_dependency 'postrank-uri', '~> 1.0', '>= 1.0.18'
28
+ s.add_dependency 'json-ld', '~> 2.1', '>= 2.1.2'
29
+ s.add_dependency 'jsonlint', '~> 0.2.0'
30
+ s.add_dependency 'rdf-turtle', '~> 2.2'
31
+ s.add_dependency 'rdf-rdfxml', '~> 2.0'
28
32
  s.add_development_dependency 'bundler', '~> 1.0'
29
33
  s.add_development_dependency 'rspec', '~> 3.4'
30
34
  s.add_development_dependency 'rspec-xsd', '~> 0.1.0'
data/lib/bolognese.rb CHANGED
@@ -5,6 +5,11 @@ require 'postrank-uri'
5
5
  require 'bibtex'
6
6
  require 'colorize'
7
7
  require 'loofah'
8
+ require 'json/ld'
9
+ require 'rdf/turtle'
10
+ require 'rdf/rdfxml'
11
+ require 'logger'
12
+ require 'jsonlint'
8
13
 
9
14
  require "bolognese/version"
10
15
  require "bolognese/metadata"
@@ -15,15 +15,19 @@ module Bolognese
15
15
  end
16
16
 
17
17
  def metadata
18
- @metadata ||= raw.present? ? Maremma.from_json(raw) : {}
18
+ @metadata ||= raw.present? && valid? ? Maremma.from_json(raw) : {}
19
19
  end
20
20
 
21
21
  def exists?
22
22
  metadata.present?
23
23
  end
24
24
 
25
+ def errors
26
+ jsonlint(raw)
27
+ end
28
+
25
29
  def valid?
26
- citeproc.present?
30
+ errors.empty?
27
31
  end
28
32
 
29
33
  def doi
@@ -13,15 +13,19 @@ module Bolognese
13
13
  end
14
14
 
15
15
  def metadata
16
- @metadata ||= raw.present? ? Maremma.from_json(raw) : {}
16
+ @metadata ||= raw.present? && valid? ? Maremma.from_json(raw) : {}
17
17
  end
18
18
 
19
19
  def exists?
20
20
  metadata.present?
21
21
  end
22
22
 
23
+ def errors
24
+ jsonlint(raw)
25
+ end
26
+
23
27
  def valid?
24
- codemeta.present?
28
+ errors.empty?
25
29
  end
26
30
 
27
31
  def doi
@@ -68,7 +68,7 @@ module Bolognese
68
68
  elsif id.present?
69
69
  response = Maremma.get(id, accept: "application/vnd.crossref.unixref+xml", host: true, raw: true)
70
70
  @raw = response.body.fetch("data", nil)
71
- @raw = Nokogiri::XML(@raw, &:noblanks).to_s if @raw.present?
71
+ @raw = Nokogiri::XML(@raw, nil, 'UTF-8', &:noblanks).to_s if @raw.present?
72
72
  end
73
73
  end
74
74
 
@@ -11,7 +11,7 @@ module Bolognese
11
11
  elsif id.present?
12
12
  response = Maremma.get(id, accept: "application/vnd.datacite.datacite+xml", raw: true)
13
13
  @raw = response.body.fetch("data", nil)
14
- @raw = Nokogiri::XML(@raw, &:noblanks).to_s if @raw.present?
14
+ @raw = Nokogiri::XML(@raw, nil, 'UTF-8', &:noblanks).to_s if @raw.present?
15
15
  end
16
16
 
17
17
  @should_passthru = !regenerate
@@ -35,7 +35,7 @@ module Bolognese
35
35
  end
36
36
 
37
37
  def errors
38
- schema.validate(Nokogiri::XML(raw)).map { |error| error.to_s }.unwrap
38
+ schema.validate(Nokogiri::XML(raw, nil, 'UTF-8')).map { |error| error.to_s }.unwrap
39
39
  rescue Nokogiri::XML::SyntaxError => e
40
40
  e.message
41
41
  end
@@ -8,11 +8,15 @@ module Bolognese
8
8
  end
9
9
 
10
10
  def metadata
11
- @metadata ||= raw.present? ? Maremma.from_json(raw) : {}
11
+ @metadata ||= raw.present? && valid? ? Maremma.from_json(raw) : {}
12
+ end
13
+
14
+ def errors
15
+ jsonlint(raw)
12
16
  end
13
17
 
14
18
  def valid?
15
- datacite_json.present?
19
+ errors.empty?
16
20
  end
17
21
 
18
22
  def datacite
@@ -32,11 +36,11 @@ module Bolognese
32
36
  end
33
37
 
34
38
  def type
35
- DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || "CreativeWork"
39
+ DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || valid?.presence && "CreativeWork"
36
40
  end
37
41
 
38
42
  def citeproc_type
39
- DC_TO_CP_TRANSLATIONS[resource_type_general.to_s.dasherize] || "other"
43
+ DC_TO_CP_TRANSLATIONS[resource_type_general.to_s.dasherize] || valid?.presence && "other"
40
44
  end
41
45
 
42
46
  def ris_type
@@ -204,7 +208,7 @@ module Bolognese
204
208
  end
205
209
 
206
210
  def publisher
207
- metadata.fetch("publisher")
211
+ metadata.fetch("publisher", nil)
208
212
  end
209
213
 
210
214
  alias_method :container_title, :publisher
@@ -19,7 +19,7 @@ module Bolognese
19
19
  end
20
20
 
21
21
  def datacite_errors
22
- @datacite_errors ||= schema.validate(Nokogiri::XML(datacite)).map { |error| error.to_s }
22
+ @datacite_errors ||= schema.validate(Nokogiri::XML(datacite, nil, 'UTF-8')).map { |error| error.to_s }
23
23
  end
24
24
 
25
25
  def insert_work(xml)
@@ -237,8 +237,8 @@ module Bolognese
237
237
  "isBasedOn" => Array.wrap(is_supplement_to).map { |r| { "@id" => r["id"] }}.unwrap }.compact
238
238
  end
239
239
 
240
- def schema_org
241
- hsh = {
240
+ def schema_hsh
241
+ {
242
242
  "@context" => id.present? ? "http://schema.org" : nil,
243
243
  "@type" => type,
244
244
  "@id" => id,
@@ -266,13 +266,28 @@ module Bolognese
266
266
  "predecessor_of" => is_previous_version_of,
267
267
  "successor_of" => is_new_version_of,
268
268
  "citation" => Array.wrap(references).map { |r| r.except("relationType").merge("@type" => "CreativeWork") }.unwrap,
269
- "@reverse" => reverse,
269
+ "@reverse" => reverse.presence,
270
270
  "schemaVersion" => schema_version,
271
- "publisher" => { "@type" => "Organization", "name" => publisher },
271
+ "publisher" => publisher.present? ? { "@type" => "Organization", "name" => publisher } : nil,
272
272
  "funder" => funder,
273
- "provider" => { "@type" => "Organization", "name" => provider }
274
- }.compact
275
- JSON.pretty_generate hsh
273
+ "provider" => provider.present? ? { "@type" => "Organization", "name" => provider } : nil
274
+ }.compact.presence
275
+ end
276
+
277
+ def schema_org
278
+ JSON.pretty_generate schema_hsh
279
+ end
280
+
281
+ def graph
282
+ RDF::Graph.new << JSON::LD::API.toRdf(schema_hsh)
283
+ end
284
+
285
+ def turtle
286
+ graph.dump(:ttl, prefixes: { schema: "http://schema.org/" })
287
+ end
288
+
289
+ def rdf_xml
290
+ graph.dump(:rdfxml, prefixes: { schema: "http://schema.org/" })
276
291
  end
277
292
 
278
293
  def datacite_json
@@ -309,7 +324,7 @@ module Bolognese
309
324
  "schemaVersion" => schema_version,
310
325
  "provider" => provider
311
326
  }.compact
312
- JSON.pretty_generate hsh
327
+ JSON.pretty_generate hsh.presence
313
328
  end
314
329
 
315
330
  def citeproc
@@ -333,7 +348,7 @@ module Bolognese
333
348
  "version" => version,
334
349
  "volume" => volume
335
350
  }.compact
336
- JSON.pretty_generate hsh
351
+ JSON.pretty_generate hsh.presence
337
352
  end
338
353
 
339
354
  def codemeta
@@ -353,7 +368,7 @@ module Bolognese
353
368
  "dateModified" => date_modified,
354
369
  "publisher" => publisher
355
370
  }.compact
356
- JSON.pretty_generate hsh
371
+ JSON.pretty_generate hsh.presence
357
372
  end
358
373
 
359
374
  def bibtex
@@ -394,5 +409,12 @@ module Bolognese
394
409
  "ER" => ""
395
410
  }.compact.map { |k, v| v.is_a?(Array) ? v.map { |vi| "#{k} - #{vi}" }.join("\r\n") : "#{k} - #{v}" }.join("\r\n")
396
411
  end
412
+
413
+ def jsonlint(json)
414
+ error_array = []
415
+ linter = JsonLint::Linter.new
416
+ linter.send(:check_data, json, error_array)
417
+ error_array
418
+ end
397
419
  end
398
420
  end
@@ -17,21 +17,26 @@ module Bolognese
17
17
  @raw = string
18
18
  elsif id.present?
19
19
  response = Maremma.get(id)
20
- doc = Nokogiri::XML(response.body.fetch("data", nil))
20
+ doc = Nokogiri::XML(response.body.fetch("data", nil), nil, 'UTF-8')
21
21
  @raw = doc.at_xpath('//script[@type="application/ld+json"]')
22
+ @raw = @raw.text if @raw.present?
22
23
  end
23
24
  end
24
25
 
25
26
  def metadata
26
- @metadata ||= raw.present? ? Maremma.from_json(raw) : {}
27
+ @metadata ||= raw.present? && valid? ? Maremma.from_json(raw) : {}
27
28
  end
28
29
 
29
30
  def exists?
30
31
  metadata.present?
31
32
  end
32
33
 
34
+ def errors
35
+ jsonlint(raw)
36
+ end
37
+
33
38
  def valid?
34
- schema_org.present?
39
+ errors.empty?
35
40
  end
36
41
 
37
42
  def doi
@@ -61,7 +66,7 @@ module Bolognese
61
66
  def ris_type
62
67
  SO_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN"
63
68
  end
64
-
69
+
65
70
  def additional_type
66
71
  metadata.fetch("additionalType", nil)
67
72
  end