archivematica / Issues

Issues repository for the Archivematica project
GNU Affero General Public License v3.0
16 stars 1 forks source link

Problem: Mets-reader-writer (METSRW) doesn't offer a document level flag to turn off output of normative (logical) structmap #1272

Open ross-spencer opened 4 years ago

ross-spencer commented 4 years ago

Expected behaviour

Mets-reader-writer can eventually replaces the create_mets_v2 script during Ingest in Archivematica. In this instance that means when we write out to file, we can turn off the generation/output of the normative structmap. The normative structmap is used largely for documenting empty directories in Archivematica. It is a logical structmap (an abstract representation) vs. a physical structmap (what's actually there).

Current behaviour

There is no way to turn off normative structmap generation in mets-reader-writer according to the API: see wrte.

To output components of mets without the normative structmap a developer can serialize the structmap on its own using it's specific options: see serializing a structmap. The developer can then manually attach this to some other Elementree object.

Where do we see this in archivematica?

Right now, we're actually outputting a normative structmap at all times when we create the transfer METS file because that script uses metsrw: here

When we arrive at AIP METS generation it is optional whether or not we create a normative structmap: here. If we naively replace functions in this script with metsrw and ask the document to output itself to file, we will get this additional piece of XML.

Steps to reproduce

Create the simplest metsrw document, e.g. from the README.md:

# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function

import lxml.etree as etree
import uuid

import metsrw

mets = metsrw.METSDocument()
directory_1 = metsrw.FSEntry(label="test", path="test", type="Directory")
file_1 = metsrw.FSEntry(label="hello.pdf", path="test/hello.pdf", type="Item", file_uuid=str(uuid.uuid4()))
directory_1.children.append(file_1)
file_2 = metsrw.FSEntry(label="demo.jpg", path="test/demo.jpg", type="Item", file_uuid=str(uuid.uuid4()))
directory_1.children.append(file_2)
mets.append_file(directory_1)
# Output to the console...
print(mets.tostring())

Use this as a basis to try and change the flags and so forth for fun.

Transfer METS

Also, create a transfer METS, and download it. You will find a normative structmap, e.g. for Demo Transfer CSV (regardless of processing configuration options):

  <mets:structMap ID="structMap_2" LABEL="Normative Directory Structure" TYPE="logical">
    <mets:div TYPE="Directory" LABEL="demo_csv-f3325bd5-f61c-4e36-b13d-3a1cd4e61999">
      <mets:div TYPE="Directory" LABEL="logs" ADMID="amdSec_27">
        <mets:div TYPE="Directory" LABEL="fileMeta" DMDID="dmdSec_13"/>
      </mets:div>
      <mets:div TYPE="Directory" LABEL="metadata" ADMID="amdSec_28">
        <mets:div TYPE="Directory" LABEL="submissionDocumentation" ADMID="amdSec_29"/>
      </mets:div>
      <mets:div TYPE="Directory" LABEL="objects">
        <mets:div TYPE="Item" LABEL="View_from_lookout_over_Queenstown_towards_the_Remarkables_in_spring.jpg"/>
        <mets:div TYPE="Directory" LABEL="artwork" ADMID="amdSec_26">
          <mets:div TYPE="Item" LABEL="MARBLES.TGA"/>
          <mets:div TYPE="Item" LABEL="Montreal.png"/>
        </mets:div>
        <mets:div TYPE="Item" LABEL="beihai.tif"/>
        <mets:div TYPE="Item" LABEL="bird.mp3"/>
        <mets:div TYPE="Item" LABEL="ocr-image.png"/>
        <mets:div TYPE="Item" LABEL="piiTestDataCreditCardNumbers.txt"/>
      </mets:div>
    </mets:div>
  </mets:structMap>

Your environment (version of Archivematica, operating system, other relevant details)

METRSW version 0.3.15. AM version: 1.11.x onwards.

Related issues

Transfer METS characterization output appears in AIP METS: https://github.com/archivematica/Issues/issues/1101.


For Artefactual use:

Before you close this issue, you must check off the following:

ross-spencer commented 3 years ago

Affects https://github.com/archivematica/Issues/issues/884