module HydraPbcore::Datastream::Deprecated class DigitalDocument < ActiveFedora::NokogiriDatastream class_attribute :institution, :relator self.institution = "Rock and Roll Hall of Fame and Museum" self.relator = "MARC relator terms" include HydraPbcore::Methods include HydraPbcore::Templates include HydraPbcore::Conversions @terminology = HydraPbcore::Datastream::Deprecated::Document.terminology 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.pbcoreRelation { xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") { xml.text "Is Part Of" } xml.pbcoreRelationIdentifier(:annotation=>"Archival Collection") } xml.pbcoreRelation { xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") { xml.text "Is Part Of" } xml.pbcoreRelationIdentifier(:annotation=>"Archival Series") } xml.pbcoreRelation { xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") { xml.text "Is Part Of" } xml.pbcoreRelationIdentifier(:annotation=>"Collection Number") } xml.pbcoreRelation { xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") { xml.text "Is Part Of" } xml.pbcoreRelationIdentifier(:annotation=>"Accession Number") } 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.pbcoreRightsSummary xml.pbcoreAnnotation(:annotationType=>"Notes") } end return builder.doc end 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 end end