Skip to content

Commit

Permalink
Check whether druid matches most recent version object_id
Browse files Browse the repository at this point in the history
  Fixes #71
  • Loading branch information
tallenaz committed Nov 3, 2017
1 parent e289d36 commit f03195d
Show file tree
Hide file tree
Showing 67 changed files with 2,124 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/moab/stanford.rb
Expand Up @@ -5,6 +5,7 @@
require 'stanford/storage_services'
require 'stanford/active_fedora_object'
require 'stanford/moab_storage_directory'
require 'stanford/storage_object_validator'

# Stanford is a module that isolates classes specific to the Stanford Digital Repository
#
Expand Down
12 changes: 12 additions & 0 deletions lib/moab/storage_object_validator.rb
Expand Up @@ -176,5 +176,17 @@ def check_required_manifest_files(dir, version)
errors << result if result
errors
end

def latest_moab_version
sub_dirs(storage_obj_path).last
end

def latest_manifest_inventory
"#{storage_obj_path}/#{latest_moab_version}/#{MANIFEST_INVENTORY_PATH}"
end

def object_id_from_manifest_inventory
Nokogiri::XML(File.open(latest_manifest_inventory)).at_xpath('//fileInventory/@objectId').value
end
end
end
31 changes: 31 additions & 0 deletions lib/stanford/storage_object_validator.rb
@@ -0,0 +1,31 @@
require 'moab'

module Stanford
# druids are Stanford specific entities
class StorageObjectValidator < Moab::StorageObjectValidator
# error codes
DRUID_MISMATCH = 9

ERROR_CODE_TO_MESSAGES = {
DRUID_MISMATCH => "manifestInventory object_id does not match druid"
}.freeze

def identify_druid
druid_from_filepath == object_id_from_manifest_inventory ? [] : [result_hash(DRUID_MISMATCH)]
end

private

def result_hash(response_code, addl=nil)
{ response_code => error_code_msg(response_code, addl) }
end

def error_code_msg(response_code, addl=nil)
format(ERROR_CODE_TO_MESSAGES[response_code], addl: addl)
end

