Class: HydraPbcore::Datastream::Deprecated::DigitalDocument

Inherits:
ActiveFedora::NokogiriDatastream
  • Object
show all
Includes:
Conversions, Methods, Templates
Defined in:
lib/hydra_pbcore/datastream/deprecated/digital_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



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/hydra_pbcore/datastream/deprecated/digital_document.rb', line 14

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

Instance Method Details

#to_solr(solr_doc = Hash.new) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/hydra_pbcore/datastream/deprecated/digital_document.rb', line 83

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