Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] METS application profile validation #335

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

markusweigelt
Copy link
Contributor

@markusweigelt markusweigelt commented Jan 9, 2025

It can be tested by calling the validation middleware with a faulty METS file:
https://example.com?middleware=dlf/domDocumentValidation&url=https://3drepo.eu/modelupload/b5df7cd550f64e818943ad96fff7e902metsmods.xml

which results in JSON Reponse

{
  "valid": false,
  "results": {
    "XML-Schemes Validator": [
      "Element '{http://www.loc.gov/METS/}mdWrap', attribute 'MDTYP': The attribute 'MDTYP' is not allowed.\n",
      "Element '{http://www.loc.gov/METS/}mdWrap': The attribute 'MDTYPE' is required but missing.\n"
    ],
    "Application Profile Validation": [
      "Value \"object\" in the \"TYPE\" attribute of \"/mets:mets/mets:structMap[1]/mets:div\" is not permissible.",
      "Value \"object\" in the \"TYPE\" attribute of \"/mets:mets/mets:structMap[2]/mets:div/mets:div\" is not permissible.",
      "Mandatory \"MDTYPE\" attribute of \"/mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap\" is missing.",
      "There must be an element that matches the XPath expression \"//mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap[@MDTYPE=\"OTHER\" and @OTHERMDTYPE=\"DVRIGHTS\"]/mets:xmlData/dv:rights\"",
      "There must be an element that matches the XPath expression \"//mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap[@MDTYPE=\"OTHER\" and @OTHERMDTYPE=\"DVRIGHTS\"]/mets:xmlData/dv:rights/dv:owner\"",
      "There must be an element that matches the XPath expression \"//mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap[@MDTYPE=\"OTHER\" and @OTHERMDTYPE=\"DVRIGHTS\"]/mets:xmlData/dv:rights/dv:ownerLogo\"",
      "There must be an element that matches the XPath expression \"//mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap[@MDTYPE=\"OTHER\" and @OTHERMDTYPE=\"DVRIGHTS\"]/mets:xmlData/dv:rights/dv:ownerSiteURL\"",
      "There must be an element that matches the XPath expression \"//mets:mets/mets:amdSec/mets:rightsMD/mets:mdWrap[@MDTYPE=\"OTHER\" and @OTHERMDTYPE=\"DVRIGHTS\"]/mets:xmlData/dv:rights/dv:ownerContact\""
    ]
  }
}

markusweigelt and others added 30 commits November 29, 2024 13:35
@markusweigelt markusweigelt force-pushed the application-profile-validation branch from 28867af to 3648c40 Compare January 9, 2025 13:38
@markusweigelt
Copy link
Contributor Author

@beatrycze-volk The implementation works in Typo3 11, and corresponding tests have been written.
I did not explicitly run the tests for Typo3 10, as the old testing framework is required for that, and it does not work easily. I have skipped this adjustment for now since we are working with Typo3 11 and will soon be moving to Typo3 12.

@beatrycze-volk beatrycze-volk added the ✔️ feature A new feature or enhancement. label Jan 22, 2025
@beatrycze-volk beatrycze-volk added this to the DFG-Viewer 7.0.0 milestone Jan 22, 2025
@stweil
Copy link
Contributor

stweil commented Jan 23, 2025

Will this validation also use the DDB schematron validation? We already have a script which does that.

@markusweigelt
Copy link
Contributor Author

markusweigelt commented Jan 23, 2025

Will this validation also use the DDB schematron validation? We already have a script which does that.

This is not part of this PR and has already been implemented: https://kitodo.github.io/kitodo-presentation/Developers/Validation.html#saxonxsltosvrlvalidator.

The DomDocumentValidation middleware (https://kitodo.github.io/kitodo-presentation/Developers/Validation.html#domdocumentvalidation-middleware) can, among other things, be configured with SaxonXslToSvrlValidator.

The validation documentation (https://kitodo.github.io/kitodo-presentation/Developers/Validation.html#) generally provides clarification in this regard. If anything is missing or there are questions, I would appreciate your feedback.

@stweil
Copy link
Contributor

stweil commented Jan 23, 2025

Thanks. I did not know that this middleware exists.

@markusweigelt
Copy link
Contributor Author

It hasn’t been around for very long and isn’t included in any release yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✔️ feature A new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants