enju_ndl 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/enju_ndl/ndl_search.rb +29 -3
- data/lib/enju_ndl/version.rb +1 -1
- metadata +21 -21
data/lib/enju_ndl/ndl_search.rb
CHANGED
@@ -24,7 +24,7 @@ module EnjuNdl
|
|
24
24
|
manifestation = Manifestation.where(:nbn => nbn).first if nbn
|
25
25
|
return manifestation if manifestation
|
26
26
|
|
27
|
-
publishers = get_publishers(doc)
|
27
|
+
publishers = get_publishers(doc)
|
28
28
|
|
29
29
|
# title
|
30
30
|
title = get_title(doc)
|
@@ -70,6 +70,8 @@ module EnjuNdl
|
|
70
70
|
description = doc.at('//dcterms:abstract').try(:content)
|
71
71
|
price = doc.at('//dcndl:price').try(:content)
|
72
72
|
volume_number_string = doc.at('//dcndl:volume/rdf:Description/rdf:value').try(:content)
|
73
|
+
extent = get_extent(doc)
|
74
|
+
|
73
75
|
manifestation = nil
|
74
76
|
Patron.transaction do
|
75
77
|
publisher_patrons = Patron.import_patrons(publishers)
|
@@ -88,6 +90,9 @@ module EnjuNdl
|
|
88
90
|
:volume_number_string => volume_number_string,
|
89
91
|
:price => price,
|
90
92
|
:nbn => nbn,
|
93
|
+
:start_page => extent[:start_page],
|
94
|
+
:end_page => extent[:end_page],
|
95
|
+
:height => extent[:height],
|
91
96
|
:ndc => ndc
|
92
97
|
)
|
93
98
|
manifestation.carrier_type = carrier_type if carrier_type
|
@@ -203,12 +208,33 @@ module EnjuNdl
|
|
203
208
|
|
204
209
|
def get_publishers(doc)
|
205
210
|
publishers = []
|
206
|
-
doc.xpath('//dcterms:publisher/foaf:Agent
|
207
|
-
publishers <<
|
211
|
+
doc.xpath('//dcterms:publisher/foaf:Agent').each do |publisher|
|
212
|
+
publishers << {
|
213
|
+
:full_name => publisher.at('./foaf:name').content,
|
214
|
+
:full_name_transcription => publisher.at('./dcndl:transcription').try(:content)
|
215
|
+
}
|
208
216
|
end
|
209
217
|
return publishers
|
210
218
|
end
|
211
219
|
|
220
|
+
def get_extent(doc)
|
221
|
+
extent = doc.at('//dcterms:extent').try(:content)
|
222
|
+
value = {:start_page => nil, :end_page => nil, :height => nil}
|
223
|
+
if extent
|
224
|
+
extent = extent.split(';')
|
225
|
+
page = extent[0].try(:strip)
|
226
|
+
if page =~ /\d+p/
|
227
|
+
value[:start_page] = 1
|
228
|
+
value[:end_page] = page.to_i
|
229
|
+
end
|
230
|
+
height = extent[1].try(:strip)
|
231
|
+
if height =~ /\d+cm/
|
232
|
+
value[:height] = height.to_i
|
233
|
+
end
|
234
|
+
end
|
235
|
+
value
|
236
|
+
end
|
237
|
+
|
212
238
|
def create_series_statement(doc, manifestation)
|
213
239
|
series = series_title = {}
|
214
240
|
series[:title] = doc.at('//dcndl:seriesTitle/rdf:Description/rdf:value').try(:content)
|
data/lib/enju_ndl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_ndl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70096488387820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '3.
|
21
|
+
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70096488387820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: devise
|
27
|
-
requirement: &
|
27
|
+
requirement: &70096488387400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70096488387400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &70096488386940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70096488386940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: will_paginate
|
49
|
-
requirement: &
|
49
|
+
requirement: &70096488386440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70096488386440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: acts_as_list
|
60
|
-
requirement: &
|
60
|
+
requirement: &70096488386020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70096488386020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: attribute_normalizer
|
71
|
-
requirement: &
|
71
|
+
requirement: &70096488385560 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70096488385560
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: library_stdnums
|
82
|
-
requirement: &
|
82
|
+
requirement: &70096488385140 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70096488385140
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: sqlite3
|
93
|
-
requirement: &
|
93
|
+
requirement: &70096488384720 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70096488384720
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rspec-rails
|
104
|
-
requirement: &
|
104
|
+
requirement: &70096488384300 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70096488384300
|
113
113
|
description: NDL WebAPI wrapper for Next-L Enju
|
114
114
|
email:
|
115
115
|
- tanabe@mwr.mediacom.keio.ac.jp
|