Class: UWDC::RelsExt

Inherits:
Mets
  • Object
show all
Defined in:
lib/uwdc/rels_ext.rb

Overview

Return the CMODELS related to METS file objects

Instance Attribute Summary

Attributes inherited from Mets

#id, #xml

Instance Method Summary collapse

Methods inherited from Mets

#display, #dublin_core, #file_sec, #initialize, #mods, #origin, #rels_ext, #struct_map, #to_json, #to_ruby, #to_xml

Constructor Details

This class inherits a constructor from UWDC::Mets

Instance Method Details

#modelsObject



8
9
10
11
12
13
# File 'lib/uwdc/rels_ext.rb', line 8

def models
  nodes.xpath("//amdSec[contains(@ID,'RELS-EXT')]").inject({}) do |result, node|
    result["#{node.attribute('ID')}"] = pick_attribute(node.xpath(".//hasModel"), 'resource')
    result
  end
end

#nodesObject



4
5
6
# File 'lib/uwdc/rels_ext.rb', line 4

def nodes
  @xml.nodes.xpath("//amdSec[contains(@ID,'#{@id}')]//RDF[1]")
end