Module: HydraPbcore::Templates

Extended by:
ActiveSupport::Concern
Included in:
Datastream::Document, Datastream::Instantiation
Defined in:
lib/hydra_pbcore/templates.rb

Instance Method Summary collapse

Instance Method Details

#digital_instantiationObject



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/hydra_pbcore/templates.rb', line 134

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

    xml.pbcoreInstantiation {

      xml.instantiationIdentifier(:annotation=>"Filename", :source=>HydraPbcore.config["institution"])
      xml.instantiationDate(:dateType=>"created")
      xml.instantiationDigital(:source=>"EBU file formats")
      xml.instantiationLocation
      xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
        xml.text "Moving image"
      }
      xml.instantiationGenerations(:source=>"PBCore instantiationGenerations")
      xml.instantiationFileSize(:unitsOfMeasure=>"")
      xml.instantiationDuration
      xml.instantiationColors(:source=>"PBCore instantiationColors") {
        xml.text "Color"
      }

      xml.instantiationEssenceTrack {
        xml.essenceTrackType {
          xml.text "Video"
        }
        xml.essenceTrackStandard
        xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
        xml.essenceTrackDataRate(:unitsOfMeasure=>"")
        xml.essenceTrackFrameRate(:unitsOfMeasure=>"fps")
        xml.essenceTrackBitDepth
        xml.essenceTrackFrameSize(:source=>"PBCore essenceTrackFrameSize")
        xml.essenceTrackAspectRatio(:source=>"PBCore essenceTrackAspectRatio")
      }

      xml.instantiationEssenceTrack {
        xml.essenceTrackType {
          xml.text "Audio"
        }
        xml.essenceTrackStandard
        xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
        xml.essenceTrackDataRate(:unitsOfMeasure=>"")
        xml.essenceTrackSamplingRate(:unitsOfMeasure=>"")
        xml.essenceTrackBitDepth
        xml.essenceTrackAnnotation(:annotationType=>"Number of Audio Channels")
      }

      xml.instantiationRights {
        xml.rightsSummary
      }

    }

  end
  return builder.doc
end

#insert_contributor(author = nil, role = nil) ⇒ Object



90
91
92
# File 'lib/hydra_pbcore/templates.rb', line 90

def insert_contributor(author=nil, role=nil)
  add_child_node(ng_xml.root, :contributor, author, role)
end

#insert_creator(author = nil, role = nil) ⇒ Object



86
87
88
# File 'lib/hydra_pbcore/templates.rb', line 86

def insert_creator(author=nil, role=nil)
  add_child_node(ng_xml.root, :creator, author, role)
end

#insert_date(date, *type) ⇒ Object

Create a pbcoreCoverage node with related subnodes for a date.

Parameters:

  • date

    the date to insert into the coverage node

  • type (optional)

    the annotation for the coverage node



116
117
118
# File 'lib/hydra_pbcore/templates.rb', line 116

def insert_date(date, *type)
  add_child_node(ng_xml.root, :event_date, date, *type)
end

#insert_identifier(identifier, annotation = nil, source = ) ⇒ Object



130
131
132
# File 'lib/hydra_pbcore/templates.rb', line 130

def insert_identifier(identifier, annotation=nil, source=HydraPbcore.config["institution"])
  add_child_node(ng_xml.root, :identifier, identifier, source, annotation)
end

#insert_next(file) ⇒ Object



98
99
100
# File 'lib/hydra_pbcore/templates.rb', line 98

def insert_next(file)
  add_child_node(find_by_terms(:pbcoreInstantiation).first, :next, file)
end

#insert_place(location, *type) ⇒ Object

Create a pbcoreCoverage node with related subnodes for a place.

Parameters:

  • location

    the location to insert into the coverage node

  • type (optional)

    the annotation for the coverage node



109
110
111
# File 'lib/hydra_pbcore/templates.rb', line 109

def insert_place(location, *type)
  add_child_node(ng_xml.root, :event_place, location, *type)
end

#insert_previous(file) ⇒ Object



102
103
104
# File 'lib/hydra_pbcore/templates.rb', line 102

def insert_previous(file)
  add_child_node(find_by_terms(:pbcoreInstantiation).first, :previous, file)
end

#insert_publisher(publisher = nil, role = nil) ⇒ Object



94
95
96
# File 'lib/hydra_pbcore/templates.rb', line 94

def insert_publisher(publisher=nil, role=nil)
  add_child_node(ng_xml.root, :publisher, publisher, role)
end

#insert_relation(value, annotation) ⇒ Object

deprecated



121
122
123
124
# File 'lib/hydra_pbcore/templates.rb', line 121

def insert_relation(value, annotation)
  puts "insert_relation is deprecated. Use is_part_of instead."
  add_child_node(ng_xml.root, :relation, value, annotation)
end

#is_part_of(value, opts = {}) ⇒ Object



126
127
128
# File 'lib/hydra_pbcore/templates.rb', line 126

def is_part_of(value, opts={})
  add_child_node(ng_xml.root, :is_part_of, value, opts)
end

#physical_instantiationObject



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/hydra_pbcore/templates.rb', line 188

def physical_instantiation
  builder = Nokogiri::XML::Builder.new do |xml|
    
    xml.pbcoreInstantiation {

      # Item details
      xml.instantiationIdentifier(:annotation=>"Barcode", :source=>HydraPbcore.config["institution"])
      xml.instantiationDate(:dateType=>"created")
      xml.instantiationPhysical(:source=>"PBCore instantiationPhysical")
      xml.instantiationStandard
      xml.instantiationLocation {
        xml.text HydraPbcore.config["address"]
      }
      xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
        xml.text "Moving image"
      }
      xml.instantiationGenerations(:source=>"PBCore instantiationGenerations") {
        xml.text "Original"
      }
      xml.instantiationColors(:source=>"PBCore 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.instantiationRights {
        xml.rightsSummary
      }

    }
  
  end
  return builder.doc
end