Class: HydraPbcore::Datastream::Deprecated::Document

Inherits:
ActiveFedora::NokogiriDatastream
  • Object
show all
Includes:
Conversions, Methods, Templates
Defined in:
lib/hydra_pbcore/datastream/deprecated/document.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Conversions

#clean_document, #coverage_type, #is_event_series?, #to_document, #to_instantiation, #to_physical_instantiation

Methods included from Templates

#digital_instantiation, #insert_contributor, #insert_creator, #insert_date, #insert_next, #insert_place, #insert_previous, #insert_publisher, #insert_relation, #physical_instantiation

Methods included from Methods

#get_year, #remove_node, #to_pbcore_xml, #valid?

Class Method Details

.xml_templateObject



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/hydra_pbcore/datastream/deprecated/document.rb', line 210

def self.xml_template
  builder = Nokogiri::XML::Builder.new do |xml|

    xml.pbcoreDescriptionDocument("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
      "xsi:schemaLocation"=>"http://www.pbcore.org/PBCore/PBCoreNamespace.html") {

      xml.pbcoreIdentifier(:source=>self.institution, :annotation=>"PID")
      xml.pbcoreTitle(:titleType=>"Main")
      xml.pbcoreDescription(:descriptionType=>"Description",
        :descriptionTypeSource=>"pbcoreDescription/descriptionType",
        :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
        :annotation=>"Summary"
      )
      xml.pbcoreDescription(:descriptionType=>"Table of Contents",
        :descriptionTypeSource=>"pbcoreDescription/descriptionType",
        :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
        :annotation=>"Parts List"
      )
      xml.pbcoreRelation {
        xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
          xml.text "Is Part Of"
        }
        xml.pbcoreRelationIdentifier(:annotation=>"Event Series")
      }
      xml.pbcoreCoverage {
        xml.coverage(:annotation=>"Event Place")
        xml.coverageType {
          xml.text "Spatial"
        }
      }
      xml.pbcoreCoverage {
        xml.coverage(:annotation=>"Event Date")
        xml.coverageType {
          xml.text "Temporal"
        }
      }
      xml.pbcoreAnnotation(:annotationType=>"Notes")

      #
      # Default physical item
      #
      xml.pbcoreInstantiation {

        # Item details
        xml.instantiationIdentifier(:annotation=>"Barcode", :source=>self.institution)
        xml.instantiationDate(:dateType=>"created")
        xml.instantiationPhysical(:source=>"PBCore instantiationPhysical")
        xml.instantiationStandard
        xml.instantiationLocation {
          xml.text "Rock and Roll Hall of Fame and Museum,\n2809 Woodland Ave.,\nCleveland, OH, 44115\n216-515-1956\[email protected]"
        }
        xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
          xml.text "Moving image"
        }
        xml.instantiationGenerations(:source=>"PBCore instantiationGenerations") {
          xml.text "Original"
        }
        xml.instantiationColors {
          xml.text "Color"
        }
        xml.instantiationLanguage(:source=>"ISO 639.2", :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php") {
          xml.text "eng"
        }
        xml.instantiationRelation {
          xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
            xml.text "Is Part Of"
          }
          xml.instantiationRelationIdentifier(:annotation=>"Archival Collection")
        }
        xml.instantiationRelation {
          xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
            xml.text "Is Part Of"
          }
          xml.instantiationRelationIdentifier(:annotation=>"Archival Series")
        }
        xml.instantiationRelation {
          xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
            xml.text "Is Part Of"
          }
          xml.instantiationRelationIdentifier(:annotation=>"Collection Number")
        }
        xml.instantiationRelation {
          xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
            xml.text "Is Part Of"
          }
          xml.instantiationRelationIdentifier(:annotation=>"Accession Number")
        }
        xml.instantiationRights {
          xml.rightsSummary
        }

      }

    }

  end
  return builder.doc
end

Instance Method Details

#to_solr(solr_doc = Hash.new) ⇒ Object



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/hydra_pbcore/datastream/deprecated/document.rb', line 309

def to_solr(solr_doc = Hash.new)
  super(solr_doc)
  solr_doc.merge!({"format" => "Video"})

  # TODO: map PBcore's three-letter language codes to full language names
  # Right now, everything's English.
  if self.find_by_terms(:language).text.match("eng")
    solr_doc.merge!(:language_facet => "English")
  else
    solr_doc.merge!(:language_facet => "Unknown")
  end

  # Extract 4-digit year for creation date facet in Hydra and pub_date facet in Blacklight
  create = self.find_by_terms(:creation_date).text.strip
  unless create.nil? or create.empty?
    solr_doc.merge!(:create_date_facet => get_year(create))
    solr_doc.merge!(:pub_date => get_year(create))
  end
  return solr_doc
end