Class: Stanford::DorMetadata
- Inherits:
-
Object
- Object
- Stanford::DorMetadata
- Defined in:
- lib/stanford/dor_metadata.rb
Overview
Copyright © 2012 by The Board of Trustees of the Leland Stanford Junior University. All rights reserved. See LICENSE for details.
Stanford-specific utility methods for interfacing with DOR metadata files
Data Model
-
DorMetadata = utility methods for interfacing with Stanford metadata files (esp contentMetadata)
-
ContentInventory [1..1] = utilities for transforming contentMetadata to versionInventory and doing comparsions
-
ActiveFedoraObject [1..*] = utility for extracting content or other information from a Fedora Instance
-
Instance Attribute Summary collapse
-
#digital_object_id ⇒ String
The digital object identifier (druid).
-
#version_id ⇒ Integer
@versionId = The ordinal version number.
Instance Method Summary collapse
- #initialize(digital_object_id, version_id = nil) ⇒ Stanford::DorMetadata constructor
-
#inventory_from_directory(directory, version_id = nil) ⇒ FileInventory
Inventory of the files under the specified directory.
Constructor Details
#initialize(digital_object_id, version_id = nil) ⇒ Stanford::DorMetadata
25 26 27 28 |
# File 'lib/stanford/dor_metadata.rb', line 25 def initialize(digital_object_id, version_id=nil) @digital_object_id = digital_object_id @version_id = version_id end |
Instance Attribute Details
#digital_object_id ⇒ String
Returns The digital object identifier (druid).
17 18 19 |
# File 'lib/stanford/dor_metadata.rb', line 17 def digital_object_id @digital_object_id end |
#version_id ⇒ Integer
Returns @versionId = The ordinal version number.
20 21 22 |
# File 'lib/stanford/dor_metadata.rb', line 20 def version_id @version_id end |
Instance Method Details
#inventory_from_directory(directory, version_id = nil) ⇒ FileInventory
Returns Inventory of the files under the specified directory.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/stanford/dor_metadata.rb', line 34 def inventory_from_directory(directory, version_id=nil) version_id ||= @version_id version_inventory = FileInventory.new(:type=>'version',:digital_object_id=>@digital_object_id, :version_id=>version_id) = IO.read(File.join(directory,'contentMetadata.xml')) content_group = ContentInventory.new.group_from_cm(, 'preserve' ) version_inventory.groups << content_group = FileGroup.new(:group_id=>'metadata').group_from_directory(directory) version_inventory.groups << version_inventory end |