mods 2.4.1 → 3.0.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +24 -0
- data/.gitignore +1 -0
- data/README.md +0 -1
- data/lib/mods/date.rb +54 -17
- data/lib/mods/marc_country_codes.rb +12 -10
- data/lib/mods/nom_terminology.rb +109 -845
- data/lib/mods/reader.rb +9 -39
- data/lib/mods/record.rb +13 -28
- data/lib/mods/version.rb +1 -1
- data/mods.gemspec +2 -2
- data/spec/fixture_data/hp566jq8781.xml +334 -0
- data/spec/integration/parker_spec.rb +217 -0
- data/spec/{date_spec.rb → lib/date_spec.rb} +9 -1
- data/spec/lib/language_spec.rb +123 -0
- data/spec/lib/location_spec.rb +175 -0
- data/spec/lib/name_spec.rb +368 -0
- data/spec/lib/origin_info_spec.rb +134 -0
- data/spec/lib/part_spec.rb +162 -0
- data/spec/lib/physical_description_spec.rb +72 -0
- data/spec/{reader_spec.rb → lib/reader_spec.rb} +1 -41
- data/spec/lib/record_info_spec.rb +114 -0
- data/spec/lib/record_spec.rb +287 -0
- data/spec/lib/related_item_spec.rb +124 -0
- data/spec/lib/subject_spec.rb +427 -0
- data/spec/lib/title_spec.rb +108 -0
- data/spec/lib/top_level_elmnts_simple_spec.rb +169 -0
- data/spec/spec_helper.rb +86 -5
- data/spec/support/fixtures.rb +9 -0
- metadata +49 -44
- data/.travis.yml +0 -16
- data/spec/language_spec.rb +0 -118
- data/spec/location_spec.rb +0 -295
- data/spec/name_spec.rb +0 -759
- data/spec/origin_info_spec.rb +0 -447
- data/spec/part_spec.rb +0 -471
- data/spec/physical_description_spec.rb +0 -144
- data/spec/record_info_spec.rb +0 -493
- data/spec/record_spec.rb +0 -356
- data/spec/related_item_spec.rb +0 -305
- data/spec/subject_spec.rb +0 -809
- data/spec/title_spec.rb +0 -226
- data/spec/top_level_elmnts_simple_spec.rb +0 -369
data/lib/mods/nom_terminology.rb
CHANGED
@@ -16,6 +16,13 @@ module Mods
|
|
16
16
|
|
17
17
|
class Record
|
18
18
|
|
19
|
+
def with_attributes(element, attributes = [], method_mappings: { 'type' => 'type_at', 'ID' => 'id_at' })
|
20
|
+
attributes.each do |attr_name|
|
21
|
+
attr_method = method_mappings.fetch(attr_name, attr_name)
|
22
|
+
element.send attr_method, path: "@#{attr_name}", accessor: lambda { |a| a.text }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
# set the NOM terminology; WITH namespaces
|
20
27
|
# NOTES:
|
21
28
|
# 1. certain words, such as 'type' 'name' 'description' are reserved words in jruby or nokogiri
|
@@ -27,80 +34,47 @@ module Mods
|
|
27
34
|
def set_terminology_ns(mods_ng_xml)
|
28
35
|
mods_ng_xml.set_terminology(:namespaces => { 'm' => Mods::MODS_NS }) do |t|
|
29
36
|
|
30
|
-
# FIXME: may want to deal with camelcase vs. underscore in method_missing
|
31
|
-
|
32
37
|
# ABSTRACT -------------------------------------------------------------------------------
|
33
38
|
t.abstract :path => '/m:mods/m:abstract'
|
34
39
|
t._abstract :path => '//m:abstract' do |n|
|
35
|
-
n
|
36
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
37
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
38
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
39
|
-
}
|
40
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel type])
|
40
41
|
end
|
41
42
|
|
42
43
|
# ACCESS_CONDITION -----------------------------------------------------------------------
|
43
44
|
t.accessCondition :path => '/m:mods/m:accessCondition'
|
44
45
|
t._accessCondition :path => '//m:accessCondition' do |n|
|
45
|
-
n
|
46
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
47
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
48
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
49
|
-
}
|
46
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel type])
|
50
47
|
end
|
51
48
|
|
52
49
|
# CLASSIFICATION -------------------------------------------------------------------------
|
53
50
|
t.classification :path => '/m:mods/m:classification'
|
54
51
|
t._classification :path => '//m:classification' do |n|
|
55
|
-
n
|
56
|
-
n.edition :path => '@edition', :accessor => lambda { |a| a.text }
|
57
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
58
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
59
|
-
}
|
60
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
61
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
62
|
-
}
|
52
|
+
with_attributes(n, Mods::AUTHORITY_ATTRIBS | Mods::LANG_ATTRIBS | %w[displayLabel edition])
|
63
53
|
end
|
64
54
|
|
65
55
|
# EXTENSION ------------------------------------------------------------------------------
|
66
56
|
t.extension :path => '/m:mods/m:extension'
|
67
57
|
t._extension :path => '//m:extension' do |n|
|
68
|
-
n
|
58
|
+
with_attributes(n, %w[displayLabel])
|
69
59
|
end
|
70
60
|
|
71
61
|
# GENRE ----------------------------------------------------------------------------------
|
72
62
|
t.genre :path => '/m:mods/m:genre'
|
73
63
|
t._genre :path => '//m:genre' do |n|
|
74
|
-
n
|
75
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
76
|
-
n.usage :path => '@usage', :accessor => lambda { |a| a.text }
|
77
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
78
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
79
|
-
}
|
80
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
81
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
82
|
-
}
|
64
|
+
with_attributes(n, Mods::AUTHORITY_ATTRIBS | Mods::LANG_ATTRIBS | %w[displayLabel type usage])
|
83
65
|
end
|
84
66
|
|
85
67
|
# IDENTIIER ------------------------------------------------------------------------------
|
86
68
|
t.identifier :path => '/m:mods/m:identifier'
|
87
69
|
t._identifier :path => '//m:identifier' do |n|
|
88
|
-
n
|
89
|
-
n.invalid :path => '@invalid', :accessor => lambda { |a| a.text }
|
90
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
91
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
92
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
93
|
-
}
|
70
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel type invalid])
|
94
71
|
end
|
95
72
|
|
96
73
|
# LANGUAGE -------------------------------------------------------------------------------
|
97
74
|
t.language :path => '/m:mods/m:language'
|
98
75
|
t._language :path => '//m:language' do |n|
|
99
76
|
# attributes
|
100
|
-
n
|
101
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
102
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
103
|
-
}
|
77
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel])
|
104
78
|
# child elements
|
105
79
|
n.languageTerm :path => 'm:languageTerm'
|
106
80
|
n.code_term :path => 'm:languageTerm[@type="code"]'
|
@@ -108,102 +82,97 @@ module Mods
|
|
108
82
|
n.scriptTerm :path => 'm:scriptTerm'
|
109
83
|
end
|
110
84
|
t._languageTerm :path => '//m:languageTerm' do |lt|
|
111
|
-
lt
|
112
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
113
|
-
lt.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
114
|
-
}
|
85
|
+
with_attributes(lt, Mods::AUTHORITY_ATTRIBS | %w[type])
|
115
86
|
end # t.language
|
116
87
|
|
117
88
|
# LOCATION -------------------------------------------------------------------------------
|
118
89
|
t.location :path => '/m:mods/m:location'
|
119
90
|
t._location :path => '//m:location' do |n|
|
120
91
|
# attributes
|
121
|
-
n
|
122
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
123
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
124
|
-
}
|
92
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel])
|
125
93
|
# child elements
|
126
94
|
n.physicalLocation :path => 'm:physicalLocation' do |e|
|
127
|
-
e
|
128
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
129
|
-
e.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
130
|
-
}
|
95
|
+
with_attributes(e, Mods::AUTHORITY_ATTRIBS | %w[displayLabel type])
|
131
96
|
end
|
132
97
|
n.shelfLocator :path => 'm:shelfLocator'
|
133
98
|
n.url :path => 'm:url' do |e|
|
134
|
-
e
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
99
|
+
with_attributes(e, %w[dateLastAccessed displayLabel note access usage])
|
100
|
+
end
|
101
|
+
n.holdingSimple :path => 'm:holdingSimple' do |h|
|
102
|
+
h.copyInformation path: 'm:copyInformation' do |c|
|
103
|
+
c.form path: 'm:form' do |f|
|
104
|
+
with_attributes(f, Mods::LANG_ATTRIBS | %w[type])
|
105
|
+
end
|
106
|
+
c.sub_location path: 'm:subLocation' do |s|
|
107
|
+
with_attributes(s, Mods::LANG_ATTRIBS)
|
108
|
+
end
|
109
|
+
|
110
|
+
c.shelf_locator path: 'm:shelfLocator' do |s|
|
111
|
+
with_attributes(s, Mods::LANG_ATTRIBS)
|
112
|
+
end
|
113
|
+
c.electronic_locator path: 'm:electronicLocator'
|
114
|
+
c.note path: 'm:note' do |note|
|
115
|
+
with_attributes(note, Mods::LANG_ATTRIBS | %w[displayLabel type])
|
116
|
+
end
|
117
|
+
c.enumeration_and_chronology path: 'm:enumerationAndChronology' do |e|
|
118
|
+
with_attributes(e, Mods::LANG_ATTRIBS | %w[unitType])
|
119
|
+
end
|
120
|
+
c.item_identifier path: 'm:itemIdentifier' do |i|
|
121
|
+
with_attributes(i, %w[type])
|
122
|
+
end
|
123
|
+
end
|
139
124
|
end
|
140
|
-
n.holdingSimple :path => 'm:holdingSimple'
|
141
125
|
n.holdingExternal :path => 'm:holdingExternal'
|
142
126
|
end # t.location
|
143
127
|
|
144
128
|
# NAME ------------------------------------------------------------------------------------
|
145
129
|
t.plain_name :path => '/m:mods/m:name'
|
146
|
-
t._plain_name :path => '//m:name' do |n|
|
147
|
-
Mods::Name::ATTRIBUTES
|
148
|
-
if attr_name != 'type'
|
149
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
150
|
-
else
|
151
|
-
n.type_at :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
152
|
-
end
|
153
|
-
}
|
130
|
+
t._plain_name :path => '(//m:name|//m:alternativeName)' do |n|
|
131
|
+
with_attributes(n, Mods::Name::ATTRIBUTES)
|
154
132
|
# elements
|
155
133
|
n.namePart :path => 'm:namePart' do |np|
|
156
|
-
np
|
134
|
+
with_attributes(np, %w[type])
|
157
135
|
end
|
158
136
|
n.family_name :path => 'm:namePart[@type="family"]'
|
159
137
|
n.given_name :path => 'm:namePart[@type="given"]'
|
160
138
|
n.termsOfAddress :path => 'm:namePart[@type="termsOfAddress"]'
|
161
139
|
n.date :path => 'm:namePart[@type="date"]'
|
162
140
|
|
141
|
+
n.alternative_name :path => 'm:alternativeName' do |alt|
|
142
|
+
with_attributes(alt, %w[altType])
|
143
|
+
end
|
163
144
|
n.displayForm :path => 'm:displayForm'
|
164
145
|
n.affiliation :path => 'm:affiliation'
|
165
146
|
n.description_el :path => 'm:description' # description is used by Nokogiri
|
166
147
|
n.role :path => 'm:role' do |r|
|
167
148
|
r.roleTerm :path => 'm:roleTerm' do |rt|
|
168
|
-
rt
|
169
|
-
|
170
|
-
|
171
|
-
|
149
|
+
with_attributes(rt, Mods::AUTHORITY_ATTRIBS | %w[type])
|
150
|
+
|
151
|
+
rt.value path: '.', single: true, accessor: (lambda do |roleTerm|
|
152
|
+
text = roleTerm.text.strip
|
153
|
+
|
154
|
+
if roleTerm.type_at == 'code' && roleTerm.authority == 'marcrelator'
|
155
|
+
MARC_RELATOR.fetch(text, text)
|
156
|
+
else
|
157
|
+
text
|
158
|
+
end
|
159
|
+
end)
|
172
160
|
end
|
161
|
+
|
173
162
|
# role convenience method
|
174
163
|
r.authority :path => '.', :accessor => lambda { |role_node|
|
175
|
-
|
176
|
-
role_node.roleTerm.each { |role_t|
|
177
|
-
# role_t.authority will be [] if it is missing from an earlier roleTerm
|
178
|
-
if role_t.authority && (!a || a.size == 0)
|
179
|
-
a = role_t.authority
|
180
|
-
end
|
181
|
-
}
|
182
|
-
a
|
164
|
+
role_node.roleTerm.authority.first
|
183
165
|
}
|
166
|
+
|
184
167
|
# role convenience method
|
185
168
|
r.code :path => '.', :accessor => lambda { |role_node|
|
186
|
-
|
187
|
-
role_node.roleTerm.each { |role_t|
|
188
|
-
if role_t.type_at == 'code'
|
189
|
-
c ||= role_t.text
|
190
|
-
end
|
191
|
-
}
|
192
|
-
c
|
169
|
+
role_node.roleTerm.select { |role_t| role_t.type_at == 'code' }.first&.text
|
193
170
|
}
|
171
|
+
|
194
172
|
# role convenience method
|
195
173
|
r.value :path => '.', :accessor => lambda { |role_node|
|
196
|
-
val =
|
197
|
-
role_node.roleTerm.
|
198
|
-
if role_t.type_at == 'text'
|
199
|
-
val ||= role_t.text
|
200
|
-
end
|
201
|
-
}
|
202
|
-
# FIXME: this is broken if there are multiple role codes and some of them are not marcrelator
|
203
|
-
if !val && role_node.code && role_node.authority.first =~ /marcrelator/
|
204
|
-
val = MARC_RELATOR[role_node.code.first]
|
205
|
-
end
|
206
|
-
val
|
174
|
+
val = role_node.roleTerm.select { |role_t| role_t.type_at == 'text' }.first&.text
|
175
|
+
val || role_node.roleTerm.select { |role_t| role_t.type_at == 'code' && role_t.authority.match?(/marcrelator/) }.first&.value
|
207
176
|
}
|
208
177
|
end # role node
|
209
178
|
|
@@ -271,12 +240,7 @@ module Mods
|
|
271
240
|
# NOTE ---------------------------------------------------------------------------------
|
272
241
|
t.note :path => '/m:mods/m:note'
|
273
242
|
t._note :path => '//m:note' do |n|
|
274
|
-
n
|
275
|
-
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
276
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
277
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
278
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
279
|
-
}
|
243
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[ID displayLabel type])
|
280
244
|
end
|
281
245
|
|
282
246
|
# ORIGIN_INFO --------------------------------------------------------------------------
|
@@ -284,38 +248,27 @@ module Mods
|
|
284
248
|
t._origin_info :path => '//m:originInfo' do |n|
|
285
249
|
n.as_object :path => '.', :accessor => lambda { |a| Mods::OriginInfo.new(a) }
|
286
250
|
# attributes
|
287
|
-
n
|
288
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
289
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
290
|
-
}
|
251
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel])
|
291
252
|
# child elements
|
292
253
|
n.place :path => 'm:place' do |e|
|
293
254
|
e.placeTerm :path => 'm:placeTerm' do |ee|
|
294
|
-
ee
|
295
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
296
|
-
ee.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
297
|
-
}
|
255
|
+
with_attributes(ee, Mods::AUTHORITY_ATTRIBS | %w[type])
|
298
256
|
end
|
299
257
|
end
|
300
258
|
n.publisher :path => 'm:publisher'
|
301
259
|
Mods::OriginInfo::DATE_ELEMENTS.each { |date_el|
|
302
260
|
n.send date_el, :path => "m:#{date_el}" do |d|
|
303
|
-
d.as_object :path => '.', :accessor => lambda { |a| Mods::Date.from_element(a) }
|
261
|
+
d.as_object :path => '.', :single => true, :accessor => lambda { |a| Mods::Date.from_element(a) }
|
304
262
|
|
305
|
-
Mods::DATE_ATTRIBS
|
306
|
-
|
307
|
-
|
308
|
-
if date_el == 'dateOther'
|
309
|
-
d.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
310
|
-
end
|
263
|
+
with_attributes(d, Mods::DATE_ATTRIBS)
|
264
|
+
|
265
|
+
with_attributes(d, %w[type]) if date_el == 'dateOther'
|
311
266
|
end
|
312
267
|
}
|
313
268
|
n.edition :path => 'm:edition'
|
314
269
|
n.issuance :path => 'm:issuance'
|
315
270
|
n.frequency :path => 'm:frequency' do |f|
|
316
|
-
Mods::AUTHORITY_ATTRIBS
|
317
|
-
f.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
318
|
-
}
|
271
|
+
with_attributes(f, Mods::AUTHORITY_ATTRIBS)
|
319
272
|
end
|
320
273
|
end # t.origin_info
|
321
274
|
|
@@ -323,18 +276,11 @@ module Mods
|
|
323
276
|
t.part :path => '/m:mods/m:part'
|
324
277
|
t._part :path => '//m:part' do |n|
|
325
278
|
# attributes
|
326
|
-
n
|
327
|
-
n.order :path => '@order', :accessor => lambda { |a| a.text }
|
328
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
329
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
330
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
331
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
332
|
-
}
|
279
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[ID order type displayLabel])
|
333
280
|
# child elements
|
334
281
|
n.detail :path => 'm:detail' do |e|
|
335
282
|
# attributes
|
336
|
-
e
|
337
|
-
e.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
283
|
+
with_attributes(e, %w[level type])
|
338
284
|
# elements
|
339
285
|
e.number :path => 'm:number'
|
340
286
|
e.caption :path => 'm:caption'
|
@@ -342,7 +288,7 @@ module Mods
|
|
342
288
|
end
|
343
289
|
n.extent :path => 'm:extent' do |e| # TODO: extent is ordered in xml schema
|
344
290
|
# attributes
|
345
|
-
e
|
291
|
+
with_attributes(e, %w[unit])
|
346
292
|
# elements
|
347
293
|
e.start :path => 'm:start'
|
348
294
|
e.end :path => 'm:end'
|
@@ -350,13 +296,10 @@ module Mods
|
|
350
296
|
e.list :path => 'm:list'
|
351
297
|
end
|
352
298
|
n.date :path => 'm:date' do |e|
|
353
|
-
Mods::DATE_ATTRIBS
|
354
|
-
e.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
355
|
-
}
|
299
|
+
with_attributes(e, Mods::DATE_ATTRIBS - ['keyDate'])
|
356
300
|
end
|
357
301
|
n.text_el :path => 'm:text' do |e|
|
358
|
-
e
|
359
|
-
e.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
302
|
+
with_attributes(e, %w[displayLabel type])
|
360
303
|
end
|
361
304
|
end # t._part
|
362
305
|
|
@@ -364,23 +307,16 @@ module Mods
|
|
364
307
|
t.physical_description :path => '/m:mods/m:physicalDescription'
|
365
308
|
t._physical_description :path => '//m:physicalDescription' do |n|
|
366
309
|
# attributes
|
367
|
-
n
|
368
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
369
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
370
|
-
}
|
310
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel])
|
371
311
|
# child elements
|
372
312
|
n.digitalOrigin :path => 'm:digitalOrigin'
|
373
313
|
n.extent :path => 'm:extent'
|
374
314
|
n.form :path => 'm:form' do |f|
|
375
|
-
f
|
376
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
377
|
-
f.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
378
|
-
}
|
315
|
+
with_attributes(f, Mods::AUTHORITY_ATTRIBS | %w[type])
|
379
316
|
end
|
380
317
|
n.internetMediaType :path => 'm:internetMediaType'
|
381
318
|
n.note :path => 'm:note' do |nn|
|
382
|
-
nn
|
383
|
-
nn.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
319
|
+
with_attributes(nn, %w[displayLabel type])
|
384
320
|
end
|
385
321
|
n.reformattingQuality :path => 'm:reformattingQuality'
|
386
322
|
end
|
@@ -389,52 +325,37 @@ module Mods
|
|
389
325
|
t.record_info :path => '/m:mods/m:recordInfo'
|
390
326
|
t._record_info :path => '//m:recordInfo' do |n|
|
391
327
|
# attributes
|
392
|
-
n
|
393
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
394
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
395
|
-
}
|
328
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel])
|
396
329
|
# child elements
|
397
330
|
n.recordContentSource :path => 'm:recordContentSource' do |r|
|
398
|
-
Mods::AUTHORITY_ATTRIBS
|
399
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
400
|
-
}
|
331
|
+
with_attributes(r, Mods::AUTHORITY_ATTRIBS)
|
401
332
|
end
|
402
333
|
n.recordCreationDate :path => 'm:recordCreationDate' do |r|
|
403
|
-
Mods::DATE_ATTRIBS
|
404
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
405
|
-
}
|
334
|
+
with_attributes(r, Mods::DATE_ATTRIBS)
|
406
335
|
end
|
407
336
|
n.recordChangeDate :path => 'm:recordChangeDate' do |r|
|
408
|
-
Mods::DATE_ATTRIBS
|
409
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
410
|
-
}
|
337
|
+
with_attributes(r, Mods::DATE_ATTRIBS)
|
411
338
|
end
|
412
339
|
n.recordIdentifier :path => 'm:recordIdentifier' do |r|
|
413
|
-
r
|
340
|
+
with_attributes(r, ['source'])
|
414
341
|
end
|
415
342
|
n.recordOrigin :path => 'm:recordOrigin'
|
416
343
|
n.languageOfCataloging :path => 'm:languageOfCataloging' do |r|
|
417
|
-
Mods::AUTHORITY_ATTRIBS
|
418
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
419
|
-
}
|
344
|
+
with_attributes(r, Mods::AUTHORITY_ATTRIBS)
|
420
345
|
r.languageTerm :path => 'm:languageTerm'
|
421
346
|
r.scriptTerm :path => 'm:scriptTerm'
|
422
347
|
end
|
423
348
|
n.descriptionStandard :path => 'm:descriptionStandard' do |r|
|
424
|
-
Mods::AUTHORITY_ATTRIBS
|
425
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
426
|
-
}
|
349
|
+
with_attributes(r, Mods::AUTHORITY_ATTRIBS)
|
427
350
|
end
|
428
351
|
end # t._record_info
|
429
352
|
|
430
353
|
# RELATED_ITEM-------------------------------------------------------------------------
|
431
354
|
t.related_item :path => '/m:mods/m:relatedItem' do |n|
|
432
355
|
# attributes
|
433
|
-
n
|
434
|
-
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
435
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
356
|
+
with_attributes(n, %w[ID displayLabel type])
|
436
357
|
# elements
|
437
|
-
n.abstract :path => 'abstract'
|
358
|
+
n.abstract :path => 'm:abstract'
|
438
359
|
n.accessCondition :path => 'm:accessCondition'
|
439
360
|
n.classification :path => 'm:classification'
|
440
361
|
n.extension :path => 'm:extension'
|
@@ -462,13 +383,7 @@ module Mods
|
|
462
383
|
t.subject :path => '/m:mods/m:subject'
|
463
384
|
t._subject :path => '//m:subject' do |n|
|
464
385
|
# attributes
|
465
|
-
n
|
466
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
467
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
468
|
-
}
|
469
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
470
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
471
|
-
}
|
386
|
+
with_attributes(n, Mods::AUTHORITY_ATTRIBS | Mods::LANG_ATTRIBS | %w[displayLabel])
|
472
387
|
# child elements
|
473
388
|
n.cartographics :path => 'm:cartographics' do |n1|
|
474
389
|
n1.scale :path => 'm:scale'
|
@@ -479,19 +394,13 @@ module Mods
|
|
479
394
|
}
|
480
395
|
end
|
481
396
|
n.genre :path => 'm:genre' do |n1|
|
482
|
-
Mods::AUTHORITY_ATTRIBS
|
483
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
484
|
-
}
|
397
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS)
|
485
398
|
end
|
486
399
|
n.geographic :path => 'm:geographic' do |n1|
|
487
|
-
Mods::AUTHORITY_ATTRIBS
|
488
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
489
|
-
}
|
400
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS)
|
490
401
|
end
|
491
402
|
n.geographicCode :path => 'm:geographicCode' do |gc|
|
492
|
-
Mods::AUTHORITY_ATTRIBS
|
493
|
-
gc.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
494
|
-
}
|
403
|
+
with_attributes(gc, Mods::AUTHORITY_ATTRIBS)
|
495
404
|
# convenience method
|
496
405
|
gc.translated_value :path => '.', :accessor => lambda { |gc_node|
|
497
406
|
code_val ||= gc_node.text
|
@@ -511,78 +420,45 @@ module Mods
|
|
511
420
|
Mods::Subject::HIER_GEO_CHILD_ELEMENTS.each { |elname|
|
512
421
|
n1.send elname, :path => "m:#{elname}"
|
513
422
|
}
|
514
|
-
Mods::AUTHORITY_ATTRIBS
|
515
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
516
|
-
}
|
423
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS)
|
517
424
|
end
|
518
425
|
# Note: 'name' is used by Nokogiri
|
519
426
|
n.name_el :path => 'm:name' do |t1|
|
520
|
-
Mods::AUTHORITY_ATTRIBS
|
521
|
-
t1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
522
|
-
}
|
427
|
+
with_attributes(t1, Mods::AUTHORITY_ATTRIBS)
|
523
428
|
end
|
524
429
|
n.personal_name :path => 'm:name[@type="personal"]'
|
525
430
|
n.corporate_name :path => 'm:name[@type="corporate"]'
|
526
431
|
n.conference_name :path => 'm:name[@type="conference"]'
|
527
432
|
n.occupation :path => 'm:occupation' do |n1|
|
528
|
-
Mods::AUTHORITY_ATTRIBS
|
529
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
530
|
-
}
|
433
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS)
|
531
434
|
end
|
532
435
|
n.temporal :path => 'm:temporal' do |n1|
|
533
|
-
Mods::AUTHORITY_ATTRIBS
|
534
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
535
|
-
}
|
536
|
-
# date attributes as attributes
|
537
|
-
Mods::DATE_ATTRIBS.each { |attr_name|
|
538
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
539
|
-
}
|
436
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS | Mods::DATE_ATTRIBS)
|
540
437
|
end
|
541
438
|
n.titleInfo :path => 'm:titleInfo' do |t1|
|
542
|
-
Mods::AUTHORITY_ATTRIBS
|
543
|
-
t1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
544
|
-
}
|
439
|
+
with_attributes(t1, Mods::AUTHORITY_ATTRIBS)
|
545
440
|
end
|
546
441
|
n.topic :path => 'm:topic' do |n1|
|
547
|
-
Mods::AUTHORITY_ATTRIBS
|
548
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
549
|
-
}
|
442
|
+
with_attributes(n1, Mods::AUTHORITY_ATTRIBS)
|
550
443
|
end
|
551
444
|
end # t.subject
|
552
445
|
|
553
446
|
# TABLE_OF_CONTENTS ---------------------------------------------------------------------
|
554
447
|
t.tableOfContents :path => '/m:mods/m:tableOfContents'
|
555
448
|
t._tableOfContents :path => '//m:tableOfContents' do |n|
|
556
|
-
n
|
557
|
-
n.shareable :path => '@shareable', :accessor => lambda { |a| a.text }
|
558
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
559
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
560
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
561
|
-
}
|
449
|
+
with_attributes(n, Mods::LANG_ATTRIBS | %w[displayLabel shareable type])
|
562
450
|
end
|
563
451
|
|
564
452
|
# TARGET_AUDIENCE -----------------------------------------------------------------------
|
565
453
|
t.targetAudience :path => '/m:mods/m:targetAudience'
|
566
454
|
t._targetAudience :path => '//m:targetAudience' do |n|
|
567
|
-
n
|
568
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
569
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
570
|
-
}
|
571
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
572
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
573
|
-
}
|
455
|
+
with_attributes(n, Mods::AUTHORITY_ATTRIBS | Mods::LANG_ATTRIBS | %w[displayLabel])
|
574
456
|
end
|
575
457
|
|
576
458
|
# TITLE_INFO ----------------------------------------------------------------------------
|
577
459
|
t.title_info :path => '/m:mods/m:titleInfo'
|
578
460
|
t._title_info :path => '//m:titleInfo' do |n|
|
579
|
-
Mods::TitleInfo::ATTRIBUTES
|
580
|
-
if attr_name != 'type'
|
581
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
582
|
-
else
|
583
|
-
n.type_at :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
584
|
-
end
|
585
|
-
}
|
461
|
+
with_attributes(n, Mods::TitleInfo::ATTRIBUTES)
|
586
462
|
n.title :path => 'm:title'
|
587
463
|
n.subTitle :path => 'm:subTitle'
|
588
464
|
n.nonSort :path => 'm:nonSort'
|
@@ -620,624 +496,12 @@ module Mods
|
|
620
496
|
# TYPE_OF_RESOURCE --------------------------------------------------------------------
|
621
497
|
t.typeOfResource :path => '/m:mods/m:typeOfResource'
|
622
498
|
t._typeOfResource :path => '//m:typeOfResource' do |n|
|
623
|
-
n
|
624
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
625
|
-
n.manuscript :path => '@manuscript', :accessor => lambda { |a| a.text }
|
626
|
-
n.usage :path => '@usage', :accessor => lambda { |a| a.text }
|
627
|
-
end
|
628
|
-
|
629
|
-
end # terminology
|
630
|
-
|
631
|
-
mods_ng_xml.nom!
|
632
|
-
mods_ng_xml
|
633
|
-
end # set_terminology_ns
|
634
|
-
|
635
|
-
# set the NOM terminology; do NOT use namespaces
|
636
|
-
# NOTES:
|
637
|
-
# 1. certain words, such as 'type' 'name' 'description' are reserved words in jruby or nokogiri
|
638
|
-
# when the terminology would use these words, a suffix of '_at' is added if it is an attribute,
|
639
|
-
# (e.g. 'type_at' for @type) and a suffix of '_el' is added if it is an element.
|
640
|
-
# 2. the underscore prefix variant terms are a way of making subterms for a node available
|
641
|
-
# to any instance of said node and are not intended to be used externally
|
642
|
-
# @param mods_ng_xml a Nokogiri::Xml::Document object containing MODS (without namespaces)
|
643
|
-
def set_terminology_no_ns(mods_ng_xml)
|
644
|
-
mods_ng_xml.set_terminology() do |t|
|
645
|
-
|
646
|
-
# FIXME: may want to deal with camelcase vs. underscore in method_missing
|
647
|
-
|
648
|
-
# ABSTRACT -------------------------------------------------------------------------------
|
649
|
-
t.abstract :path => '/mods/abstract'
|
650
|
-
t._abstract :path => '//abstract' do |n|
|
651
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
652
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
653
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
654
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
655
|
-
}
|
656
|
-
end
|
657
|
-
|
658
|
-
# ACCESS_CONDITION -----------------------------------------------------------------------
|
659
|
-
t.accessCondition :path => '/mods/accessCondition'
|
660
|
-
t._accessCondition :path => '//accessCondition' do |n|
|
661
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
662
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
663
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
664
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
665
|
-
}
|
666
|
-
end
|
667
|
-
|
668
|
-
# CLASSIFICATION -------------------------------------------------------------------------
|
669
|
-
t.classification :path => '/mods/classification'
|
670
|
-
t._classification :path => '//classification' do |n|
|
671
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
672
|
-
n.edition :path => '@edition', :accessor => lambda { |a| a.text }
|
673
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
674
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
675
|
-
}
|
676
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
677
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
678
|
-
}
|
679
|
-
end
|
680
|
-
|
681
|
-
# EXTENSION ------------------------------------------------------------------------------
|
682
|
-
t.extension :path => '/mods/extension'
|
683
|
-
t._extension :path => '//extension' do |n|
|
684
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
685
|
-
end
|
686
|
-
|
687
|
-
# GENRE ----------------------------------------------------------------------------------
|
688
|
-
t.genre :path => '/mods/genre'
|
689
|
-
t._genre :path => '//genre' do |n|
|
690
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
691
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
692
|
-
n.usage :path => '@usage', :accessor => lambda { |a| a.text }
|
693
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
694
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
695
|
-
}
|
696
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
697
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
698
|
-
}
|
699
|
-
end
|
700
|
-
|
701
|
-
# IDENTIIER ------------------------------------------------------------------------------
|
702
|
-
t.identifier :path => '/mods/identifier'
|
703
|
-
t._identifier :path => '//identifier' do |n|
|
704
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
705
|
-
n.invalid :path => '@invalid', :accessor => lambda { |a| a.text }
|
706
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
707
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
708
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
709
|
-
}
|
710
|
-
end
|
711
|
-
|
712
|
-
# LANGUAGE -------------------------------------------------------------------------------
|
713
|
-
t.language :path => '/mods/language'
|
714
|
-
t._language :path => '//language' do |n|
|
715
|
-
# attributes
|
716
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
717
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
718
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
719
|
-
}
|
720
|
-
# child elements
|
721
|
-
n.languageTerm :path => 'languageTerm'
|
722
|
-
n.code_term :path => 'languageTerm[@type="code"]'
|
723
|
-
n.text_term :path => 'languageTerm[@type="text"]'
|
724
|
-
n.scriptTerm :path => 'scriptTerm'
|
725
|
-
end
|
726
|
-
t._languageTerm :path => '//languageTerm' do |lt|
|
727
|
-
lt.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
728
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
729
|
-
lt.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
730
|
-
}
|
731
|
-
end # t.language
|
732
|
-
|
733
|
-
# LOCATION -------------------------------------------------------------------------------
|
734
|
-
t.location :path => '/mods/location'
|
735
|
-
t._location :path => '//location' do |n|
|
736
|
-
# attributes
|
737
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
738
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
739
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
740
|
-
}
|
741
|
-
# child elements
|
742
|
-
n.physicalLocation :path => 'physicalLocation' do |e|
|
743
|
-
e.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
744
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
745
|
-
e.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
746
|
-
}
|
747
|
-
end
|
748
|
-
n.shelfLocator :path => 'shelfLocator'
|
749
|
-
n.url :path => 'url' do |e|
|
750
|
-
e.dateLastAccessed :path => '@dateLastAccessed', :accessor => lambda { |a| a.text }
|
751
|
-
e.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
752
|
-
e.note :path => '@note', :accessor => lambda { |a| a.text }
|
753
|
-
e.access :path => '@access', :accessor => lambda { |a| a.text }
|
754
|
-
e.usage :path => '@usage', :accessor => lambda { |a| a.text }
|
755
|
-
end
|
756
|
-
n.holdingSimple :path => 'holdingSimple'
|
757
|
-
n.holdingExternal :path => 'holdingExternal'
|
758
|
-
end # t.location
|
759
|
-
|
760
|
-
# NAME ------------------------------------------------------------------------------------
|
761
|
-
t.plain_name :path => '/mods/name'
|
762
|
-
t._plain_name :path => '//name' do |n|
|
763
|
-
Mods::Name::ATTRIBUTES.each { |attr_name|
|
764
|
-
if attr_name != 'type'
|
765
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
766
|
-
else
|
767
|
-
n.type_at :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
768
|
-
end
|
769
|
-
}
|
770
|
-
# elements
|
771
|
-
n.namePart :path => 'namePart' do |np|
|
772
|
-
np.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
773
|
-
end
|
774
|
-
n.family_name :path => 'namePart[@type="family"]'
|
775
|
-
n.given_name :path => 'namePart[@type="given"]'
|
776
|
-
n.termsOfAddress :path => 'namePart[@type="termsOfAddress"]'
|
777
|
-
n.date :path => 'namePart[@type="date"]'
|
778
|
-
|
779
|
-
n.displayForm :path => 'displayForm'
|
780
|
-
n.affiliation :path => 'affiliation'
|
781
|
-
n.description_el :path => 'description' # description is used by Nokogiri
|
782
|
-
n.role :path => 'role' do |r|
|
783
|
-
r.roleTerm :path => 'roleTerm' do |rt|
|
784
|
-
rt.type_at :path => "@type", :accessor => lambda { |a| a.text }
|
785
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
786
|
-
rt.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
787
|
-
}
|
788
|
-
end
|
789
|
-
# convenience method
|
790
|
-
r.authority :path => '.', :accessor => lambda { |role_node|
|
791
|
-
a = nil
|
792
|
-
role_node.roleTerm.each { |role_t|
|
793
|
-
# role_t.authority will be [] if it is missing from an earlier roleTerm
|
794
|
-
if role_t.authority && (!a || a.size == 0)
|
795
|
-
a = role_t.authority
|
796
|
-
end
|
797
|
-
}
|
798
|
-
a
|
799
|
-
}
|
800
|
-
# convenience method
|
801
|
-
r.code :path => '.', :accessor => lambda { |role_node|
|
802
|
-
c = nil
|
803
|
-
role_node.roleTerm.each { |role_t|
|
804
|
-
if role_t.type_at == 'code'
|
805
|
-
c ||= role_t.text
|
806
|
-
end
|
807
|
-
}
|
808
|
-
c
|
809
|
-
}
|
810
|
-
# convenience method
|
811
|
-
r.value :path => '.', :accessor => lambda { |role_node|
|
812
|
-
val = nil
|
813
|
-
role_node.roleTerm.each { |role_t|
|
814
|
-
if role_t.type_at == 'text'
|
815
|
-
val ||= role_t.text
|
816
|
-
end
|
817
|
-
}
|
818
|
-
# FIXME: this is broken if there are multiple role codes and some of them are not marcrelator
|
819
|
-
if !val && role_node.code && role_node.authority.first =~ /marcrelator/
|
820
|
-
val = MARC_RELATOR[role_node.code.first]
|
821
|
-
end
|
822
|
-
val
|
823
|
-
}
|
824
|
-
end # role node
|
825
|
-
|
826
|
-
# name convenience method
|
827
|
-
# uses the displayForm of a name if present
|
828
|
-
# if no displayForm, try to make a string from family, given and terms of address
|
829
|
-
# otherwise, return all non-date nameParts concatenated together
|
830
|
-
n.display_value :path => '.', :single => true, :accessor => lambda {|name_node|
|
831
|
-
dv = ''
|
832
|
-
if name_node.displayForm && name_node.displayForm.text.size > 0
|
833
|
-
dv = name_node.displayForm.text
|
834
|
-
end
|
835
|
-
if dv.empty?
|
836
|
-
if name_node.type_at == 'personal'
|
837
|
-
if name_node.family_name.size > 0
|
838
|
-
dv = name_node.given_name.size > 0 ? "#{name_node.family_name.text}, #{name_node.given_name.text}" : name_node.family_name.text
|
839
|
-
elsif name_node.given_name.size > 0
|
840
|
-
dv = name_node.given_name.text
|
841
|
-
end
|
842
|
-
if !dv.empty?
|
843
|
-
first = true
|
844
|
-
name_node.namePart.each { |np|
|
845
|
-
if np.type_at == 'termsOfAddress' && !np.text.empty?
|
846
|
-
if first
|
847
|
-
dv = dv + " " + np.text
|
848
|
-
first = false
|
849
|
-
else
|
850
|
-
dv = dv + ", " + np.text
|
851
|
-
end
|
852
|
-
end
|
853
|
-
}
|
854
|
-
else # no family or given name
|
855
|
-
dv = name_node.namePart.select {|np| np.type_at != 'date' && !np.text.empty?}.join(" ")
|
856
|
-
end
|
857
|
-
else # not a personal name
|
858
|
-
dv = name_node.namePart.select {|np| np.type_at != 'date' && !np.text.empty?}.join(" ")
|
859
|
-
end
|
860
|
-
end
|
861
|
-
dv.strip.empty? ? nil : dv.strip
|
862
|
-
}
|
863
|
-
|
864
|
-
# name convenience method
|
865
|
-
n.display_value_w_date :path => '.', :single => true, :accessor => lambda {|name_node|
|
866
|
-
dv = '' + name_node.display_value
|
867
|
-
name_node.namePart.each { |np|
|
868
|
-
if np.type_at == 'date' && !np.text.empty? && !dv.end_with?(np.text)
|
869
|
-
dv = dv + ", #{np.text}"
|
870
|
-
end
|
871
|
-
}
|
872
|
-
if dv.start_with?(', ')
|
873
|
-
dv.sub(', ', '')
|
874
|
-
end
|
875
|
-
dv.strip.empty? ? nil : dv.strip
|
876
|
-
}
|
877
|
-
end # t._plain_name
|
878
|
-
|
879
|
-
t.personal_name :path => '/mods/name[@type="personal"]'
|
880
|
-
t._personal_name :path => '//name[@type="personal"]'
|
881
|
-
t.corporate_name :path => '/mods/name[@type="corporate"]'
|
882
|
-
t._corporate_name :path => '//name[@type="corporate"]'
|
883
|
-
t.conference_name :path => '/mods/name[@type="conference"]'
|
884
|
-
t._conference_name :path => '//name[@type="conference"]'
|
885
|
-
|
886
|
-
# NOTE ---------------------------------------------------------------------------------
|
887
|
-
t.note :path => '/mods/note'
|
888
|
-
t._note :path => '//note' do |n|
|
889
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
890
|
-
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
891
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
892
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
893
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
894
|
-
}
|
895
|
-
end
|
896
|
-
|
897
|
-
# ORIGIN_INFO --------------------------------------------------------------------------
|
898
|
-
t.origin_info :path => '/mods/originInfo'
|
899
|
-
t._origin_info :path => '//originInfo' do |n|
|
900
|
-
# attributes
|
901
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
902
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
903
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
904
|
-
}
|
905
|
-
# child elements
|
906
|
-
n.place :path => 'place' do |e|
|
907
|
-
e.placeTerm :path => 'placeTerm' do |ee|
|
908
|
-
ee.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
909
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
910
|
-
ee.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
911
|
-
}
|
912
|
-
end
|
913
|
-
end
|
914
|
-
n.publisher :path => 'publisher'
|
915
|
-
Mods::OriginInfo::DATE_ELEMENTS.each { |date_el|
|
916
|
-
n.send date_el, :path => "#{date_el}" do |d|
|
917
|
-
Mods::DATE_ATTRIBS.each { |attr_name|
|
918
|
-
d.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
919
|
-
}
|
920
|
-
if date_el == 'dateOther'
|
921
|
-
d.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
922
|
-
end
|
923
|
-
end
|
924
|
-
}
|
925
|
-
n.edition :path => 'edition'
|
926
|
-
n.issuance :path => 'issuance'
|
927
|
-
n.frequency :path => 'frequency' do |f|
|
928
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
929
|
-
f.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
930
|
-
}
|
931
|
-
end
|
932
|
-
end # t.origin_info
|
933
|
-
|
934
|
-
# PART -----------------------------------------------------------------------------------
|
935
|
-
t.part :path => '/mods/part'
|
936
|
-
t._part :path => '//part' do |n|
|
937
|
-
# attributes
|
938
|
-
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
939
|
-
n.order :path => '@order', :accessor => lambda { |a| a.text }
|
940
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
941
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
942
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
943
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
944
|
-
}
|
945
|
-
# child elements
|
946
|
-
n.detail :path => 'detail' do |e|
|
947
|
-
# attributes
|
948
|
-
e.level :path => '@level', :accessor => lambda { |a| a.text }
|
949
|
-
e.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
950
|
-
# elements
|
951
|
-
e.number :path => 'number'
|
952
|
-
e.caption :path => 'caption'
|
953
|
-
e.title :path => 'title'
|
954
|
-
end
|
955
|
-
n.extent :path => 'extent' do |e| # TODO: extent is ordered in xml schema
|
956
|
-
# attributes
|
957
|
-
e.unit :path => '@unit', :accessor => lambda { |a| a.text }
|
958
|
-
# elements
|
959
|
-
e.start :path => 'start'
|
960
|
-
e.end :path => 'end'
|
961
|
-
e.total :path => 'total'
|
962
|
-
e.list :path => 'list'
|
963
|
-
end
|
964
|
-
n.date :path => 'date' do |e|
|
965
|
-
Mods::DATE_ATTRIBS.reject { |a| a == 'keyDate' }.each { |attr_name|
|
966
|
-
e.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
967
|
-
}
|
968
|
-
end
|
969
|
-
n.text_el :path => 'text' do |e|
|
970
|
-
e.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
971
|
-
e.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
972
|
-
end
|
973
|
-
end # t._part
|
974
|
-
|
975
|
-
# PHYSICAL_DESCRIPTION -------------------------------------------------------------------
|
976
|
-
t.physical_description :path => '/mods/physicalDescription'
|
977
|
-
t._physical_description :path => '//physicalDescription' do |n|
|
978
|
-
# attributes
|
979
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
980
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
981
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
982
|
-
}
|
983
|
-
# child elements
|
984
|
-
n.digitalOrigin :path => 'digitalOrigin'
|
985
|
-
n.extent :path => 'extent'
|
986
|
-
n.form :path => 'form' do |f|
|
987
|
-
f.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
988
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
989
|
-
f.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
990
|
-
}
|
991
|
-
end
|
992
|
-
n.internetMediaType :path => 'internetMediaType'
|
993
|
-
n.note :path => 'note' do |nn|
|
994
|
-
nn.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
995
|
-
nn.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
996
|
-
end
|
997
|
-
n.reformattingQuality :path => 'reformattingQuality'
|
998
|
-
end
|
999
|
-
|
1000
|
-
# RECORD_INFO --------------------------------------------------------------------------
|
1001
|
-
t.record_info :path => '/mods/recordInfo'
|
1002
|
-
t._record_info :path => '//recordInfo' do |n|
|
1003
|
-
# attributes
|
1004
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1005
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
1006
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1007
|
-
}
|
1008
|
-
# child elements
|
1009
|
-
n.recordContentSource :path => 'recordContentSource' do |r|
|
1010
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1011
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1012
|
-
}
|
1013
|
-
end
|
1014
|
-
n.recordCreationDate :path => 'recordCreationDate' do |r|
|
1015
|
-
Mods::DATE_ATTRIBS.each { |attr_name|
|
1016
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1017
|
-
}
|
1018
|
-
end
|
1019
|
-
n.recordChangeDate :path => 'recordChangeDate' do |r|
|
1020
|
-
Mods::DATE_ATTRIBS.each { |attr_name|
|
1021
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1022
|
-
}
|
1023
|
-
end
|
1024
|
-
n.recordIdentifier :path => 'recordIdentifier' do |r|
|
1025
|
-
r.source :path => '@source', :accessor => lambda { |a| a.text }
|
1026
|
-
end
|
1027
|
-
n.recordOrigin :path => 'recordOrigin'
|
1028
|
-
n.languageOfCataloging :path => 'languageOfCataloging' do |r|
|
1029
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1030
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1031
|
-
}
|
1032
|
-
r.languageTerm :path => 'languageTerm'
|
1033
|
-
r.scriptTerm :path => 'scriptTerm'
|
1034
|
-
end
|
1035
|
-
n.descriptionStandard :path => 'descriptionStandard' do |r|
|
1036
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1037
|
-
r.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1038
|
-
}
|
1039
|
-
end
|
1040
|
-
end # t._record_info
|
1041
|
-
|
1042
|
-
# RELATED_ITEM-------------------------------------------------------------------------
|
1043
|
-
t.related_item :path => '/mods/relatedItem' do |n|
|
1044
|
-
# attributes
|
1045
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1046
|
-
n.id_at :path => '@ID', :accessor => lambda { |a| a.text }
|
1047
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
1048
|
-
# elements
|
1049
|
-
n.abstract :path => 'abstract'
|
1050
|
-
n.accessCondition :path => 'accessCondition'
|
1051
|
-
n.classification :path => 'classification'
|
1052
|
-
n.extension :path => 'extension'
|
1053
|
-
n.genre :path => 'genre'
|
1054
|
-
n.identifier :path => 'identifier'
|
1055
|
-
n.language :path => 'language'
|
1056
|
-
n.location :path => 'location'
|
1057
|
-
n.name_el :path => 'name' # Note: 'name' is used by Nokogiri
|
1058
|
-
n.personal_name :path => 'name[@type="personal"]'
|
1059
|
-
n.corporate_name :path => 'name[@type="corporate"]'
|
1060
|
-
n.conference_name :path => 'name[@type="conference"]'
|
1061
|
-
n.note :path => 'note'
|
1062
|
-
n.originInfo :path => 'originInfo'
|
1063
|
-
n.part :path => 'part'
|
1064
|
-
n.physicalDescription :path => 'physicalDescription'
|
1065
|
-
n.recordInfo :path => 'recordInfo'
|
1066
|
-
n.subject :path => 'subject'
|
1067
|
-
n.tableOfContents :path => 'tableOfContents'
|
1068
|
-
n.targetAudience :path => 'targetAudience'
|
1069
|
-
n.titleInfo :path => 'titleInfo'
|
1070
|
-
n.typeOfResource :path => 'typeOfResource'
|
499
|
+
with_attributes(n, %w[collection displayLabel manuscript usage])
|
1071
500
|
end
|
1072
|
-
|
1073
|
-
# SUBJECT -----------------------------------------------------------------------------
|
1074
|
-
t.subject :path => '/mods/subject'
|
1075
|
-
t._subject :path => '//subject' do |n|
|
1076
|
-
# attributes
|
1077
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1078
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1079
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1080
|
-
}
|
1081
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
1082
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1083
|
-
}
|
1084
|
-
# child elements
|
1085
|
-
n.cartographics :path => 'cartographics' do |n1|
|
1086
|
-
n1.scale :path => 'scale'
|
1087
|
-
n1.projection :path => 'projection'
|
1088
|
-
n1.coordinates :path => 'coordinates'
|
1089
|
-
Mods::Subject::CARTOGRAPHICS_CHILD_ELEMENTS.each { |elname|
|
1090
|
-
n1.send elname, :path => "#{elname}"
|
1091
|
-
}
|
1092
|
-
end
|
1093
|
-
n.geographic :path => 'geographic' do |n1|
|
1094
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1095
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1096
|
-
}
|
1097
|
-
end
|
1098
|
-
n.genre :path => 'genre' do |n1|
|
1099
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1100
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1101
|
-
}
|
1102
|
-
end
|
1103
|
-
n.geographicCode :path => 'geographicCode' do |gc|
|
1104
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1105
|
-
gc.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1106
|
-
}
|
1107
|
-
# convenience method
|
1108
|
-
gc.translated_value :path => '.', :accessor => lambda { |gc_node|
|
1109
|
-
code_val ||= gc_node.text
|
1110
|
-
xval = nil
|
1111
|
-
if code_val
|
1112
|
-
case gc_node.authority
|
1113
|
-
when 'marcgac'
|
1114
|
-
xval = MARC_GEOGRAPHIC_AREA[code_val]
|
1115
|
-
when 'marccountry'
|
1116
|
-
xval = MARC_COUNTRY[code_val]
|
1117
|
-
end
|
1118
|
-
end
|
1119
|
-
xval
|
1120
|
-
}
|
1121
|
-
end
|
1122
|
-
n.hierarchicalGeographic :path => 'hierarchicalGeographic' do |n1|
|
1123
|
-
Mods::Subject::HIER_GEO_CHILD_ELEMENTS.each { |elname|
|
1124
|
-
n1.send elname, :path => "#{elname}"
|
1125
|
-
}
|
1126
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1127
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1128
|
-
}
|
1129
|
-
end
|
1130
|
-
# Note: 'name' is used by Nokogiri
|
1131
|
-
n.name_el :path => 'name' do |t1|
|
1132
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1133
|
-
t1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1134
|
-
}
|
1135
|
-
end
|
1136
|
-
n.personal_name :path => 'name[@type="personal"]'
|
1137
|
-
n.corporate_name :path => 'name[@type="corporate"]'
|
1138
|
-
n.conference_name :path => 'name[@type="conference"]'
|
1139
|
-
n.occupation :path => 'occupation' do |n1|
|
1140
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1141
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1142
|
-
}
|
1143
|
-
end
|
1144
|
-
n.temporal :path => 'temporal' do |n1|
|
1145
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1146
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1147
|
-
}
|
1148
|
-
# date attributes as attributes
|
1149
|
-
Mods::DATE_ATTRIBS.each { |attr_name|
|
1150
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1151
|
-
}
|
1152
|
-
end
|
1153
|
-
n.titleInfo :path => 'titleInfo' do |t1|
|
1154
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1155
|
-
t1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1156
|
-
}
|
1157
|
-
end
|
1158
|
-
n.topic :path => 'topic' do |n1|
|
1159
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1160
|
-
n1.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1161
|
-
}
|
1162
|
-
end
|
1163
|
-
end # t.subject
|
1164
|
-
|
1165
|
-
# TABLE_OF_CONTENTS ---------------------------------------------------------------------
|
1166
|
-
t.tableOfContents :path => '/mods/tableOfContents'
|
1167
|
-
t._tableOfContents :path => '//tableOfContents' do |n|
|
1168
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1169
|
-
n.shareable :path => '@shareable', :accessor => lambda { |a| a.text }
|
1170
|
-
n.type_at :path => '@type', :accessor => lambda { |a| a.text }
|
1171
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
1172
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1173
|
-
}
|
1174
|
-
end
|
1175
|
-
|
1176
|
-
# TARGET_AUDIENCE -----------------------------------------------------------------------
|
1177
|
-
t.targetAudience :path => '/mods/targetAudience'
|
1178
|
-
t._targetAudience :path => '//targetAudience' do |n|
|
1179
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1180
|
-
Mods::AUTHORITY_ATTRIBS.each { |attr_name|
|
1181
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1182
|
-
}
|
1183
|
-
Mods::LANG_ATTRIBS.each { |attr_name|
|
1184
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1185
|
-
}
|
1186
|
-
end
|
1187
|
-
|
1188
|
-
# TITLE_INFO ----------------------------------------------------------------------------
|
1189
|
-
t.title_info :path => '/mods/titleInfo'
|
1190
|
-
t._title_info :path => '//titleInfo' do |n|
|
1191
|
-
Mods::TitleInfo::ATTRIBUTES.each { |attr_name|
|
1192
|
-
if attr_name != 'type'
|
1193
|
-
n.send attr_name, :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1194
|
-
else
|
1195
|
-
n.type_at :path => "@#{attr_name}", :accessor => lambda { |a| a.text }
|
1196
|
-
end
|
1197
|
-
}
|
1198
|
-
n.title :path => 'title'
|
1199
|
-
n.subTitle :path => 'subTitle'
|
1200
|
-
n.nonSort :path => 'nonSort'
|
1201
|
-
n.partNumber :path => 'partNumber'
|
1202
|
-
n.partName :path => 'partName'
|
1203
|
-
n.sort_title :path => '.', :accessor => lambda { |node|
|
1204
|
-
if node.type_at != "alternative" || (node.type_at == "alternative" && mods_ng_xml.xpath('/mods/titleInfo').size == 1)
|
1205
|
-
node.title.text + (!node.subTitle.text.empty? ? "#{@title_delimiter}#{node.subTitle.text}" : "" )
|
1206
|
-
end
|
1207
|
-
}
|
1208
|
-
n.full_title :path => '.', :accessor => lambda { |node|
|
1209
|
-
(!node.nonSort.text.empty? ? "#{node.nonSort.text} " : "" ) +
|
1210
|
-
node.title.text +
|
1211
|
-
(!node.subTitle.text.empty? ? "#{@title_delimiter}#{node.subTitle.text}" : "" )
|
1212
|
-
}
|
1213
|
-
n.short_title :path => '.', :accessor => lambda { |node|
|
1214
|
-
if node.type_at != "alternative"
|
1215
|
-
(!node.nonSort.text.empty? ? "#{node.nonSort.text} " : "" ) +
|
1216
|
-
node.title.text
|
1217
|
-
end
|
1218
|
-
}
|
1219
|
-
n.alternative_title :path => '.', :accessor => lambda { |node|
|
1220
|
-
if node.type_at == "alternative"
|
1221
|
-
(!node.nonSort.text.empty? ? "#{node.nonSort.text} " : "" ) +
|
1222
|
-
node.title.text
|
1223
|
-
end
|
1224
|
-
}
|
1225
|
-
end # t._title_info
|
1226
|
-
|
1227
|
-
# TYPE_OF_RESOURCE --------------------------------------------------------------------
|
1228
|
-
t.typeOfResource :path => '/mods/typeOfResource'
|
1229
|
-
t._typeOfResource :path => '//typeOfResource' do |n|
|
1230
|
-
n.collection :path => '@collection', :accessor => lambda { |a| a.text }
|
1231
|
-
n.displayLabel :path => '@displayLabel', :accessor => lambda { |a| a.text }
|
1232
|
-
n.manuscript :path => '@manuscript', :accessor => lambda { |a| a.text }
|
1233
|
-
n.usage :path => '@usage', :accessor => lambda { |a| a.text }
|
1234
|
-
end
|
1235
|
-
|
1236
|
-
end # terminology
|
501
|
+
end
|
1237
502
|
|
1238
503
|
mods_ng_xml.nom!
|
1239
504
|
mods_ng_xml
|
1240
|
-
end
|
1241
|
-
|
1242
|
-
|
1243
|
-
end # Mods module
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|