Closed mjordan closed 8 years ago
It's worth noting that I was able to successfully validate a test MODS XML document with repeated physicalDescription elements against the MODS XML 3.5 schema. However, repeated parent wrapper elements may not be desirable for (human) readability and when ingesting packages created by MIK into Islandora or other systems.
Grepping through the MODS 3.5 XSD file shows that every element is repeatable (at least, every occurrence of 'maxOccurs' has a value of 'unbounded' ). However, the LoC MODS User Guidelines say of <physicalDescription>
"Repeating this element is not recommended." So, in this case we have schema constraints that do not match "best practice." Regardless, I'd like to have a generic solution to this problem that can be applied to any mapping, for no other reason than readability of the MODS files. Also, we may create XML using MIK that does have some repeatability constraints.
I've made a commit to resolve this issue: fffc7ccd92e72436f76bda6137d5cf709d097396. However, I'm not particularly pleased with the code and would like to improve it. Suggestions are welcome.
Thank you to @mjordan for the test case that demonstrates that the code in commit https://github.com/MarcusBarnes/mik/commit/fffc7ccd92e72436f76bda6137d5cf709d097396 doesn't handle repeated extension elements as desired. I will reopen this issue while I finish off a fix.
Commit b233bf4fc794183f170e188a413cd377d32b847b adds the ability to set repeated elements in the configuration file under the METADATA_PARSER section. For example, you might want the MODS extension top-level element to repeat, rather than the child elements consolidated within one parent wrapper element.
Wrapper elements with attributes are skipped by the determineRepeatedWrapperChildElements and related methods in the CdmToMods metadataparsers. The existing methods are not sufficient to track wrapper elements with differing attributes. there are situations where the wrapper elements should be consolidated, for example multiple subject elements with authority attributes.
There was progress on this, but it is still not working as expected. See https://github.com/MarcusBarnes/mik/issues/100
If we have two mappings that define MODS elements that share a common parent wrapper element, we should only add the parent element to the MODS XML once. For example, in the following mapping file the 'Medium' and 'Work Measurements' source fields map to MODS
<form>
and<note>
elements, respectively:These two MODS elements share the parent
<physicalDescription>
. Currently, the XML produced looks like this:but we probably want: