kitodo / kitodo-production

Kitodo.Production is a workflow management tool for mass digitization and is part of the Kitodo Digital Library Suite.
http://www.kitodo.org/software/kitodoproduction/
GNU General Public License v3.0
64 stars 63 forks source link

Export copy rule and flat documents #283

Closed henning-gerhardt closed 9 years ago

henning-gerhardt commented 9 years ago

Exporting a flat document like a monograph without any structure element with following export copy rules

copyData.onExport=/@ProcessID \= $process.id;/*[0]@ProcessID \= $process.id

raising a null pointer exception in task manager

goobi-export-copyrule-20141210

We get an null pointer exception too if this is not an asynchronous export.

After documentation the asterisk should work for "any element". Does this not include none element?

Work-a-round for now is to define multiple export copy rules for explicit any multi part documents which should get process id.

matthias-ronge commented 9 years ago

The error must be originating from elsewhere. A NullPointerException arises because DocStruct.addMetadata() tries to thow a DocStructHasNoTypeException here, but tries to access the type name of the null object in error message string composition which hides the error. This is an error of course, too.

However, why does your DocStrcuct not have a type here?

henning-gerhardt commented 9 years ago

We had only one document structure element there: monograph. There are no child structure elements because there is no deep structuring. I attached corresponding meta file.

<?xml version="1.0" encoding="UTF-8"?>
<mets:mets xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version17/mets.v1-7.xsd http://www.loc.gov/standards/premis/ http://www.loc.gov/standards/premis/v2/premis-v2-0.xsd http://www.loc.gov/standards/mix/ http://www.loc.gov/standards/mix/mix.xsd">
  <mets:metsHdr CREATEDATE="2014-12-10T09:21:23">
    <mets:agent OTHERTYPE="SOFTWARE" ROLE="CREATOR" TYPE="OTHER">
      <mets:name>Goobi - UGH-1.10-fe1c038 - 04−December−2014</mets:name>
      <mets:note>Goobi</mets:note>
    </mets:agent>
  </mets:metsHdr>
  <mets:dmdSec ID="DMDLOG_0000">
    <mets:mdWrap MDTYPE="MODS">
      <mets:xmlData>
        <mods:mods xmlns:mods="http://www.loc.gov/mods/v3">
          <mods:extension>
            <goobi:goobi xmlns:goobi="http://meta.goobi.org/v1.5.1/">
              <goobi:metadata name="CreatorsAllOrigin">Auerbach, Johann Friedrich</goobi:metadata>
              <goobi:metadata name="singleDigCollection">Drucke des 18. Jahrhunderts</goobi:metadata>
              <goobi:metadata name="singleDigCollection">Projekt: Verzeichnis der im deutschen Sprachraum erschienenen Drucke des 18. Jahrhunderts (VD18)</goobi:metadata>
              <goobi:metadata name="singleDigCollection">Saxonica</goobi:metadata>
              <goobi:metadata name="PublicationYear">[1743]</goobi:metadata>
              <goobi:metadata name="PublicationYearSorting">1743</goobi:metadata>
              <goobi:metadata name="PlaceOfPublication">Lipsiae</goobi:metadata>
              <goobi:metadata name="slub_footer">slubdfg</goobi:metadata>
              <goobi:metadata name="slub_Finance">Deutsche Forschungsgemeinschaft</goobi:metadata>
              <goobi:metadata name="SizeSourcePrint">VIII S.</goobi:metadata>
              <goobi:metadata name="TitleDocMain">Commentatio Philosophica Qua Num Animus Humanus Ideis Formandis Operam Continuo Impendat</goobi:metadata>
              <goobi:metadata name="TitleDocMainShort">Commentatio Philosophica Qua Num Animus Humanus Ideis Formandis Operam Continuo Impendat</goobi:metadata>
              <goobi:metadata name="CatalogIDDigital">417030096</goobi:metadata>
              <goobi:metadata name="CatalogIDSource">033955034</goobi:metadata>
              <goobi:metadata name="slub_script">Antiqua</goobi:metadata>
              <goobi:metadata name="shelfmarksource">Phil.B.204,8</goobi:metadata>
              <goobi:metadata name="DocLanguage">lat</goobi:metadata>
              <goobi:metadata name="TSL_ATS">auercomm</goobi:metadata>
              <goobi:metadata name="TitleDocSub1">Disqvirit Viris ... Doctissimis Dn. Georgio Zachariae Winklero Dn. Christophoro Jeremiae Rostio Dn. Johanni Henrico Parreidtio D. Samueli Benjamino Reichelio De Summis In Philosophia Honoribus ... Qui Sub Auspiciis Jo. Henrici Winkleri Graecae Latinaeque Lingua Prof. Publ. Ord. Disputando Exercentur; [Lipsiae Mense Februario anni MDCCXXXXIII.]</goobi:metadata>
              <goobi:metadata name="VD18">VD18 10125914</goobi:metadata>
              <goobi:metadata name="PublisherName">Officina Langenhemiana</goobi:metadata>
              <goobi:metadata name="Author" type="person">
                <goobi:lastName>Auerbach</goobi:lastName>
                <goobi:firstName>Johann Friedrich</goobi:firstName>
                <goobi:displayName>Auerbach, Johann Friedrich</goobi:displayName>
              </goobi:metadata>
            </goobi:goobi>
          </mods:extension>
        </mods:mods>
      </mets:xmlData>
    </mets:mdWrap>
  </mets:dmdSec>
  <mets:dmdSec ID="DMDPHYS_0000">
    <mets:mdWrap MDTYPE="MODS">
      <mets:xmlData>
        <mods:mods xmlns:mods="http://www.loc.gov/mods/v3">
          <mods:extension>
            <goobi:goobi xmlns:goobi="http://meta.goobi.org/v1.5.1/">
              <goobi:metadata name="FormatSourcePrint">4°</goobi:metadata>
              <goobi:metadata name="pathimagefiles">file:///home/goobi/work/daten/93319/images/auercomm_417030096_tif</goobi:metadata>
            </goobi:goobi>
          </mods:extension>
        </mods:mods>
      </mets:xmlData>
    </mets:mdWrap>
  </mets:dmdSec>
  <mets:fileSec>
    <mets:fileGrp USE="LOCAL">
      <mets:file ID="FILE_0001" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000001.tif"/>
      </mets:file>
      <mets:file ID="FILE_0002" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000002.tif"/>
      </mets:file>
      <mets:file ID="FILE_0003" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000003.tif"/>
      </mets:file>
      <mets:file ID="FILE_0004" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000004.tif"/>
      </mets:file>
      <mets:file ID="FILE_0005" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000005.tif"/>
      </mets:file>
      <mets:file ID="FILE_0006" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000006.tif"/>
      </mets:file>
      <mets:file ID="FILE_0007" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000007.tif"/>
      </mets:file>
      <mets:file ID="FILE_0008" MIMETYPE="image/tiff">
        <mets:FLocat xmlns:xlink="http://www.w3.org/1999/xlink" LOCTYPE="URL" xlink:href="file:///home/goobi/work/daten/93319/images/scans_tif/00000008.tif"/>
      </mets:file>
    </mets:fileGrp>
  </mets:fileSec>
  <mets:structMap TYPE="LOGICAL">
    <mets:div DMDID="DMDLOG_0000" ID="LOG_0000" TYPE="Monograph"/>
  </mets:structMap>
  <mets:structMap TYPE="PHYSICAL">
    <mets:div DMDID="DMDPHYS_0000" ID="PHYS_0000" TYPE="BoundBook">
      <mets:div ID="PHYS_0001" ORDER="1" ORDERLABEL="I" TYPE="page">
        <mets:fptr FILEID="FILE_0001"/>
      </mets:div>
      <mets:div ID="PHYS_0002" ORDER="2" ORDERLABEL="II" TYPE="page">
        <mets:fptr FILEID="FILE_0002"/>
      </mets:div>
      <mets:div ID="PHYS_0003" ORDER="3" ORDERLABEL="III" TYPE="page">
        <mets:fptr FILEID="FILE_0003"/>
      </mets:div>
      <mets:div ID="PHYS_0004" ORDER="4" ORDERLABEL="IV" TYPE="page">
        <mets:fptr FILEID="FILE_0004"/>
      </mets:div>
      <mets:div ID="PHYS_0005" ORDER="5" ORDERLABEL="V" TYPE="page">
        <mets:fptr FILEID="FILE_0005"/>
      </mets:div>
      <mets:div ID="PHYS_0006" ORDER="6" ORDERLABEL="VI" TYPE="page">
        <mets:fptr FILEID="FILE_0006"/>
      </mets:div>
      <mets:div ID="PHYS_0007" ORDER="7" ORDERLABEL="VII" TYPE="page">
        <mets:fptr FILEID="FILE_0007"/>
      </mets:div>
      <mets:div ID="PHYS_0008" ORDER="8" ORDERLABEL="VIII" TYPE="page">
        <mets:fptr FILEID="FILE_0008"/>
      </mets:div>
    </mets:div>
  </mets:structMap>
  <mets:structLink>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0001" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0002" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0003" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0004" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0005" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0006" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0007" xlink:from="LOG_0000"/>
    <mets:smLink xmlns:xlink="http://www.w3.org/1999/xlink" xlink:to="PHYS_0008" xlink:from="LOG_0000"/>
  </mets:structLink>
</mets:mets>

For this document only copy rule /@ProcessID \= $process.id should apply.Second Copy rule /*[0]@ProcessID \= $process.id produce the null pointer exception for this document. Commenting out / removing this rule prevent null pointer exception. But second rule is needed for any multi part documents like periodicals or multi volume works.

matthias-ronge commented 9 years ago
  1. Please read the NullPointerException as DocStructHasNoTypeException. This is a UGH bug.
  2. The reason is that = assignment is strong and will try to create the structure element of the given type (here: *). Obviously, * is not forbidden, but creates a docStruct without type. If it was forbidden, the rule would work like you expect it to do. Try ""= assignment which will only add the metadatum if the left hand side's path is available:
copyData.onExport=/@ProcessID ""\= $process.id;/*[0]@ProcessID ""\= $process.id
henning-gerhardt commented 9 years ago

The ""= assignment prevent the null pointer exception. If it is a bug of UGH or a wrong usage of UGH classes or both cases together, should not now be a problem any more.