def druid_from_filepath
"druid:#{File.basename(storage_obj_path)}"
end
end
end
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- objectId matches druid implied in file path -->
<fileInventory type="manifests" objectId="druid:bz514sm9647" versionId="3" inventoryDatetime="2017-06-25T17:57:55Z" fileCount="4" byteCount="17077" blockCount="18">
<fileGroup groupId="manifests" dataSource="/services-disk12/sdr2objects/bz/514/sm/9647/bz514sm9647/v0003/manifests" fileCount="4" byteCount="17077" blockCount="18">
<file>
Expand Down
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<fileInventory type="manifests" objectId="druid:jj925bx9565" versionId="2" inventoryDatetime="2017-06-13T20:47:45Z" fileCount="4" byteCount="15543" blockCount="17">
<!-- objectId does not match druid implied in filepath -->
<fileInventory type="manifests" objectId="druid:jk925bx9565" versionId="2" inventoryDatetime="2017-06-13T20:47:45Z" fileCount="4" byteCount="15543" blockCount="17">
<fileGroup groupId="manifests" dataSource="/services-disk12/sdr2objects/jj/925/bx/9565/jj925bx9565/v0002/manifests" fileCount="4" byteCount="15543" blockCount="17">
<file>
<fileSignature size="5368" md5="4bae0effe195ef9351e9d981607d27db" sha1="6f470e91254009db47ccba511a867576a6d89185" sha256="99a242730874e42b41fbc4c87f60f8f62447d1220c3d92e6cad1ce3ab3e5df95"/>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,15 @@
<contentMetadata objectId="bz514sm9647" type="image">
<resource id="bz514sm9647_1" sequence="1" type="image">
<label>Image 1</label>
<file id="SC1258_FUR_032a.jpg" preserve="yes" publish="no" shelve="no" mimetype="image/jpeg" size="167784">
<checksum type="md5">42e9d4c0a766f837e5a2f5610d9f258e</checksum>
<checksum type="sha1">5bfc6052b0e458e0aa703a0a6853bb9c112e0695</checksum>
<imageData width="624" height="461"/>
</file>
<file id="SC1258_FUR_032a.jp2" mimetype="image/jp2" size="54230" preserve="no" publish="yes" shelve="yes">
<checksum type="md5">57353f40aaf2375fe6f34156fe8cfba6</checksum>
<checksum type="sha1">38f770eeee49fc2b2caebc9b3467513b618dc3e3</checksum>
<imageData width="624" height="461"/>
</file>
</resource>
</contentMetadata>
@@ -0,0 +1,93 @@
<mods xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.loc.gov/mods/v3" version="3.5" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
<titleInfo>
<title>Forma Urbis Romae</title>
<subTitle>Tiber River near Tiber Island</subTitle>
<partNumber>32a</partNumber>
<partName>Stanford#</partName>
</titleInfo>
<titleInfo>
<partNumber>32a</partNumber>
<partName>AG1980#</partName>
</titleInfo>
<name type="personal" usage="primary" authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n82000920">
<namePart>Severus, Lucius Septimius, Emperor of Rome, 146-211</namePart>
<role>
<roleTerm type="code" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/spn">spn</roleTerm>
<roleTerm type="text" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/spn">Sponsor</roleTerm>
</role>
</name>
<name type="personal" authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n93003619">
<namePart>Levoy, Marc</namePart>
<role>
<roleTerm type="code" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/pht">pht</roleTerm>
<roleTerm type="text" authority="marcrelator" authorityURI="http://id.loc.gov/vocabulary/relators" valueURI="http://id.loc.gov/vocabulary/relators/pht">Photographer</roleTerm>
</role>
</name>
<typeOfResource>cartographic</typeOfResource>
<genre authority="aat" authorityURI="http://vocab.getty.edu/aat" valueURI="http://vocab.getty.edu/aat/300028233">historical maps</genre>
<originInfo displayLabel="Place of creation" eventType="production">
<place>
<placeTerm type="code" authority="marccountry" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n79039816">it</placeTerm>
<placeTerm type="text" authority="marccountry" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n79039816">Rome</placeTerm>
</place>
<dateCreated keyDate="yes" encoding="w3cdtf" qualifier="approximate" point="start">203</dateCreated>
<dateCreated encoding="w3cdtf" qualifier="approximate" point="end">211</dateCreated>
</originInfo>
<originInfo>
<dateCaptured>2001</dateCaptured>
</originInfo>
<language>
<languageTerm authority="iso639-2b" authorityURI="http://id.loc.gov/vocabulary/iso639-2" valueURI="http://id.loc.gov/vocabulary/iso639-2/grc" type="code">grc</languageTerm>
<languageTerm authority="iso639-2b" authorityURI="http://id.loc.gov/vocabulary/iso639-2" valueURI="http://id.loc.gov/vocabulary/iso639-2/grc" type="text">Greek, Ancient (to 1453)</languageTerm>
</language>
<physicalDescription>
<form authority="aat" authorityURI="http://vocab.getty.edu/aat" valueURI="http://vocab.getty.edu/aat/300028233">historical maps</form>
<extent>1 photograph</extent>
<reformattingQuality>access</reformattingQuality>
<digitalOrigin>born digital</digitalOrigin>
<internetMediaType>image/jpeg</internetMediaType>
</physicalDescription>
<abstract displayLabel="Abstract">The Forma Urbis Romae or Severan Marble Plan is a massive marble map of ancient Rome, created under the emperor Septimius Severus between 203 and 211. It originally measured 18 m (60 feet) wide by 13 m (45 feet) high and was carved into 150 marble slabs mounted on an interior wall of the Temple of Peace.
Created at a scale of approximately 1 to 240, the map was detailed enough to show the floor plans of nearly every temple, bath, and insula in the central Roman city. The boundaries of the plan were decided based on the available space on the marble, instead of by geographical or political borders as modern maps usually are.
The map was oriented with south at the top. On the map are names and plans of public buildings, streets, and private homes. The creators used signs and details like columns and staircases.
The Plan was gradually destroyed during the Middle Ages, with the marble stones being used as building materials or for making lime. In 1562, the young antiquarian sculptor Giovanni Antonio Dosio excavated fragments of the Forma Urbis from a site near the Church of SS. Cosma e Damiano, under the direction of the humanist condottiere Torquato Conti, who had purchased excavation rights from the canons of the church. Conti made a gift of the recovered fragments to Cardinal Alessandro Farnese, who entrusted them to his librarian Onofrio Panvinio and his antiquarian Fulvio Orsini
In all about 10% of the original surface area of the plan has since been recovered, in the form of over one thousand marble fragments, which are kept in the Palazzo dei Conservatori of the Capitoline Museums.</abstract>
<subject authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n79018704">
<geographic>Rome (Italy)</geographic>
<topic>Topography</topic>
</subject>
<subject authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n79018704">
<geographic>Rome (Italy)</geographic>
<topic>Antiquities</topic>
</subject>
<subject authority="naf" authorityURI="http://id.loc.gov/authorities/names" valueURI="http://id.loc.gov/authorities/names/n79018704">
<geographic>Rome (Italy)</geographic>
<topic>Maps</topic>
</subject>
<subject>
<cartographics>
<scale>1:240</scale>
</cartographics>
</subject>
<identifier type="local" displayLabel="Slab">V-13</identifier>
<location>
<physicalLocation type="repository" authority="naf" valueURI="http://id.loc.gov/authorities/names/no2014019980">Stanford University. Libraries. Department of Special Collections and University Archives</physicalLocation>
<shelfLocator>SC1258</shelfLocator>
<url usage="primary display">https://purl.stanford.edu/bz514sm9647</url>
</location>
<relatedItem type="host" displayLabel="Finding Aid">
<titleInfo>
<title>Marc Levoy Papers (SC1258)</title>
</titleInfo>
<location>
<url>http://www.oac.cdlib.org/findaid/ark:/13030/c8x06ctg</url>
</location>
</relatedItem>
<recordInfo>
<languageOfCataloging>
<languageTerm type="code" authority="iso639-2b" authorityURI="http://id.loc.gov/vocabulary/iso639-2" valueURI="http://id.loc.gov/vocabulary/iso639-2/eng">eng</languageTerm>
</languageOfCataloging>
<recordContentSource authority="marcorg" authorityURI="http://id.loc.gov/vocabulary/organizations" valueURI="http://id.loc.gov/vocabulary/organizations/cst">CSt</recordContentSource>
<recordOrigin>human prepared</recordOrigin>
</recordInfo>
</mods>
@@ -0,0 +1,13 @@
<identityMetadata>
<sourceId source="sul">SC1258_FUR_32a</sourceId>
<objectId>druid:bz514sm9647</objectId>
<objectCreator>DOR</objectCreator>
<objectLabel>Forma Urbis Romae</objectLabel>
<objectType>item</objectType>
<otherId name="label"/>
<otherId name="uuid">09a1e81c-2637-11e7-9a82-005056a7ed61</otherId>
<tag>Process : Content Type : Image</tag>
<tag>Project : Marc Levoy Papers</tag>
<tag>sul : SC1258</tag>
<tag>Registered By : dhartwig</tag>
</identityMetadata>
@@ -0,0 +1,7 @@
<provenanceMetadata objectId="druid:bz514sm9647">
<agent name="DOR">
<what object="druid:bz514sm9647">
<event who="DOR-accessionWF" when="2017-05-30T11:52:27-07:00">DOR Common Accessioning completed</event>
</what>
</agent>
</provenanceMetadata>
@@ -0,0 +1,10 @@

