bolognese 0.9.97 → 0.9.98
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/metadata.rb +5 -58
- data/lib/bolognese/metadata_utils.rb +61 -14
- data/lib/bolognese/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb294ca90277c0d235c480528d0c05ce61aa4f7655805836e144e4a3e02fae2a
|
4
|
+
data.tar.gz: fdba8304216f2bc628cce05e780dfccd0c3f9f2dbf4730ffaf75afc031fef782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385f09c0a153de7e10c32ec82acd28f4918eb8d04ea7974eaf7bf4fb2722ea09fde4d7bc8697119ca49df26de7bf65294787af1aa0ee8b1821d8347665964cab
|
7
|
+
data.tar.gz: 731fc45a0776bad14c1e38faa3eca7e59e95b49bb115ba846f942fd1b0d602f6fb1d2f8f9c2ec96d828b5336e7190cccb2c1109a4243d5654099904915a50821
|
data/Gemfile.lock
CHANGED
data/lib/bolognese/metadata.rb
CHANGED
@@ -1,58 +1,10 @@
|
|
1
1
|
require_relative 'metadata_utils'
|
2
2
|
|
3
|
-
require_relative 'readers/bibtex_reader'
|
4
|
-
require_relative 'readers/citeproc_reader'
|
5
|
-
require_relative 'readers/codemeta_reader'
|
6
|
-
require_relative 'readers/crosscite_reader'
|
7
|
-
require_relative 'readers/crossref_reader'
|
8
|
-
require_relative 'readers/datacite_json_reader'
|
9
|
-
require_relative 'readers/datacite_reader'
|
10
|
-
require_relative 'readers/ris_reader'
|
11
|
-
require_relative 'readers/schema_org_reader'
|
12
|
-
|
13
|
-
require_relative 'writers/bibtex_writer'
|
14
|
-
require_relative 'writers/citation_writer'
|
15
|
-
require_relative 'writers/citeproc_writer'
|
16
|
-
require_relative 'writers/codemeta_writer'
|
17
|
-
require_relative 'writers/crosscite_writer'
|
18
|
-
require_relative 'writers/crossref_writer'
|
19
|
-
require_relative 'writers/datacite_writer'
|
20
|
-
require_relative 'writers/datacite_json_writer'
|
21
|
-
require_relative 'writers/jats_writer'
|
22
|
-
require_relative 'writers/rdf_xml_writer'
|
23
|
-
require_relative 'writers/ris_writer'
|
24
|
-
require_relative 'writers/schema_org_writer'
|
25
|
-
require_relative 'writers/turtle_writer'
|
26
|
-
|
27
3
|
module Bolognese
|
28
4
|
class Metadata
|
29
|
-
include Bolognese::Readers::BibtexReader
|
30
|
-
include Bolognese::Readers::CiteprocReader
|
31
|
-
include Bolognese::Readers::CodemetaReader
|
32
|
-
include Bolognese::Readers::CrossciteReader
|
33
|
-
include Bolognese::Readers::CrossrefReader
|
34
|
-
include Bolognese::Readers::DataciteReader
|
35
|
-
include Bolognese::Readers::DataciteJsonReader
|
36
|
-
include Bolognese::Readers::RisReader
|
37
|
-
include Bolognese::Readers::SchemaOrgReader
|
38
|
-
|
39
|
-
include Bolognese::Writers::BibtexWriter
|
40
|
-
include Bolognese::Writers::CitationWriter
|
41
|
-
include Bolognese::Writers::CiteprocWriter
|
42
|
-
include Bolognese::Writers::CodemetaWriter
|
43
|
-
include Bolognese::Writers::CrossciteWriter
|
44
|
-
include Bolognese::Writers::CrossrefWriter
|
45
|
-
include Bolognese::Writers::DataciteWriter
|
46
|
-
include Bolognese::Writers::DataciteJsonWriter
|
47
|
-
include Bolognese::Writers::JatsWriter
|
48
|
-
include Bolognese::Writers::RdfXmlWriter
|
49
|
-
include Bolognese::Writers::RisWriter
|
50
|
-
include Bolognese::Writers::SchemaOrgWriter
|
51
|
-
include Bolognese::Writers::TurtleWriter
|
52
|
-
|
53
5
|
include Bolognese::MetadataUtils
|
54
6
|
|
55
|
-
attr_writer :id, :provider_id, :client_id, :doi
|
7
|
+
attr_writer :id, :provider_id, :client_id, :doi
|
56
8
|
|
57
9
|
def initialize(input: nil, from: nil, **options)
|
58
10
|
id = normalize_id(input, options)
|
@@ -95,13 +47,16 @@ module Bolognese
|
|
95
47
|
@sandbox = options[:sandbox]
|
96
48
|
|
97
49
|
# options that come from the datacite database
|
98
|
-
@b_doi = normalize_doi(options[:doi] || input, options)
|
99
50
|
@b_url = hsh.to_h["b_url"].presence || options[:b_url].presence
|
100
51
|
@state = hsh.to_h["state"].presence
|
101
52
|
@date_registered = hsh.to_h["date_registered"].presence
|
102
53
|
@date_updated = hsh.to_h["date_updated"].presence
|
103
54
|
@provider_id = hsh.to_h["provider_id"].presence
|
104
55
|
@client_id = hsh.to_h["client_id"].presence
|
56
|
+
|
57
|
+
# generate name for method to call dynamically
|
58
|
+
@meta = @from.present? ? send("read_" + @from, string: string, sandbox: options[:sandbox]) : {}
|
59
|
+
@identifier = normalize_doi(options[:doi] || input, options) || @meta.fetch("id", nil) || @meta.fetch("identifier", nil)
|
105
60
|
end
|
106
61
|
|
107
62
|
def id
|
@@ -112,14 +67,6 @@ module Bolognese
|
|
112
67
|
@doi ||= @identifier.present? ? doi_from_url(@identifier) : meta.fetch("doi", nil)
|
113
68
|
end
|
114
69
|
|
115
|
-
def b_url
|
116
|
-
@b_url ||= meta.fetch("b_url", nil)
|
117
|
-
end
|
118
|
-
|
119
|
-
def b_version
|
120
|
-
@b_version ||= meta.fetch("b_version", nil)
|
121
|
-
end
|
122
|
-
|
123
70
|
def provider_id
|
124
71
|
@provider_id ||= meta.fetch("provider_id", nil)
|
125
72
|
end
|
@@ -3,6 +3,30 @@ require_relative 'author_utils'
|
|
3
3
|
require_relative 'datacite_utils'
|
4
4
|
require_relative 'utils'
|
5
5
|
|
6
|
+
require_relative 'readers/bibtex_reader'
|
7
|
+
require_relative 'readers/citeproc_reader'
|
8
|
+
require_relative 'readers/codemeta_reader'
|
9
|
+
require_relative 'readers/crosscite_reader'
|
10
|
+
require_relative 'readers/crossref_reader'
|
11
|
+
require_relative 'readers/datacite_json_reader'
|
12
|
+
require_relative 'readers/datacite_reader'
|
13
|
+
require_relative 'readers/ris_reader'
|
14
|
+
require_relative 'readers/schema_org_reader'
|
15
|
+
|
16
|
+
require_relative 'writers/bibtex_writer'
|
17
|
+
require_relative 'writers/citation_writer'
|
18
|
+
require_relative 'writers/citeproc_writer'
|
19
|
+
require_relative 'writers/codemeta_writer'
|
20
|
+
require_relative 'writers/crosscite_writer'
|
21
|
+
require_relative 'writers/crossref_writer'
|
22
|
+
require_relative 'writers/datacite_writer'
|
23
|
+
require_relative 'writers/datacite_json_writer'
|
24
|
+
require_relative 'writers/jats_writer'
|
25
|
+
require_relative 'writers/rdf_xml_writer'
|
26
|
+
require_relative 'writers/ris_writer'
|
27
|
+
require_relative 'writers/schema_org_writer'
|
28
|
+
require_relative 'writers/turtle_writer'
|
29
|
+
|
6
30
|
module Bolognese
|
7
31
|
module MetadataUtils
|
8
32
|
# include BenchmarkMethods
|
@@ -11,15 +35,39 @@ module Bolognese
|
|
11
35
|
include Bolognese::DataciteUtils
|
12
36
|
include Bolognese::Utils
|
13
37
|
|
14
|
-
|
38
|
+
include Bolognese::Readers::BibtexReader
|
39
|
+
include Bolognese::Readers::CiteprocReader
|
40
|
+
include Bolognese::Readers::CodemetaReader
|
41
|
+
include Bolognese::Readers::CrossciteReader
|
42
|
+
include Bolognese::Readers::CrossrefReader
|
43
|
+
include Bolognese::Readers::DataciteReader
|
44
|
+
include Bolognese::Readers::DataciteJsonReader
|
45
|
+
include Bolognese::Readers::RisReader
|
46
|
+
include Bolognese::Readers::SchemaOrgReader
|
47
|
+
|
48
|
+
include Bolognese::Writers::BibtexWriter
|
49
|
+
include Bolognese::Writers::CitationWriter
|
50
|
+
include Bolognese::Writers::CiteprocWriter
|
51
|
+
include Bolognese::Writers::CodemetaWriter
|
52
|
+
include Bolognese::Writers::CrossciteWriter
|
53
|
+
include Bolognese::Writers::CrossrefWriter
|
54
|
+
include Bolognese::Writers::DataciteWriter
|
55
|
+
include Bolognese::Writers::DataciteJsonWriter
|
56
|
+
include Bolognese::Writers::JatsWriter
|
57
|
+
include Bolognese::Writers::RdfXmlWriter
|
58
|
+
include Bolognese::Writers::RisWriter
|
59
|
+
include Bolognese::Writers::SchemaOrgWriter
|
60
|
+
include Bolognese::Writers::TurtleWriter
|
61
|
+
|
62
|
+
attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :contributor,
|
15
63
|
:spatial_coverage
|
16
64
|
|
17
65
|
attr_writer :identifier, :author, :title, :publisher, :license,
|
18
66
|
:date_accepted, :date_available, :date_copyrighted, :date_collected,
|
19
67
|
:date_submitted, :date_valid, :date_created, :date_modified, :date_updated,
|
20
|
-
:journal, :volume, :first_page, :last_page,
|
68
|
+
:journal, :volume, :first_page, :last_page, :b_url, :b_version, :resource_type_general,
|
21
69
|
:keywords, :editor, :description, :alternate_name, :language, :content_size,
|
22
|
-
:schema_version, :has_part, :same_as,
|
70
|
+
:schema_version, :has_part, :same_as, :resource_type_general,
|
23
71
|
:is_previous_version_of, :is_new_version_of, :is_cited_by, :cites,
|
24
72
|
:is_supplement_to, :is_supplemented_by, :is_continued_by, :continues,
|
25
73
|
:has_metadata, :is_metadata_for, :is_referenced_by, :references,
|
@@ -45,15 +93,6 @@ module Bolognese
|
|
45
93
|
(from == "datacite") && regenerate.blank?
|
46
94
|
end
|
47
95
|
|
48
|
-
# generate name for method to call dynamically
|
49
|
-
# the id might change
|
50
|
-
def meta
|
51
|
-
m = from.present? ? send("read_" + from, string: string, sandbox: sandbox) : {}
|
52
|
-
@identifier = b_doi || m.fetch("id", nil) || m.fetch("identifier", nil)
|
53
|
-
|
54
|
-
m
|
55
|
-
end
|
56
|
-
|
57
96
|
def type
|
58
97
|
@type ||= meta.fetch("type", nil)
|
59
98
|
end
|
@@ -256,6 +295,14 @@ module Bolognese
|
|
256
295
|
relation_types.reduce([]) { |sum, r| sum += related_identifier_hsh(r) }
|
257
296
|
end
|
258
297
|
|
298
|
+
def b_url
|
299
|
+
@b_url ||= meta.fetch("b_url", nil)
|
300
|
+
end
|
301
|
+
|
302
|
+
def b_version
|
303
|
+
@b_version ||= meta.fetch("b_version", nil)
|
304
|
+
end
|
305
|
+
|
259
306
|
# recognize given name. Can be loaded once as ::NameDetector, e.g. in a Rails initializer
|
260
307
|
def name_detector
|
261
308
|
@name_detector ||= defined?(::NameDetector) ? ::NameDetector : nil
|
@@ -283,11 +330,11 @@ module Bolognese
|
|
283
330
|
end
|
284
331
|
|
285
332
|
def style
|
286
|
-
@style
|
333
|
+
@style ||= "apa"
|
287
334
|
end
|
288
335
|
|
289
336
|
def locale
|
290
|
-
@locale
|
337
|
+
@locale ||= "en-US"
|
291
338
|
end
|
292
339
|
end
|
293
340
|
end
|
data/lib/bolognese/version.rb
CHANGED