MarkusDoering - Tue Nov 16 2004 - Version 1.3
Parent topic: ComplexTypes
The date/time types defined in xml schema control completeness of a date. Although incomplete types like gMonthDay exist, no type in xml schema that directly allows arbitrary combination of date elements.
UBIF proposes two complex types with elements that model partial or complete gregorian calendar date/time (= points in time where parts may be missing). These follow the seven property model described, e. g., in xml Schema 1.1 (http://www.w3.org/TR/2004/WD-xmlschema11-2-20040716/#theSevenPropertyModel). The date attributes are:
- year = four digit year;
- month = two digit month of year;
- day = two digit day of month
- verbatim = unparsed textual date representation
- supplement = text in addition to or modifying the exact dates, e. g., 'end of summer', 'first half or year', 'first decade of month', '1888-1892'.
- timezone = expressed as integer according to the xml schema seven parameter model
This is very similar to the atomized date/time model used in
A different model is proposed by ABCD (versions up to 1.49) which propose a new type based on xs:string on which a specific regular expression pattern is imposed. This allows to express complete or incomplete date/time in a way "conforming to a subset of ISO 8601". We see some problems with this: 1 The type is not defined in xml schema and requires custom serialization/deserialization code to written. Given the complexity of the regular expression pattern ("\d\d\d\d(\-(0[1-9]|1[012])(\-((0[1-9])|1\d|2\d|3[01])(T(0\d|1\d|2[0-3])(:[0-5]\d){0,2})?)?)?|\-\-(0[1-9]|1[012])(\-(0[1-9]|1\d|2\d|3[01]))?|\-\-\-(0[1-9]|1\d|2\d|3[01])") this is not a trivial task. In contrast, serialization/deserialization of objects to/from xml using xs:datetime, or the composite objects proposed by UBIF is automatically handled by the programming frameworks like Java or .NET. 2 ABCD gives the following examples for this: "1966-12-05T23:55:46", "1925-02-21", "1925-02", "1925", "12-05T23:55:46", "---05T23:55". Timezone information is not mentioned. 3 Any client must first parse the string, then determine whether the parts desired to be used in filtering, sorting, or displaying is present. This especially hard on xslt routines. We failed to be able to write any xslt against the ABCD time proposal. If we should agree on the ABCD model, it would help if someone could provide xslt/xpath expression for sorting by month, or "filter all records from December 15-31". 4 ISO 8601 is almost unavailable, that is very expensive. Neither Bob Morris nor I (Gregor Hagedorn) were able to obtain further information about the semantics of the ABCD type without paying for ISO 8601.
Note on the types used in the UBIF
In addition to the seven property model additional text attributes for either unsharp additions or complete verbatim dates are added. Note that incomplete dates in most cases are calendar specific and incomplete non-gregorian dates can not be expressed. Furthermore, for complete dates it may be unclear whether a reformed or unreformed date has been used (e.g. in Russia in the 19th century).
Please comment and argue for either the UBIF or the ABCD model.
-- Main.GregorHagedorn - 13 Aug 2004
The datetime format in ABCD is only a subset of ISO8601. ISO8601 defines many alternative ways of coding dates, times etc. See the following links for details about ISO8601 or good summaries:
The complete subset ABCD 1.2 uses is as follows, with the final +-hh being the timezone in hours:
Unprecise data can always just omit parts from the right (this applies also for the incomplete data below):
Incomplete data can truncate the date part of the string from the left, but not within the middle (only leaving month):
Something which is IMPOSSIBLE to do with this format is giving just a year and a day:
The advantages of this format are:
The disadvantages:
The other suitable format would be based on the Seven Property Model pointed out by Gregor. We would end up with an atomized version (probably as xml attributes of a datetime element) of a datetime like this:
Advantages:
Disadvantages:
-- Main.MarkusDoering - 16 Nov 2004