hydra-pbcore 2.4.0 → 3.0.0.rc1

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.
Files changed (50) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -1
  3. data/Gemfile.lock +135 -0
  4. data/README.md +32 -25
  5. data/Rakefile +1 -1
  6. data/hydra-pbcore.gemspec +3 -1
  7. data/lib/hydra-pbcore.rb +19 -2
  8. data/lib/hydra_pbcore/datastream.rb +0 -1
  9. data/lib/hydra_pbcore/datastream/document.rb +6 -11
  10. data/lib/hydra_pbcore/datastream/instantiation.rb +5 -10
  11. data/lib/hydra_pbcore/methods.rb +0 -6
  12. data/lib/hydra_pbcore/templates.rb +6 -6
  13. data/lib/hydra_pbcore/version.rb +1 -1
  14. data/spec/config_spec.rb +88 -0
  15. data/spec/document_spec.rb +37 -17
  16. data/spec/fixtures/digital_instantiation_solr.xml +1009 -1009
  17. data/spec/fixtures/document_solr.xml +441 -430
  18. data/spec/fixtures/physical_instantiation_solr.xml +291 -282
  19. data/spec/instantiation_spec.rb +38 -6
  20. data/spec/spec_helper.rb +1 -0
  21. metadata +42 -87
  22. data/lib/hydra_pbcore/conversions.rb +0 -107
  23. data/lib/hydra_pbcore/datastream/deprecated.rb +0 -6
  24. data/lib/hydra_pbcore/datastream/deprecated/digital_document.rb +0 -105
  25. data/lib/hydra_pbcore/datastream/deprecated/document.rb +0 -332
  26. data/lib/hydra_pbcore/datastream/deprecated/instantiation.rb +0 -263
  27. data/lib/hydra_pbcore/mapper.rb +0 -50
  28. data/spec/deprecated/digital_document_spec.rb +0 -242
  29. data/spec/deprecated/document_spec.rb +0 -282
  30. data/spec/deprecated/instantiation_spec.rb +0 -214
  31. data/spec/fixtures/converted_digital_document_rrhof_1904.xml +0 -61
  32. data/spec/fixtures/converted_digital_document_rrhof_2405.xml +0 -54
  33. data/spec/fixtures/converted_document_rrhof_2439.xml +0 -19
  34. data/spec/fixtures/converted_document_rrhof_524.xml +0 -45
  35. data/spec/fixtures/converted_instantiation_rrhof_1184.xml +0 -39
  36. data/spec/fixtures/converted_rrhof_524.xml +0 -45
  37. data/spec/fixtures/converted_rrhof_524_instantiation.xml +0 -18
  38. data/spec/fixtures/deprecated/pbcore_digital_document_template.xml +0 -67
  39. data/spec/fixtures/deprecated/pbcore_document_template.xml +0 -90
  40. data/spec/fixtures/deprecated/pbcore_instantiation_template.xml +0 -62
  41. data/spec/fixtures/deprecated/pbcore_solr_digital_document_template.xml +0 -500
  42. data/spec/fixtures/deprecated/pbcore_solr_document_template.xml +0 -592
  43. data/spec/fixtures/deprecated/pbcore_solr_instantiation_template.xml +0 -784
  44. data/spec/fixtures/integration/digital_document_rrhof_1904.xml +0 -67
  45. data/spec/fixtures/integration/digital_document_rrhof_2405.xml +0 -66
  46. data/spec/fixtures/integration/document_rrhof_2439.xml +0 -54
  47. data/spec/fixtures/integration/document_rrhof_524.xml +0 -80
  48. data/spec/fixtures/integration/instantiation_rrhof_1184.xml +0 -44
  49. data/spec/integration/conversions_spec.rb +0 -76
  50. data/spec/mapper_spec.rb +0 -18
