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