bibtex-ruby 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bibtex-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +7 -1
- data/lib/bibtex/entry/rdf_converter.rb +43 -37
- data/lib/bibtex/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dfbf77f5cb8ff87f6e54b9ebdb9f4426ff10486
|
4
|
+
data.tar.gz: a2bf09bd352b691ff2c61d35374994bc100d23a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19357e079e206da98bdcb1486f56b26de608d98dbcf0ba49b840f7e038b68f000ed3a038a55183396423fa5bc75ef5e748f929fba1745ab67ef62366056c021
|
7
|
+
data.tar.gz: cc471fc94d1b2b0101d8ea35b8fe439b4a0d08dfd42a935881e2d07c1b22d750697552b83c3ee0ea71c8a8ddcfaba85af82cfebc47aa1f9702078630859b11fb
|
data/Gemfile
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem 'rdf', '~>1.1'
|
5
4
|
gem 'json', '~>1.8', :platforms => [:mri_18, :jruby, :rbx]
|
6
5
|
|
6
|
+
if RUBY_VERSION >= '2.0'
|
7
|
+
gem 'rdf', '~>2.0'
|
8
|
+
gem 'rdf-vocab', '~>2.0'
|
9
|
+
else
|
10
|
+
gem 'rdf', '~>1.1'
|
11
|
+
end
|
12
|
+
|
7
13
|
gem 'rubysl', '~>2.0', :platforms => :rbx
|
8
14
|
|
9
15
|
group :debug do
|
@@ -1,5 +1,11 @@
|
|
1
1
|
require 'uri/common'
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'rdf/vocab'
|
5
|
+
rescue LoadError
|
6
|
+
::RDF::Vocab = RDF # support RDF on Ruby 1.9
|
7
|
+
end
|
8
|
+
|
3
9
|
class BibTeX::Entry::RDFConverter
|
4
10
|
DEFAULT_REMOVE_FROM_FALLBACK = %w(
|
5
11
|
bdsk-file-1
|
@@ -62,7 +68,7 @@ class BibTeX::Entry::RDFConverter
|
|
62
68
|
return unless bibtex.field?(:abstract)
|
63
69
|
remove_from_fallback(:abstract)
|
64
70
|
|
65
|
-
graph << [entry, RDF::DC.abstract, bibtex[:abstract].to_s]
|
71
|
+
graph << [entry, RDF::Vocab::DC.abstract, bibtex[:abstract].to_s]
|
66
72
|
graph << [entry, bibo[:abstract], bibtex[:abstract].to_s]
|
67
73
|
end
|
68
74
|
|
@@ -89,7 +95,7 @@ class BibTeX::Entry::RDFConverter
|
|
89
95
|
bibtex[:author].each do |name|
|
90
96
|
node = agent(name) { create_agent(name, :Person) }
|
91
97
|
|
92
|
-
graph << [entry, RDF::DC.creator, node]
|
98
|
+
graph << [entry, RDF::Vocab::DC.creator, node]
|
93
99
|
graph << [seq, RDF.li, node]
|
94
100
|
end
|
95
101
|
end
|
@@ -99,7 +105,7 @@ class BibTeX::Entry::RDFConverter
|
|
99
105
|
while bibtex.field?("bdsk-url-#{count}".to_sym) do
|
100
106
|
field = "bdsk-url-#{count}".to_sym
|
101
107
|
remove_from_fallback(field)
|
102
|
-
graph << [entry, RDF::DC.URI, bibtex[field].to_s]
|
108
|
+
graph << [entry, RDF::Vocab::DC.URI, bibtex[field].to_s]
|
103
109
|
graph << [entry, bibo[:uri], bibtex[field].to_s]
|
104
110
|
count += 1
|
105
111
|
end
|
@@ -118,9 +124,9 @@ class BibTeX::Entry::RDFConverter
|
|
118
124
|
|
119
125
|
series = RDF::Node.new
|
120
126
|
graph << [series, RDF.type, bibo[:Document]]
|
121
|
-
graph << [series, RDF::DC.title, bibtex[:booktitle].to_s]
|
127
|
+
graph << [series, RDF::Vocab::DC.title, bibtex[:booktitle].to_s]
|
122
128
|
|
123
|
-
graph << [entry, RDF::DC.isPartOf, series]
|
129
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, series]
|
124
130
|
end
|
125
131
|
|
126
132
|
def chapter
|
@@ -136,7 +142,7 @@ class BibTeX::Entry::RDFConverter
|
|
136
142
|
bibtex.children.each do |child|
|
137
143
|
child_id = RDF::URI.new(child.identifier)
|
138
144
|
BibTeX::Entry::RDFConverter.new(child, graph, agent).convert! unless uri_in_graph?(child_id)
|
139
|
-
graph << [entry, RDF::DC.hasPart, child_id]
|
145
|
+
graph << [entry, RDF::Vocab::DC.hasPart, child_id]
|
140
146
|
end
|
141
147
|
end
|
142
148
|
|
@@ -144,21 +150,21 @@ class BibTeX::Entry::RDFConverter
|
|
144
150
|
return unless bibtex.field?(:copyright)
|
145
151
|
remove_from_fallback(:copyright)
|
146
152
|
|
147
|
-
graph << [entry, RDF::DC.rightsHolder, bibtex[:copyright].to_s]
|
153
|
+
graph << [entry, RDF::Vocab::DC.rightsHolder, bibtex[:copyright].to_s]
|
148
154
|
end
|
149
155
|
|
150
156
|
def date_added
|
151
157
|
return unless bibtex.field?(:'date-added')
|
152
158
|
remove_from_fallback(:'date-added')
|
153
159
|
|
154
|
-
graph << [entry, RDF::DC.created, bibtex[:'date-added'].to_s]
|
160
|
+
graph << [entry, RDF::Vocab::DC.created, bibtex[:'date-added'].to_s]
|
155
161
|
end
|
156
162
|
|
157
163
|
def date_modified
|
158
164
|
return unless bibtex.field?(:'date-modified')
|
159
165
|
remove_from_fallback(:'date-modified')
|
160
166
|
|
161
|
-
graph << [entry, RDF::DC.modified, bibtex[:'date-modified'].to_s]
|
167
|
+
graph << [entry, RDF::Vocab::DC.modified, bibtex[:'date-modified'].to_s]
|
162
168
|
end
|
163
169
|
|
164
170
|
def doi
|
@@ -166,7 +172,7 @@ class BibTeX::Entry::RDFConverter
|
|
166
172
|
remove_from_fallback(:doi)
|
167
173
|
|
168
174
|
graph << [entry, bibo[:doi], bibtex[:doi].to_s]
|
169
|
-
graph << [entry, RDF::DC.identifier, "doi:#{bibtex[:doi].to_s}"]
|
175
|
+
graph << [entry, RDF::Vocab::DC.identifier, "doi:#{bibtex[:doi].to_s}"]
|
170
176
|
end
|
171
177
|
|
172
178
|
def edition
|
@@ -202,7 +208,7 @@ class BibTeX::Entry::RDFConverter
|
|
202
208
|
return unless bibtex[:howpublished] =~ /^#{URI.regexp}$/
|
203
209
|
remove_from_fallback(:howpublished)
|
204
210
|
|
205
|
-
graph << [entry, RDF::DC.URI, bibtex[:howpublished].to_s]
|
211
|
+
graph << [entry, RDF::Vocab::DC.URI, bibtex[:howpublished].to_s]
|
206
212
|
graph << [entry, bibo[:uri], bibtex[:howpublished].to_s]
|
207
213
|
end
|
208
214
|
|
@@ -212,7 +218,7 @@ class BibTeX::Entry::RDFConverter
|
|
212
218
|
|
213
219
|
org = agent(bibtex[:institution].to_s) { create_agent(bibtex[:institution].to_s, :Organization) }
|
214
220
|
|
215
|
-
graph << [entry, RDF::DC.contributor, org]
|
221
|
+
graph << [entry, RDF::Vocab::DC.contributor, org]
|
216
222
|
end
|
217
223
|
|
218
224
|
def isbn
|
@@ -222,9 +228,9 @@ class BibTeX::Entry::RDFConverter
|
|
222
228
|
graph << [entry, bibo[:isbn], bibtex[:isbn].to_s]
|
223
229
|
|
224
230
|
if bibtex.contained?
|
225
|
-
graph << [entry, RDF::DC.isPartOf, "urn:isbn:#{bibtex[:isbn].to_s}"]
|
231
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, "urn:isbn:#{bibtex[:isbn].to_s}"]
|
226
232
|
else
|
227
|
-
graph << [entry, RDF::DC.identifier, "urn:isbn:#{bibtex[:isbn].to_s}"]
|
233
|
+
graph << [entry, RDF::Vocab::DC.identifier, "urn:isbn:#{bibtex[:isbn].to_s}"]
|
228
234
|
end
|
229
235
|
end
|
230
236
|
|
@@ -234,9 +240,9 @@ class BibTeX::Entry::RDFConverter
|
|
234
240
|
|
235
241
|
graph << [entry, bibo[:issn], bibtex[:issn].to_s]
|
236
242
|
if bibtex.contained?
|
237
|
-
graph << [entry, RDF::DC.isPartOf, "urn:issn:#{bibtex[:issn].to_s}"]
|
243
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, "urn:issn:#{bibtex[:issn].to_s}"]
|
238
244
|
else
|
239
|
-
graph << [entry, RDF::DC.identifier, "urn:issn:#{bibtex[:issn].to_s}"]
|
245
|
+
graph << [entry, RDF::Vocab::DC.identifier, "urn:issn:#{bibtex[:issn].to_s}"]
|
240
246
|
end
|
241
247
|
end
|
242
248
|
|
@@ -250,7 +256,7 @@ class BibTeX::Entry::RDFConverter
|
|
250
256
|
source << "No. #{bibtex[:number].to_s}" if bibtex.field?(:number)
|
251
257
|
pagination = bibtex[:pagination] || 'pp.'
|
252
258
|
source << "#{pagination.to_s} #{bibtex[:pages].to_s}" if bibtex.field?(:pages)
|
253
|
-
graph << [entry, RDF::DC.source, source.join(', ')]
|
259
|
+
graph << [entry, RDF::Vocab::DC.source, source.join(', ')]
|
254
260
|
end
|
255
261
|
|
256
262
|
def journal_dc_part_of
|
@@ -260,13 +266,13 @@ class BibTeX::Entry::RDFConverter
|
|
260
266
|
|
261
267
|
journal = RDF::Node.new
|
262
268
|
graph << [journal, RDF.type, bibo[:Journal]]
|
263
|
-
graph << [journal, RDF::DC.title, bibtex[:journal].to_s]
|
269
|
+
graph << [journal, RDF::Vocab::DC.title, bibtex[:journal].to_s]
|
264
270
|
|
265
|
-
graph << [entry, RDF::DC.isPartOf, journal]
|
271
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, journal]
|
266
272
|
end
|
267
273
|
|
268
274
|
def key
|
269
|
-
graph << [entry, RDF::DC.identifier, "urn:bibtex:#{bibtex.key}"]
|
275
|
+
graph << [entry, RDF::Vocab::DC.identifier, "urn:bibtex:#{bibtex.key}"]
|
270
276
|
end
|
271
277
|
|
272
278
|
def keywords
|
@@ -274,7 +280,7 @@ class BibTeX::Entry::RDFConverter
|
|
274
280
|
remove_from_fallback(:keywords)
|
275
281
|
|
276
282
|
bibtex[:keywords].to_s.split(/\s*[,;]\s*/).each do |keyword|
|
277
|
-
graph << [entry, RDF::DC.subject, keyword]
|
283
|
+
graph << [entry, RDF::Vocab::DC.subject, keyword]
|
278
284
|
end
|
279
285
|
end
|
280
286
|
|
@@ -284,14 +290,14 @@ class BibTeX::Entry::RDFConverter
|
|
284
290
|
|
285
291
|
bibtex[:language] = 'german' if bibtex[:language] == 'ngerman'
|
286
292
|
|
287
|
-
graph << [entry, RDF::DC.language, bibtex[:language].to_s]
|
293
|
+
graph << [entry, RDF::Vocab::DC.language, bibtex[:language].to_s]
|
288
294
|
end
|
289
295
|
|
290
296
|
def location
|
291
297
|
return unless bibtex.field?(:location)
|
292
298
|
remove_from_fallback(:location)
|
293
299
|
|
294
|
-
graph << [entry, RDF::DC.Location, bibtex[:location].to_s]
|
300
|
+
graph << [entry, RDF::Vocab::DC.Location, bibtex[:location].to_s]
|
295
301
|
if [:proceedings, :inproceedings, :conference].include?(bibtex.type)
|
296
302
|
event = RDF::Vocabulary.new('http://purl.org/NET/c4dm/event.owl')
|
297
303
|
graph << [entry, event[:place], org]
|
@@ -334,7 +340,7 @@ class BibTeX::Entry::RDFConverter
|
|
334
340
|
|
335
341
|
org = agent(bibtex[:organization].to_s) { create_agent(bibtex[:organization].to_s, :Organization) }
|
336
342
|
|
337
|
-
graph << [entry, RDF::DC.contributor, org]
|
343
|
+
graph << [entry, RDF::Vocab::DC.contributor, org]
|
338
344
|
graph << [entry, bibo[:organizer], org] if [:proceedings, :inproceedings, :conference].include?(bibtex.type)
|
339
345
|
end
|
340
346
|
|
@@ -363,7 +369,7 @@ class BibTeX::Entry::RDFConverter
|
|
363
369
|
|
364
370
|
parent_id = RDF::URI.new(bibtex.parent.identifier)
|
365
371
|
BibTeX::Entry::RDFConverter.new(bibtex.parent, graph, agent).convert! unless uri_in_graph?(parent_id)
|
366
|
-
graph << [entry, RDF::DC.isPartOf, parent_id]
|
372
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, parent_id]
|
367
373
|
end
|
368
374
|
|
369
375
|
def publisher
|
@@ -387,7 +393,7 @@ class BibTeX::Entry::RDFConverter
|
|
387
393
|
graph << [org, address[:localityName], bibtex[:address]]
|
388
394
|
end
|
389
395
|
|
390
|
-
graph << [entry, RDF::DC.publisher, org]
|
396
|
+
graph << [entry, RDF::Vocab::DC.publisher, org]
|
391
397
|
graph << [entry, bibo[:publisher], org]
|
392
398
|
end
|
393
399
|
|
@@ -397,7 +403,7 @@ class BibTeX::Entry::RDFConverter
|
|
397
403
|
|
398
404
|
org = agent(bibtex[:school].to_s) { create_agent(bibtex[:school].to_s, :Organization) }
|
399
405
|
|
400
|
-
graph << [entry, RDF::DC.contributor, org]
|
406
|
+
graph << [entry, RDF::Vocab::DC.contributor, org]
|
401
407
|
end
|
402
408
|
|
403
409
|
def series
|
@@ -409,9 +415,9 @@ class BibTeX::Entry::RDFConverter
|
|
409
415
|
|
410
416
|
series = RDF::Node.new
|
411
417
|
graph << [series, RDF.type, bibo[:MultiVolumeBook]]
|
412
|
-
graph << [series, RDF::DC.title, bibtex[:series].to_s]
|
418
|
+
graph << [series, RDF::Vocab::DC.title, bibtex[:series].to_s]
|
413
419
|
|
414
|
-
graph << [entry, RDF::DC.isPartOf, series]
|
420
|
+
graph << [entry, RDF::Vocab::DC.isPartOf, series]
|
415
421
|
end
|
416
422
|
|
417
423
|
def thesis_degree
|
@@ -449,7 +455,7 @@ class BibTeX::Entry::RDFConverter
|
|
449
455
|
title = [bibtex[:title].to_s, bibtex[:subtitle].to_s]
|
450
456
|
.reject { |t| t.nil? || t.empty? }
|
451
457
|
.join(': ')
|
452
|
-
graph << [entry, RDF::DC.title, title]
|
458
|
+
graph << [entry, RDF::Vocab::DC.title, title]
|
453
459
|
graph << [entry, bibo[:shortTitle], bibtex[:title].to_s] if bibtex.field?(:subtitle)
|
454
460
|
end
|
455
461
|
|
@@ -461,7 +467,7 @@ class BibTeX::Entry::RDFConverter
|
|
461
467
|
create_agent(bibtex[:translator].to_s, :Person)
|
462
468
|
end
|
463
469
|
|
464
|
-
graph << [entry, RDF::DC.contributor, node]
|
470
|
+
graph << [entry, RDF::Vocab::DC.contributor, node]
|
465
471
|
graph << [entry, bibo[:translator], node]
|
466
472
|
end
|
467
473
|
|
@@ -470,9 +476,9 @@ class BibTeX::Entry::RDFConverter
|
|
470
476
|
|
471
477
|
case bibtex.type
|
472
478
|
when :proceedings, :journal
|
473
|
-
graph << [entry, RDF::DC.type, 'Collection']
|
479
|
+
graph << [entry, RDF::Vocab::DC.type, 'Collection']
|
474
480
|
else
|
475
|
-
graph << [entry, RDF::DC.type, 'Text']
|
481
|
+
graph << [entry, RDF::Vocab::DC.type, 'Text']
|
476
482
|
end
|
477
483
|
end
|
478
484
|
|
@@ -480,7 +486,7 @@ class BibTeX::Entry::RDFConverter
|
|
480
486
|
return unless bibtex.field?(:url)
|
481
487
|
remove_from_fallback(:url)
|
482
488
|
|
483
|
-
graph << [entry, RDF::DC.URI, bibtex[:url].to_s]
|
489
|
+
graph << [entry, RDF::Vocab::DC.URI, bibtex[:url].to_s]
|
484
490
|
graph << [entry, bibo[:uri], bibtex[:url].to_s]
|
485
491
|
end
|
486
492
|
|
@@ -509,7 +515,7 @@ class BibTeX::Entry::RDFConverter
|
|
509
515
|
end
|
510
516
|
date = month.nil? ? year : [year, month].join('-')
|
511
517
|
|
512
|
-
graph << [entry, RDF::DC.issued, date]
|
518
|
+
graph << [entry, RDF::Vocab::DC.issued, date]
|
513
519
|
end
|
514
520
|
|
515
521
|
protected
|
@@ -542,8 +548,8 @@ class BibTeX::Entry::RDFConverter
|
|
542
548
|
def create_agent(name, type)
|
543
549
|
node = RDF::Node.new
|
544
550
|
|
545
|
-
graph << [node, RDF.type, RDF::FOAF[type]]
|
546
|
-
graph << [node, RDF::FOAF.name, name.to_s]
|
551
|
+
graph << [node, RDF.type, RDF::Vocab::FOAF[type]]
|
552
|
+
graph << [node, RDF::Vocab::FOAF.name, name.to_s]
|
547
553
|
|
548
554
|
if name.is_a?(BibTeX::Name)
|
549
555
|
[:given, :family, :prefix, :suffix].each do |part|
|
data/lib/bibtex/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibtex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: latex-decode
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.0'
|
27
27
|
description: |
|
@@ -135,33 +135,33 @@ require_paths:
|
|
135
135
|
- lib
|
136
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - '>='
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.2.2
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: A BibTeX parser, converter and API for Ruby.
|
152
152
|
test_files:
|
153
|
-
- test/bibtex/
|
153
|
+
- test/bibtex/entry/test_rdf_converter.rb
|
154
|
+
- test/bibtex/test_bibliography.rb
|
155
|
+
- test/bibtex/test_elements.rb
|
156
|
+
- test/bibtex/test_entry.rb
|
157
|
+
- test/bibtex/test_filters.rb
|
154
158
|
- test/bibtex/test_lexer.rb
|
159
|
+
- test/bibtex/test_name_parser.rb
|
155
160
|
- test/bibtex/test_names.rb
|
156
161
|
- test/bibtex/test_parser.rb
|
157
|
-
- test/bibtex/test_bibliography.rb
|
158
|
-
- test/bibtex/test_filters.rb
|
159
|
-
- test/bibtex/test_utilities.rb
|
160
162
|
- test/bibtex/test_string.rb
|
161
|
-
- test/bibtex/
|
162
|
-
- test/bibtex/
|
163
|
-
- test/bibtex/test_elements.rb
|
164
|
-
- test/bibtex/entry/test_rdf_converter.rb
|
163
|
+
- test/bibtex/test_utilities.rb
|
164
|
+
- test/bibtex/test_value.rb
|
165
165
|
- test/test_bibtex.rb
|
166
166
|
- test/test_export.rb
|
167
167
|
has_rdoc: yard
|