E-ARK-Software / py-rest-ip-validator

Flask wrapping for Information Package validation from eatb
Apache License 2.0
1 stars 2 forks source link

structMap rule for CSIP82 will not work with more than one structMap #5

Open koit opened 4 years ago

koit commented 4 years ago

In the Schematron rules for structMap, CSIP82 will fail if more than one structMaps are present because the others must have @LABEL != 'CSIP' as described in CSIP section 5.3.6. The same problem will arise with CSIP81 if the other structMaps have @TYPE != 'PHYSICAL'.

<rule context="/mets:mets/mets:structMap">
  <assert id="CSIP81" role="ERROR" test="@TYPE = 'PHYSICAL'">The mets/structMap/@TYPE attribute must take the value “PHYSICAL” from the vocabulary.</assert>
  <assert id="CSIP82" role="ERROR" test="@LABEL = 'CSIP'">The mets/structMap/@LABEL attribute value is set to “CSIP” from the vocabulary.</assert>
</rule>
carlwilson commented 4 years ago

OK @koit, we simply need to frame the requirements as a set of logical tests. The interaction of Schematron rules can be painful and getting the desired behaviour is often a journey.

more than one structMaps are present because the others must have @LABEL != 'CSIP' as described in CSIP section 5.3.6

My understanding here is the opposite and there should always be only one <structMap> element with @LABEL='CSIP' and it MUST have the @TYPE='PHYSICAL'. Other <structMap>s are welcome to share the @TYPE but not the @LABEL which is treated as an id, from Section 5.3.6:

The <structMap> element’s @LABEL attribute is mandatory and must have the value “CSIP”. The @LABEL attribute distinguishes the CSIP mandated structural maps from other structural maps. NOTE this means that the “CSIP” @LABEL value should be treated as a unique id and not applied to other <structMap> elements.

This still means that the tests are wrong, but I need to establish that there is one and only one <structMap> element with @LABEL='CSIP' and that it has @TYPE='PHYSICAL'.

koit commented 4 years ago

@carlwilson, I think we have exactly the same understanding and I suspect the confusion was caused by my explanation through negatives (i.e. !=). In sum, I think we need two tests:

No @LABEL or @TYPE tests needed for other structMaps, as CSIP does not regulate them and these attributes are optional in METS.