@@ -1,6 +0,0 @@
1
- module HydraPbcore::Datastream::Deprecated
2
- extend ActiveSupport::Autoload
3
- autoload :Document
4
- autoload :DigitalDocument
5
- autoload :Instantiation
6
- end
@@ -1,105 +0,0 @@
1
- module HydraPbcore::Datastream::Deprecated
2
- class DigitalDocument < ActiveFedora::NokogiriDatastream
3
-
4
- class_attribute :institution, :relator
5
- self.institution = "Rock and Roll Hall of Fame and Museum"
6
- self.relator = "MARC relator terms"
7
-
8
- include HydraPbcore::Methods
9
- include HydraPbcore::Templates
10
- include HydraPbcore::Conversions
11
-
12
- @terminology = HydraPbcore::Datastream::Deprecated::Document.terminology
13
-
14
- def self.xml_template
15
- builder = Nokogiri::XML::Builder.new do |xml|
16
-
17
- xml.pbcoreDescriptionDocument("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
18
- "xsi:schemaLocation"=>"http://www.pbcore.org/PBCore/PBCoreNamespace.html") {
19
-
20
- xml.pbcoreIdentifier(:source=>self.institution, :annotation=>"PID")
21
- xml.pbcoreTitle(:titleType=>"Main")
22
- xml.pbcoreDescription(:descriptionType=>"Description",
23
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
24
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
25
- :annotation=>"Summary"
26
- )
27
- xml.pbcoreDescription(:descriptionType=>"Table of Contents",
28
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
29
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
30
- :annotation=>"Parts List"
31
- )
32
- xml.pbcoreRelation {
33
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
34
- xml.text "Is Part Of"
35
- }
36
- xml.pbcoreRelationIdentifier(:annotation=>"Event Series")
37
- }
38
- xml.pbcoreRelation {
39
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
40
- xml.text "Is Part Of"
41
- }
42
- xml.pbcoreRelationIdentifier(:annotation=>"Archival Collection")
43
- }
44
- xml.pbcoreRelation {
45
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
46
- xml.text "Is Part Of"
47
- }
48
- xml.pbcoreRelationIdentifier(:annotation=>"Archival Series")
49
- }
50
- xml.pbcoreRelation {
51
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
52
- xml.text "Is Part Of"
53
- }
54
- xml.pbcoreRelationIdentifier(:annotation=>"Collection Number")
55
- }
56
- xml.pbcoreRelation {
57
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
58
- xml.text "Is Part Of"
59
- }
60
- xml.pbcoreRelationIdentifier(:annotation=>"Accession Number")
61
- }
62
- xml.pbcoreCoverage {
63
- xml.coverage(:annotation=>"Event Place")
64
- xml.coverageType {
65
- xml.text "Spatial"
66
- }
67
- }
68
- xml.pbcoreCoverage {
69
- xml.coverage(:annotation=>"Event Date")
70
- xml.coverageType {
71
- xml.text "Temporal"
72
- }
73
- }
74
- xml.pbcoreRightsSummary
75
- xml.pbcoreAnnotation(:annotationType=>"Notes")
76
-
77
- }
78
-
79
- end
80
- return builder.doc
81
- end
82
-
83
- def to_solr(solr_doc = Hash.new)
84
- super(solr_doc)
85
- solr_doc.merge!({"format" => "Video"})
86
-
87
- # TODO: map PBcore's three-letter language codes to full language names
88
- # Right now, everything's English.
89
- if self.find_by_terms(:language).text.match("eng")
90
- solr_doc.merge!(:language_facet => "English")
91
- else
92
- solr_doc.merge!(:language_facet => "Unknown")
93
- end
94
-
95
- # Extract 4-digit year for creation date facet in Hydra and pub_date facet in Blacklight
96
- create = self.find_by_terms(:creation_date).text.strip
97
- unless create.nil? or create.empty?
98
- solr_doc.merge!(:create_date_facet => get_year(create))
99
- solr_doc.merge!(:pub_date => get_year(create))
100
- end
101
- return solr_doc
102
- end
103
-
104
- end
105
- end
@@ -1,332 +0,0 @@
1
- module HydraPbcore::Datastream::Deprecated
2
- class Document < ActiveFedora::NokogiriDatastream
3
-
4
- class_attribute :institution, :relator
5
- self.institution = "Rock and Roll Hall of Fame and Museum"
6
- self.relator = "MARC relator terms"
7
-
8
- include HydraPbcore::Methods
9
- include HydraPbcore::Templates
10
- include HydraPbcore::Conversions
11
-
12
- set_terminology do |t|
13
- t.root(:path=>"pbcoreDescriptionDocument")
14
-
15
- t.pbc_id(:path=>"pbcoreIdentifier",
16
- :attributes=>{ :source=>self.institution, :annotation=>"PID" }
17
- )
18
-
19
- t.title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Main" }, :index_as => [:searchable, :displayable])
20
- t.alternative_title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Alternative" },
21
- :index_as => [:searchable, :displayable]
22
- )
23
- t.chapter(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Chapter" }, :index_as => [:searchable, :displayable])
24
- t.episode(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Episode" }, :index_as => [:searchable, :displayable])
25
- t.label(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Label" }, :index_as => [:searchable, :displayable])
26
- t.segment(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Segment" }, :index_as => [:searchable, :displayable])
27
- t.subtitle(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Subtitle" }, :index_as => [:searchable, :displayable])
28
- t.track(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Track" }, :index_as => [:searchable, :displayable])
29
- t.translation(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Translation" },
30
- :index_as => [:searchable, :displayable]
31
- )
32
-
33
- # This is only to display all subjects
34
- t.subject(:path=>"pbcoreSubject", :index_as => [:facetable])
35
-
36
- # Individual subject types defined for entry
37
- t.lc_subject(:path=>"pbcoreSubject",
38
- :attributes=>{
39
- :source=>"Library of Congress Subject Headings",
40
- :ref=>"http://id.loc.gov/authorities/subjects.html"
41
- },
42
- :index_as => [:displayable]
43
- )
44
- t.lc_name(:path=>"pbcoreSubject",
45
- :attributes=>{ :source=>"Library of Congress Name Authority File", :ref=>"http://id.loc.gov/authorities/names" },
46
- :index_as => [:displayable]
47
- )
48
- t.rh_subject(:path=>"pbcoreSubject",
49
- :attributes=>{ :source=>self.institution },
50
- :index_as => [:displayable]
51
- )
52
-
53
- t.summary(:path=>"pbcoreDescription",
54
- :attributes=>{
55
- :descriptionType=>"Description",
56
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
57
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
58
- :annotation=>"Summary"
59
- },
60
- :index_as => [:searchable, :displayable]
61
- )
62
-
63
- t.contents(:path=>"pbcoreDescription",
64
- :attributes=>{
65
- :descriptionType=>"Table of Contents",
66
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
67
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
68
- :annotation=>"Parts List"
69
- },
70
- :index_as => [:searchable, :displayable]
71
- )
72
-
73
- # This is only to display all genres
74
- t.genre(:path=>"pbcoreGenre", :index_as => [:facetable])
75
-
76
- # Individual genre types defined for entry
77
- t.getty_genre(:path=>"pbcoreGenre",
78
- :attributes=>{
79
- :source=>"The Getty Research Institute Art and Architecture Thesaurus",
80
- :ref=>"http://www.getty.edu/research/tools/vocabularies/aat/index.html"
81
- },
82
- :index_as => [:displayable]
83
- )
84
- t.lc_genre(:path=>"pbcoreGenre",
85
- :attributes=>{
86
- :source=>"Library of Congress Genre/Form Terms",
87
- :ref=>"http://id.loc.gov/authorities/genreForms.html"
88
- },
89
- :index_as => [:displayable]
90
- )
91
- t.lc_subject_genre(:path=>"pbcoreGenre",
92
- :attributes=>{
93
- :source=>"Library of Congress Subject Headings",
94
- :ref=>"http://id.loc.gov/authorities/subjects.html"
95
- },
96
- :index_as => [:displayable]
97
- )
98
-
99
-
100
- # Series field
101
- t.pbcoreRelation do
102
- t.pbcoreRelationIdentifier(:attributes=>{ :annotation=>"Event Series" })
103
- end
104
- t.series(:ref=>[:pbcoreRelation, :pbcoreRelationIdentifier], :index_as => [:facetable, :displayable])
105
-
106
- # Terms for time and place
107
- t.event_place(:path=>"pbcoreCoverage/coverage",
108
- :attributes => {:annotation=>"Event Place"},
109
- :index_as => [:searchable, :displayable]
110
- )
111
- t.event_date(:path=>"pbcoreCoverage/coverage",
112
- :attributes => {:annotation=>"Event Date"},
113
- :index_as => [:not_searchable, :converted_date, :displayable]
114
- )
115
-
116
- # Contributor names and roles
117
- t.contributor(:path=>"pbcoreContributor") do
118
- t.name_(:path=>"contributor")
119
- t.role_(:path=>"contributorRole",
120
- :attributes=>{ :source=>self.relator }
121
- )
122
- end
123
- t.contributor_name(:proxy=>[:contributor, :name], :index_as => [:searchable, :facetable])
124
- t.contributor_role(:proxy=>[:contributor, :role], :index_as => [:searchable, :displayable])
125
-
126
- # Publisher names and roles
127
- t.publisher(:path=>"pbcorePublisher") do
128
- t.name_(:path=>"publisher")
129
- t.role_(:path=>"publisherRole", :attributes=>{ :source=>"PBCore publisherRole" })
130
- end
131
- t.publisher_name(:proxy=>[:publisher, :name], :index_as => [:searchable, :facetable])
132
- t.publisher_role(:proxy=>[:publisher, :role], :index_as => [:searchable, :displayable])
133
-
134
- t.note(:path=>"pbcoreAnnotation", :atttributes=>{ :annotationType=>"Notes" }, :index_as => [:searchable, :displayable])
135
-
136
- #
137
- # pbcoreInstantiation fields for the physical item
138
- #
139
- t.pbcoreInstantiation do
140
- t.instantiationIdentifier(:attributes=>{
141
- :annotation=>"Barcode",
142
- :source=>self.institution
143
- })
144
- t.instantiationDate(:attributes=>{ :dateType=>"created" })
145
- t.instantiationPhysical(:attributes=>{ :source=>"PBCore instantiationPhysical" })
146
- t.instantiationStandard
147
- t.instantiationLocation
148
- t.instantiationMediaType(:attributes=>{ :source=>"PBCore instantiationMediaType" })
149
- t.instantiationGenerations(:attributes=>{ :source=>"PBCore instantiationGenerations" })
150
- t.instantiationColors
151
- t.instantiationLanguage(:attributes=>{
152
- :source=>"ISO 639.2",
153
- :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php"
154
- })
155
- t.instantiationRelation do
156
- t.arc_collection(:path=>"instantiationRelationIdentifier",
157
- :attributes=>{ :annotation=>"Archival collection" },
158
- :index_as => [:searchable, :facetable]
159
- )
160
- t.arc_series(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Archival Series" })
161
- t.col_number(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Collection Number" })
162
- t.acc_number(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Accession Number" })
163
- end
164
- t.instantiationRights do
165
- t.rightsSummary
166
- end
167
- t.inst_cond_note(:path=>"instantiationAnnotation",
168
- :attributes=>{ :annotationType=>"Condition Notes"},
169
- :index_as => [:searchable, :displayable]
170
- )
171
- t.inst_clean_note(:path=>"instantiationAnnotation",
172
- :attributes=>{ :annotationType=>"Cleaning Notes" },
173
- :index_as => [:searchable, :displayable]
174
- )
175
- end
176
- # Individual field names:
177
- t.creation_date(:ref=>[:pbcoreInstantiation, :instantiationDate], :index_as => [:not_searchable, :converted_date, :displayable])
178
- t.barcode(:ref=>[:pbcoreInstantiation, :instantiationIdentifier], :index_as => [:searchable, :displayable])
179
- t.repository(:ref=>[:pbcoreInstantiation, :instantiationLocation], :index_as => [:searchable, :displayable])
180
- t.media_format(:ref=>[:pbcoreInstantiation, :instantiationPhysical], :index_as => [:searchable, :facetable])
181
- t.standard(:ref=>[:pbcoreInstantiation, :instantiationStandard], :index_as => [:searchable, :displayable])
182
- t.media_type(:ref=>[:pbcoreInstantiation, :instantiationMediaType], :index_as => [:searchable, :displayable])
183
- t.generation(:ref=>[:pbcoreInstantiation, :instantiationGenerations], :index_as => [:searchable, :displayable])
184
- t.language(:ref=>[:pbcoreInstantiation, :instantiationLanguage], :index_as => [:searchable, :displayable])
185
- t.colors(:ref=>[:pbcoreInstantiation, :instantiationColors], :index_as => [:searchable, :displayable])
186
- t.collection(
187
- :ref=>[:pbcoreInstantiation, :instantiationRelation, :arc_collection],
188
- :index_as => [:facetable]
189
- )
190
- t.archival_series(
191
- :ref=>[:pbcoreInstantiation, :instantiationRelation, :arc_series],
192
- :index_as => [:searchable, :displayable]
193
- )
194
- t.collection_number(
195
- :ref=>[:pbcoreInstantiation, :instantiationRelation, :col_number],
196
- :index_as => [:searchable, :displayable]
197
- )
198
- t.accession_number(:ref=>[:pbcoreInstantiation, :instantiationRelation, :acc_number],
199
- :index_as => [:searchable, :displayable]
200
- )
201
- t.access(:ref=>[:pbcoreInstantiation, :instantiationRights, :rightsSummary],
202
- :index_as => [:searchable, :displayable]
203
- )
204
-
205
- # Inserted terms
206
- t.condition_note(:proxy=>[:pbcoreInstantiation, :inst_cond_note])
207
- t.cleaning_note(:proxy=>[:pbcoreInstantiation, :inst_clean_note])
208
- end
209
-
210
- def self.xml_template
211
- builder = Nokogiri::XML::Builder.new do |xml|
212
-
213
- xml.pbcoreDescriptionDocument("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
214
- "xsi:schemaLocation"=>"http://www.pbcore.org/PBCore/PBCoreNamespace.html") {
215
-
216
- xml.pbcoreIdentifier(:source=>self.institution, :annotation=>"PID")
217
- xml.pbcoreTitle(:titleType=>"Main")
218
- xml.pbcoreDescription(:descriptionType=>"Description",
219
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
220
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
221
- :annotation=>"Summary"
222
- )
223
- xml.pbcoreDescription(:descriptionType=>"Table of Contents",
224
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
225
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
226
- :annotation=>"Parts List"
227
- )
228
- xml.pbcoreRelation {
229
- xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
230
- xml.text "Is Part Of"
231
- }
232
- xml.pbcoreRelationIdentifier(:annotation=>"Event Series")
233
- }
234
- xml.pbcoreCoverage {
235
- xml.coverage(:annotation=>"Event Place")
236
- xml.coverageType {
237
- xml.text "Spatial"
238
- }
239
- }
240
- xml.pbcoreCoverage {
241
- xml.coverage(:annotation=>"Event Date")
242
- xml.coverageType {
243
- xml.text "Temporal"
244
- }
245
- }
246
- xml.pbcoreAnnotation(:annotationType=>"Notes")
247
-
248
- #
249
- # Default physical item
250
- #
251
- xml.pbcoreInstantiation {
252
-
253
- # Item details
254
- xml.instantiationIdentifier(:annotation=>"Barcode", :source=>self.institution)
255
- xml.instantiationDate(:dateType=>"created")
256
- xml.instantiationPhysical(:source=>"PBCore instantiationPhysical")
257
- xml.instantiationStandard
258
- xml.instantiationLocation {
259
- xml.text "Rock and Roll Hall of Fame and Museum,\n2809 Woodland Ave.,\nCleveland, OH, 44115\n216-515-1956\nlibrary@rockhall.org"
260
- }
261
- xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
262
- xml.text "Moving image"
263
- }
264
- xml.instantiationGenerations(:source=>"PBCore instantiationGenerations") {
265
- xml.text "Original"
266
- }
267
- xml.instantiationColors {
268
- xml.text "Color"
269
- }
270
- xml.instantiationLanguage(:source=>"ISO 639.2", :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php") {
271
- xml.text "eng"
272
- }
273
- xml.instantiationRelation {
274
- xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
275
- xml.text "Is Part Of"
276
- }
277
- xml.instantiationRelationIdentifier(:annotation=>"Archival Collection")
278
- }
279
- xml.instantiationRelation {
280
- xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
281
- xml.text "Is Part Of"
282
- }
283
- xml.instantiationRelationIdentifier(:annotation=>"Archival Series")
284
- }
285
- xml.instantiationRelation {
286
- xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
287
- xml.text "Is Part Of"
288
- }
289
- xml.instantiationRelationIdentifier(:annotation=>"Collection Number")
290
- }
291
- xml.instantiationRelation {
292
- xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
293
- xml.text "Is Part Of"
294
- }
295
- xml.instantiationRelationIdentifier(:annotation=>"Accession Number")
296
- }
297
- xml.instantiationRights {
298
- xml.rightsSummary
299
- }
300
-
301
- }
302
-
303
- }
304
-
305
- end
306
- return builder.doc
307
- end
308
-
309
- def to_solr(solr_doc = Hash.new)
310
- super(solr_doc)
311
- solr_doc.merge!({"format" => "Video"})
312
-
313
- # TODO: map PBcore's three-letter language codes to full language names
314
- # Right now, everything's English.
315
- if self.find_by_terms(:language).text.match("eng")
316
- solr_doc.merge!(:language_facet => "English")
317
- else
318
- solr_doc.merge!(:language_facet => "Unknown")
319
- end
320
-
321
- # Extract 4-digit year for creation date facet in Hydra and pub_date facet in Blacklight
322
- create = self.find_by_terms(:creation_date).text.strip
323
- unless create.nil? or create.empty?
324
- solr_doc.merge!(:create_date_facet => get_year(create))
325
- solr_doc.merge!(:pub_date => get_year(create))
326
- end
327
- return solr_doc
328
- end
329
-
330
-
331
- end
332
- end
@@ -1,263 +0,0 @@
1
- module HydraPbcore::Datastream::Deprecated
2
- class Instantiation < ActiveFedora::NokogiriDatastream
3
-
4
- class_attribute :institution
5
- self.institution = "Rock and Roll Hall of Fame and Museum"
6
-
7
- include HydraPbcore::Methods
8
- include HydraPbcore::Templates
9
- include HydraPbcore::Conversions
10
-
11
- # Note: this is not a complete PBCore document, just an instantiation node
12
- set_terminology do |t|
13
- t.root(:path=>"pbcoreDescriptionDocument")
14
-
15
- t.pbcoreInstantiation do
16
-
17
- t.instantiationIdentifier(
18
- :attributes=>{
19
- :annotation=>"Filename",
20
- :source=>self.institution
21
- },
22
- :index_as => [:displayable]
23
- )
24
- t.instantiationDate(:attributes=>{ :dateType=>"created" },
25
- :index_as => [:not_searchable, :converted_date, :displayable]
26
- )
27
- t.instantiationDigital(:attributes=>{ :source=>"EBU file formats" },
28
- :index_as => [:searchable, :facetable]
29
- )
30
- t.instantiationStandard(:index_as => [:displayable])
31
- t.instantiationLocation(:index_as => [:displayable])
32
- t.instantiationGenerations(:attributes=>{ :source=>"PBCore instantiationGenerations" },
33
- :index_as => [:displayable]
34
- )
35
- t.instantiationFileSize(:index_as => [:displayable]) do
36
- t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
37
- end
38
- t.instantiationColors(:attributes=>{ :source=>"PBCore instantiationColors" },
39
- :index_as => [:displayable]
40
- )
41
- t.instantiationMediaType(:attributes=>{ :source=>"PBCore instantiationMediaType" },
42
- :index_as => [:facetable]
43
- )
44
- t.instantiationLanguage(
45
- :attributes=>{
46
- :source=>"ISO 639.2",
47
- :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php"
48
- },
49
- :index_as => [:searchable]
50
- )
51
- t.instantiationDuration(:index_as => [:displayable])
52
-
53
- t.instantiationRights do
54
- t.rightsSummary(:index_as => [:displayable])
55
- end
56
-
57
- t.instantiationEssenceTrack do
58
- t.essenceTrackStandard(:index_as => [:displayable])
59
- t.essenceTrackEncoding( :attributes=>{ :source=>"PBCore essenceTrackEncoding" },
60
- :index_as => [:displayable]
61
- )
62
- t.essenceTrackDataRate(:index_as => [:displayable]) do
63
- t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
64
- end
65
- t.essenceTrackFrameRate(:attributes=>{ :unitsOfMeasure=>"fps" }, :index_as => [:displayable])
66
- t.essenceTrackFrameSize(:attributes=>{ :source=>"PBCore essenceTrackFrameSize" }, :index_as => [:displayable])
67
- t.essenceTrackBitDepth(:index_as => [:displayable])
68
- t.essenceTrackAspectRatio(:attributes=>{ :source=>"PBCore essenceTrackAspectRatio" },
69
- :index_as => [:displayable]
70
- )
71
- t.essenceTrackSamplingRate(:index_as => [:displayable]) do
72
- t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
73
- end
74
- t.essenceTrackAnnotation( :attributes=>{ :annotationType=>"Number of Audio Channels" },
75
- :index_as => [:displayable]
76
- )
77
- end
78
- t.video_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
79
- :path=>'instantiationEssenceTrack[essenceTrackType="Video"]'
80
- )
81
- t.audio_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
82
- :path=>'instantiationEssenceTrack[essenceTrackType="Audio"]'
83
- )
84
-
85
- t.instantiationRelation do
86
- t.instantiationRelationIdentifier(:attributes=>{ :source=>self.institution })
87
- end
88
- # The file we're describing at the root of this document preceeds the file marked "next"
89
- t.next_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
90
- :path=>'instantiationRelation[instantiationRelationType="Precedes in Sequence"]'
91
- )
92
- # The file we're describing at the root of this document comes after the file marked "previous"
93
- t.previous_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
94
- :path=>'instantiationRelation[instantiationRelationType="Follows in Sequence"]'
95
- )
96
-
97
- # Instantitation annotiations
98
- t.inst_chksum_type(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Type" },
99
- :index_as => [:displayable]
100
- )
101
- t.inst_chksum_value(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Value" },
102
- :index_as => [:displayable]
103
- )
104
- t.inst_device(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Playback Device" },
105
- :index_as => [:displayable]
106
- )
107
- t.inst_capture_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Capture Software" },
108
- :index_as => [:displayable]
109
- )
110
- t.inst_trans_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transcoding Software" },
111
- :index_as => [:displayable]
112
- )
113
- t.inst_operator(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Operator" },
114
- :index_as => [:displayable]
115
- )
116
- t.inst_trans_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transfer Notes" },
117
- :index_as => [:displayable]
118
- )
119
- t.inst_vendor(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Vendor Name" },
120
- :index_as => [:displayable]
121
- )
122
- t.inst_cond_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Condition Notes" },
123
- :index_as => [:displayable]
124
- )
125
- t.inst_clean_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Cleaning Notes" },
126
- :index_as => [:displayable]
127
- )
128
- t.inst_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Notes" },
129
- :index_as => [:displayable]
130
- )
131
- t.inst_color_space(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Color Space" },
132
- :index_as => [:displayable]
133
- )
134
- t.inst_chroma(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Chroma" },
135
- :index_as => [:displayable]
136
- )
137
-
138
- end
139
-
140
- #
141
- # Here are the actual references to the fields
142
- #
143
- t.name(:proxy=>[:pbcoreInstantiation, :instantiationIdentifier])
144
- t.location(:proxy=>[:pbcoreInstantiation, :instantiationLocation])
145
- t.date(:proxy=>[:pbcoreInstantiation, :instantiationDate])
146
- t.generation(:proxy=>[:pbcoreInstantiation, :instantiationGenerations])
147
- t.media_type(:proxy=>[:pbcoreInstantiation, :instantiationMediaType])
148
- t.file_format(:proxy=>[:pbcoreInstantiation, :instantiationDigital])
149
- t.size(:proxy=>[:pbcoreInstantiation, :instantiationFileSize])
150
- t.size_units(:proxy=>[:pbcoreInstantiation, :instantiationFileSize, :units])
151
- t.colors(:proxy=>[:pbcoreInstantiation, :instantiationColors])
152
- t.duration(:proxy=>[:pbcoreInstantiation, :instantiationDuration])
153
- t.rights_summary(:proxy=>[:pbcoreInstantiation, :instantiationRights, :rightsSummary])
154
-
155
- # Proxies to annotation fields and other fields that are not in the template
156
- t.note(:proxy=>[:pbcoreInstantiation, :inst_note])
157
- t.checksum_type(:proxy=>[:pbcoreInstantiation, :inst_chksum_type])
158
- t.checksum_value(:proxy=>[:pbcoreInstantiation, :inst_chksum_value])
159
- t.device(:proxy=>[:pbcoreInstantiation, :inst_device])
160
- t.capture_soft(:proxy=>[:pbcoreInstantiation, :inst_capture_soft])
161
- t.trans_soft(:proxy=>[:pbcoreInstantiation, :inst_trans_soft])
162
- t.operator(:proxy=>[:pbcoreInstantiation, :inst_operator])
163
- t.trans_note(:proxy=>[:pbcoreInstantiation, :inst_trans_note])
164
- t.vendor(:proxy=>[:pbcoreInstantiation, :inst_vendor])
165
- t.condition(:proxy=>[:pbcoreInstantiation, :inst_cond_note])
166
- t.cleaning(:proxy=>[:pbcoreInstantiation, :inst_clean_note])
167
- t.color_space(:proxy=>[:pbcoreInstantiation, :inst_color_space])
168
- t.chroma(:proxy=>[:pbcoreInstantiation, :inst_chroma])
169
- t.standard(:proxy=>[:pbcoreInstantiation, :instantiationStandard])
170
- t.language(:proxy=>[:pbcoreInstantiation, :instantiationLanguage])
171
-
172
- # Proxies to video essence fields
173
- t.video_standard(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackStandard])
174
- t.video_encoding(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackEncoding])
175
- t.video_bit_rate(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackDataRate])
176
- t.video_bit_rate_units(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackDataRate, :units])
177
- t.frame_rate(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackFrameRate])
178
- t.frame_size(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackFrameSize])
179
- t.video_bit_depth(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackBitDepth])
180
- t.aspect_ratio(:proxy=>[:pbcoreInstantiation, :video_essence, :essenceTrackAspectRatio])
181
-
182
- # Proxies to audio essence fields
183
- t.audio_standard(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackStandard])
184
- t.audio_encoding(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackEncoding])
185
- t.audio_bit_rate(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackDataRate])
186
- t.audio_bit_rate_units(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackDataRate, :units])
187
- t.audio_sample_rate(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackSamplingRate])
188
- t.audio_sample_rate_units(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackSamplingRate, :units])
189
- t.audio_bit_depth(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackBitDepth])
190
- t.audio_channels(:proxy=>[:pbcoreInstantiation, :audio_essence, :essenceTrackAnnotation])
191
-
192
- # Proxies to the relation fields
193
- t.next_(:proxy=>[:pbcoreInstantiation, :next_inst, :instantiationRelationIdentifier])
194
- t.previous_(:proxy=>[:pbcoreInstantiation, :previous_inst, :instantiationRelationIdentifier])
195
- end
196
-
197
- def self.xml_template
198
- builder = Nokogiri::XML::Builder.new do |xml|
199
-
200
- xml.pbcoreDescriptionDocument("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
201
- "xsi:schemaLocation"=>"http://www.pbcore.org/PBCore/PBCoreNamespace.html") {
202
-
203
- # These fields are only added so that this document will be validated. However, they
204
- # shouldn't be used for anything else here because they're in the parent Fedora object
205
- xml.pbcoreIdentifier(:annotation=>"PID", :source=>self.institution)
206
- xml.pbcoreTitle
207
- xml.pbcoreDescription
208
-
209
- xml.pbcoreInstantiation {
210
-
211
- xml.instantiationIdentifier(:annotation=>"Filename", :source=>self.institution)
212
- xml.instantiationDate(:dateType=>"created")
213
- xml.instantiationDigital(:source=>"EBU file formats")
214
- xml.instantiationLocation
215
- xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
216
- xml.text "Moving image"
217
- }
218
- xml.instantiationGenerations(:source=>"PBCore instantiationGenerations")
219
- xml.instantiationFileSize(:unitsOfMeasure=>"")
220
- xml.instantiationDuration
221
- xml.instantiationColors(:source=>"PBCore instantiationColors") {
222
- xml.text "Color"
223
- }
224
-
225
- xml.instantiationEssenceTrack {
226
- xml.essenceTrackType {
227
- xml.text "Video"
228
- }
229
- xml.essenceTrackStandard
230
- xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
231
- xml.essenceTrackDataRate(:unitsOfMeasure=>"")
232
- xml.essenceTrackFrameRate(:unitsOfMeasure=>"fps")
233
- xml.essenceTrackBitDepth
234
- xml.essenceTrackFrameSize(:source=>"PBCore essenceTrackFrameSize")
235
- xml.essenceTrackAspectRatio(:source=>"PBCore essenceTrackAspectRatio")
236
- }
237
-
238
- xml.instantiationEssenceTrack {
239
- xml.essenceTrackType {
240
- xml.text "Audio"
241
- }
242
- xml.essenceTrackStandard
243
- xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
244
- xml.essenceTrackDataRate(:unitsOfMeasure=>"")
245
- xml.essenceTrackSamplingRate(:unitsOfMeasure=>"")
246
- xml.essenceTrackBitDepth
247
- xml.essenceTrackAnnotation(:annotationType=>"Number of Audio Channels")
248
- }
249
-
250
- xml.instantiationRights {
251
- xml.rightsSummary
252
- }
253
-
254
- }
255
-
256
- }
257
-
258
- end
259
- return builder.doc
260
- end
261
-
262
- end
263
- end