cul-fedora 0.8.3 → 0.8.4
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.
- data/VERSION +1 -1
- data/cul-fedora.gemspec +2 -2
- data/lib/cul-fedora/item.rb +39 -11
- data/lib/cul-fedora/solr.rb +4 -1
- metadata +4 -4
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.
|
|
1
|
+
0.8.4
|
data/cul-fedora.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{cul-fedora}
|
|
8
|
-
s.version = "0.8.
|
|
8
|
+
s.version = "0.8.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["James Stuart"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-07-11}
|
|
13
13
|
s.description = %q{Columbia-specific Fedora libraries}
|
|
14
14
|
s.email = %q{tastyhat@jamesstuart.org}
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/cul-fedora/item.rb
CHANGED
|
@@ -117,8 +117,9 @@ module Cul
|
|
|
117
117
|
|
|
118
118
|
get_fullname = lambda { |node| node.nil? ? nil : (node.css("namePart[@type='family']").collect(&:content) | node.css("namePart[@type='given']").collect(&:content)).join(", ") }
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
author_roles = ["author","creator","editor","speaker","moderator","interviewee","interviewer","contributor"]
|
|
121
|
+
other_name_roles = ["thesis advisor"]
|
|
122
|
+
corporate_author_roles = ["author"]
|
|
122
123
|
|
|
123
124
|
organizations = []
|
|
124
125
|
departments = []
|
|
@@ -154,19 +155,31 @@ module Cul
|
|
|
154
155
|
add_field.call("title_display", title)
|
|
155
156
|
add_field.call("title_search", title_search)
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
all_author_names = []
|
|
158
159
|
mods.css("name[@type='personal']").each do |name_node|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
|
|
161
|
+
fullname = get_fullname.call(name_node)
|
|
162
|
+
note_org = false
|
|
163
|
+
|
|
164
|
+
if name_node.css("role>roleTerm").collect(&:content).any? { |role| author_roles.include?(role) }
|
|
165
|
+
|
|
166
|
+
note_org = true
|
|
167
|
+
all_author_names << fullname
|
|
164
168
|
if(!name_node["ID"].nil?)
|
|
165
169
|
add_field.call("author_id_uni", name_node["ID"])
|
|
166
170
|
end
|
|
167
171
|
add_field.call("author_search", fullname.downcase)
|
|
168
172
|
add_field.call("author_facet", fullname)
|
|
169
|
-
|
|
173
|
+
|
|
174
|
+
elsif name_node.css("role>roleTerm").collect(&:content).any? { |role| other_name_roles.include?(role) }
|
|
175
|
+
|
|
176
|
+
note_org = true
|
|
177
|
+
first_role = name_node.at_css("role>roleTerm").text
|
|
178
|
+
add_field.call(first_role.gsub(/\s/, '_'), fullname)
|
|
179
|
+
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if (note_org == true)
|
|
170
183
|
name_node.css("affiliation").each do |affiliation_node|
|
|
171
184
|
affiliation_text = affiliation_node.text
|
|
172
185
|
if(affiliation_text.include?(". "))
|
|
@@ -175,8 +188,8 @@ module Cul
|
|
|
175
188
|
departments.push(affiliation_split[1].strip)
|
|
176
189
|
end
|
|
177
190
|
end
|
|
178
|
-
|
|
179
191
|
end
|
|
192
|
+
|
|
180
193
|
end
|
|
181
194
|
|
|
182
195
|
mods.css("name[@type='corporate']").each do |corp_name_node|
|
|
@@ -188,9 +201,20 @@ module Cul
|
|
|
188
201
|
departments.push(name_part_split[1].strip)
|
|
189
202
|
end
|
|
190
203
|
end
|
|
204
|
+
if corp_name_node.css("role>roleTerm").collect(&:content).any? { |role| corporate_author_roles.include?(role) }
|
|
205
|
+
display_form = corp_name_node.at_css("displayForm")
|
|
206
|
+
if(!display_form.nil?)
|
|
207
|
+
fullname = display_form.text
|
|
208
|
+
else
|
|
209
|
+
fullname = corp_name_node.at_css("namePart").text
|
|
210
|
+
end
|
|
211
|
+
all_author_names << fullname
|
|
212
|
+
add_field.call("author_search", fullname.downcase)
|
|
213
|
+
add_field.call("author_facet", fullname)
|
|
214
|
+
end
|
|
191
215
|
end
|
|
192
216
|
|
|
193
|
-
add_field.call("authors_display",
|
|
217
|
+
add_field.call("authors_display",all_author_names.join("; "))
|
|
194
218
|
add_field.call("pub_date", mods.at_css("*[@keyDate='yes']"))
|
|
195
219
|
|
|
196
220
|
mods.css("genre").each do |genre_node|
|
|
@@ -234,6 +258,10 @@ module Cul
|
|
|
234
258
|
|
|
235
259
|
add_field.call("issn", related_host.at_css("identifier[@type='issn']"))
|
|
236
260
|
end
|
|
261
|
+
|
|
262
|
+
if(related_series = mods.at_css("relatedItem[@type='series']"))
|
|
263
|
+
add_field.call("series", related_series.at_css("titleInfo>title"))
|
|
264
|
+
end
|
|
237
265
|
|
|
238
266
|
add_field.call("publisher", mods.at_css("relatedItem>originInfo>publisher"))
|
|
239
267
|
add_field.call("publisher_location", mods.at_css("relatedItem > originInfo>place>placeTerm[@type='text']"))
|
data/lib/cul-fedora/solr.rb
CHANGED
|
@@ -66,6 +66,8 @@ module Cul
|
|
|
66
66
|
process = options.delete(:process) || nil
|
|
67
67
|
skip = options.delete(:skip) || nil
|
|
68
68
|
|
|
69
|
+
processed_successfully = 0
|
|
70
|
+
|
|
69
71
|
if delete == true
|
|
70
72
|
delete_removed(fedora_server)
|
|
71
73
|
end
|
|
@@ -110,6 +112,7 @@ module Cul
|
|
|
110
112
|
case result_hash[:status]
|
|
111
113
|
when :success
|
|
112
114
|
to_add << result_hash[:results]
|
|
115
|
+
processed_successfully += 1
|
|
113
116
|
when :error
|
|
114
117
|
errors[i.pid] = result_hash[:error_message]
|
|
115
118
|
end
|
|
@@ -136,7 +139,7 @@ module Cul
|
|
|
136
139
|
logger.info "Committing changes to Solr..."
|
|
137
140
|
rsolr.commit
|
|
138
141
|
|
|
139
|
-
return {:results => results, :errors => errors}
|
|
142
|
+
return {:results => results, :errors => errors, :processed_successfully => processed_successfully}
|
|
140
143
|
|
|
141
144
|
end
|
|
142
145
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cul-fedora
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 55
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 8
|
|
9
|
-
-
|
|
10
|
-
version: 0.8.
|
|
9
|
+
- 4
|
|
10
|
+
version: 0.8.4
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- James Stuart
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-07-11 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|