<rdf:RDF xmlns:fedora="info:fedora/fedora-system:def/relations-external#" xmlns:fedora-model="info:fedora/fedora-system:def/model#" xmlns:hydra="http://projecthydra.org/ns/relations#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/druid:bz514sm9647">
<hydra:isGovernedBy rdf:resource="info:fedora/druid:yf767bj4831"></hydra:isGovernedBy>
<fedora-model:hasModel rdf:resource="info:fedora/afmodel:Dor_Item"></fedora-model:hasModel>
<fedora-model:hasModel rdf:resource="info:fedora/afmodel:Dor_Abstract"></fedora-model:hasModel>
<fedora:isMemberOf rdf:resource="info:fedora/druid:yw234wp7868"></fedora:isMemberOf>
<fedora:isMemberOfCollection rdf:resource="info:fedora/druid:yw234wp7868"></fedora:isMemberOfCollection>
</rdf:Description>
</rdf:RDF>
@@ -0,0 +1,18 @@
<rightsMetadata>
<access type="discover">
<machine>
<world/>
</machine>
</access>
<access type="read">
<machine>
<world/>
</machine>
</access>
<use>
<human type="useAndReproduction">The materials are open for research use and may be used freely for non-commercial purposes with an attribution. For commercial permission requests, please contact the Stanford University Archives (universityarchives@stanford.edu).</human>
</use>
<copyright>
<human>Copyright (c) The Board of Trustees of the Leland Stanford Junior University. All rights reserved.</human>
</copyright>
</rightsMetadata>
@@ -0,0 +1,104 @@
<technicalMetadata xmlns:jhove="http://hul.harvard.edu/ois/xml/ns/jhove" xmlns:mix="http://www.loc.gov/mix/v10" xmlns:textmd="info:lc/xmlns/textMD-v3" objectId="druid:bz514sm9647" datetime="2017-05-30T18:51:08Z">
<file id="SC1258_FUR_032a.jpg">
<jhove:reportingModule release="1.2" date="2007-02-13">JPEG-hul</jhove:reportingModule>
<jhove:lastModified>2017-05-30T11:48:04-07:00</jhove:lastModified>
<jhove:size>167784</jhove:size>
<jhove:format>JPEG</jhove:format>
<jhove:version>1.01</jhove:version>
<jhove:status>Well-Formed and valid</jhove:status>
<jhove:sigMatch>
<jhove:module>JPEG-hul</jhove:module>
</jhove:sigMatch>
<jhove:mimeType>image/jpeg</jhove:mimeType>
<jhove:profiles>
<jhove:profile>JFIF</jhove:profile>
</jhove:profiles>
<jhove:properties>
<mix:mix>
<mix:BasicDigitalObjectInformation>
<mix:byteOrder>big_endian</mix:byteOrder>
<mix:Compression>
<mix:compressionScheme>6</mix:compressionScheme>
</mix:Compression>
</mix:BasicDigitalObjectInformation>
<mix:BasicImageInformation>
<mix:BasicImageCharacteristics>
<mix:imageWidth>624</mix:imageWidth>
<mix:imageHeight>461</mix:imageHeight>
<mix:PhotometricInterpretation>
<mix:colorSpace>6</mix:colorSpace>
</mix:PhotometricInterpretation>
</mix:BasicImageCharacteristics>
</mix:BasicImageInformation>
<mix:ImageAssessmentMetadata>
<mix:SpatialMetrics>
<mix:samplingFrequencyUnit>3</mix:samplingFrequencyUnit>
<mix:xSamplingFrequency>
<mix:numerator>28</mix:numerator>
</mix:xSamplingFrequency>
<mix:ySamplingFrequency>
<mix:numerator>28</mix:numerator>
</mix:ySamplingFrequency>
</mix:SpatialMetrics>
<mix:ImageColorEncoding>
<mix:bitsPerSample>
<mix:bitsPerSampleValue>8,8,8</mix:bitsPerSampleValue>
<mix:bitsPerSampleUnit>integer</mix:bitsPerSampleUnit>
</mix:bitsPerSample>
<mix:samplesPerPixel>3</mix:samplesPerPixel>
</mix:ImageColorEncoding>
</mix:ImageAssessmentMetadata>
</mix:mix>
</jhove:properties>
</file>
<file id="SC1258_FUR_032a.jp2">
<jhove:reportingModule release="1.3" date="2007-01-08">JPEG2000-hul</jhove:reportingModule>
<jhove:lastModified>2017-05-30T11:48:40-07:00</jhove:lastModified>
<jhove:size>54230</jhove:size>
<jhove:format>JPEG 2000</jhove:format>
<jhove:status>Well-Formed and valid</jhove:status>
<jhove:sigMatch>
<jhove:module>JPEG2000-hul</jhove:module>
</jhove:sigMatch>
<jhove:mimeType>image/jp2</jhove:mimeType>
<jhove:profiles>
<jhove:profile>JP2</jhove:profile>
</jhove:profiles>
<jhove:properties>
<mix:mix>
<mix:BasicDigitalObjectInformation>
<mix:byteOrder>big_endian</mix:byteOrder>
<mix:Compression>
<mix:compressionScheme>34712</mix:compressionScheme>
</mix:Compression>
</mix:BasicDigitalObjectInformation>
<mix:BasicImageInformation>
<mix:BasicImageCharacteristics>
<mix:imageWidth>624</mix:imageWidth>
<mix:imageHeight>461</mix:imageHeight>
</mix:BasicImageCharacteristics>
</mix:BasicImageInformation>
<mix:ImageAssessmentMetadata>
<mix:SpatialMetrics>
<mix:samplingFrequencyUnit>3</mix:samplingFrequencyUnit>
<mix:xSamplingFrequency>
<mix:numerator>711200</mix:numerator>
<mix:denominator>25400</mix:denominator>
</mix:xSamplingFrequency>
<mix:ySamplingFrequency>
<mix:numerator>711200</mix:numerator>
<mix:denominator>25400</mix:denominator>
</mix:ySamplingFrequency>
</mix:SpatialMetrics>
<mix:ImageColorEncoding>
<mix:bitsPerSample>
<mix:bitsPerSampleValue>8,8,8</mix:bitsPerSampleValue>
<mix:bitsPerSampleUnit>integer</mix:bitsPerSampleUnit>
</mix:bitsPerSample>
<mix:samplesPerPixel>3</mix:samplesPerPixel>
</mix:ImageColorEncoding>
</mix:ImageAssessmentMetadata>
</mix:mix>
</jhove:properties>
</file>
</technicalMetadata>
@@ -0,0 +1,5 @@
<versionMetadata>
<version versionId="1" tag="1.0.0">
<description>Initial Version</description>
</version>
</versionMetadata>

0 comments on commit f03195d

Please sign in to comment.