SAA-SDT / eas-schematrons

Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

We currently don't have any special tests for unitDate in the same way we do for the single date elements (date, fromDate, toDate) #7

Closed fordmadox closed 4 months ago

fordmadox commented 6 months ago

Ideally, these two elements will merge (since structured dates can benefit from textual description, and textual description dates already do not require machine-readable date attributes in EAD), but until then, we should likely not allow such encodings like the following:

<unitDate notAfter="2024whatayear"/>

Simple to address in the Schematron, but it begs the question about why we have the two elements still, since why provide an encoding choice to users to encode an equivalent (but in this case Schematron-valid) statement such as:

<unitDateStructured><date notAfter="2024"/></unitDateStructured>

Allowing both goes against our first schema-design principle, anyway.

fordmadox commented 6 months ago

Decision: yes, update, as long as "otherDateEncoding" option is not specified.

kerstarno commented 6 months ago

Actually, the issue is not about <unitDate> compared to <unitDateStructured>, but compared to <date>, <fromDate>, and <toDate>, which can be used in various other elements next to <unitDateStructured>.

While testing https://github.com/SAA-SDT/eas-schemas/issues/88, I also found that there seems to be some inherent check somewhere in the Schematron which expects ISO 8601 compliant dates (respectively some value at all to start with) for @standardDate, @notAfter, and @notBefore in <date>, <fromDate>, and <toDate> even if @dateEncoding is not specified at all.

Example:

kerstarno commented 6 months ago

This is what should ideally happen when validating with the Schematron:

fordmadox commented 6 months ago

Right, the current approach was modeled off of EAD3's schematron approach (if I recall correctly), such that the only time the dates were not expected to be ISO-8601 was if and only if the dateEncoding was set to "otherDateEncoding". So, setting dateEncoding = to iso8601 was equivalent as leaving it off, just like setting audience = external was equivalent to leaving that attribute blank.

I'll update the new EAD4 Schematron to use the 3 rules as explained above, though. Once that's added to the issue_7 branch, I'll note the commit here.

fordmadox commented 6 months ago

Should be ready to test now, in both this branch and the 'ead4' branch.

kerstarno commented 6 months ago

Tested the following scenarios:

fordmadox commented 6 months ago

@kerstarno : can you check the 'ead4' branch again? I think that I got most of the issues, but I wasn't able to replicate (or understand) some of the behavior that you noticed, specifically with unitDate.

kerstarno commented 6 months ago

Re-tested with the XSD and the RNG (including the "ead4" branch Schematron) and can confirm that this now works as expected.

When no @dateEncoding is set (yet) in <control> and I add @notBefore, @notAfter, or @standardDate to <unitDate>, <date>, <fromDate>, or <toDate>, I get the message that @dateEncoding needs to be set.

When I've got @dateEncoding set to "otherDateEncoding" and I add @notBefore, @notAfter, or @standardDate to <unitDate>, <date>, <fromDate>, or <toDate>, these can remain empty and they can have any value.

When I've got @dateEncoding set to "iso8601" and I add @notBefore, @notAfter, or @standardDate to <unitDate>, <date>, <fromDate>, or <toDate>, these cannot remain empty and their values have to conform to the ISO standard.

As a note: @standardDate allows date ranges according to ISO 8601 (i.e. something like "1900/1910"), while @notBefore and @notAfter only allows single dates according to ISO 8601. I assume that does make sense with regard to how these two attributes are meant to give one earliest respectively latest date, but if someone wanted to e.g. say "not before the 18th century" in a standardised way according to ISO 8601, the value "1701/1800" would not be valid in @notBefore with the current setting. (Only noting this down for reference, not saying we should or shouldn't allow it.)

kerstarno commented 4 months ago

I've created a schemas issue to follow up on the question raised re date ranges in @notBefore and @notAfter. With this plus the successful testing plus seeing that the aspect of appropriate alert messages in the schematron is already being addressed in the context of #10, I am closing this issue here.