[dsdl-discuss] Re: Datatypes

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed May 29 2002 - 15:28:22 UTC

Bryan,

Martin Bryan wrote:
> Eric
>
>
>>I am still thinking that the framework can help here (by defining
>>transformations to be performed between the parsed and the lexical spaces)
>>and would really like to get feedback on my strawman!
>
>
> Partly because I still have not got to grips with it. I particularly have
> problems with where the data in the recombination example comes from:
>
> <element name="foo">
> <if:process type="http://www.w3.org/TR/1999/REC-xpath-19991116"
> value="concat(year, '-', month, '-', day)">
> <data type="xs:date"/>
> </if:process>
> </element>

I should have been more explicit :-) and it's partly done in the second
version of my strawman...

The meaning of:

<if:process type="foo" value="bar">
   <pattern definition/>
</if:process>

or

<if:process type="foo">
   <if:value>bar</if:value>
   <pattern definition/>
</if:process>

which is equivalent is to define a transformation to be applied to the
current node before applying the pattern defined within the if:process
element.

> The real problem we have to contend with is the following:
>
> <Date><Month>2</Month><Day>30</Day></Date>
> <Time timezone="EST"><Hour>23</Hour><Minute>33</Minute></Time>
>
> Now I've been deliberately awkward here (but wait until you see the later
> examples!). The date is partial, and invalid, but the values of the
> individual elements are valid. How do you tell the system that it must
> combine the two siblings of date to get a date that needs to be validated as
> a whole? How do you tell it to take current system parameters for missing
> fields? Which element do you report the error under? The Time element is
> valid, but before you can validate the time you have to do a conversion of
> EST to -05:00. Who defines this transformation, and which part of the
> standard does this come under? As far as the datatype spec is concerned all
> it will do will say something along the lines "given a statement such
> <dsdl-5:calendarLiteral dsdl-5:dtf="hh:mm-hh:mm"> 23:33-05:00
> </dsdl-5:calendarLiteral> the system will report back <test result="valid"/>
> to the node that generated the statement". What should it report back if it
> finds an error? Should it state which part of the model was at fault? Which
> one was it?

There are several different issues there which IMO belong to different
part of DSDL. The framework can handle a part of these issues and,
assuming that a user wants to use W3C XML Schema Part 2 as the
underlying type system, the following could be done:

  <define name="DateTime">
   <if:process type="http://www.w3.org/TR/1999/REC-xpath-19991116"
      value="concat(Date/Year, '-', Date/Month, '-', Date/Day, 'T',
      Time/Hour, ':', Time/Minute, ':', Time/Second, '+',
      Time/@timezone)">
    <data type="xs:datetime"/>
   </if:process>
  </define>

This would detect that the date is incomplete and do all the checks
you've mentioned except the timezone definition.

This timezone feature has been considered by the W3C as out of the scope
of W3C XML Schema part 2 because of its complexity: to determnine the
value of EST, you need to know the dates chosen to switch between winter
and summer time... If we think that we need to support it, we should
either use an underlying type system supporting it or define a
transformation system able to do the transform (I tend to see this as
out of the scope of the framework which IMO should focus on piping the
transformations).

>
> Now what happens if the input is in the following madly insane form:
> <Date><Month xml-lang="fr">f&eacute;vrier</Month><Day>30th</Day></Date>
> <Time timezone="CET"><Hour>24</Hour><Minute>01</Minute></Time>
>
> I've added some extra problems here. What module is responsible for
> converting f&eacute;vrier to 02, and stripping the suffix off 30th? (OK, you
> shouldn't have both problems together, but they are both problems that may
> need solving.) Does the 24:01 time mean that I have to increment the date by
> one and convert the time to 00:01? If so, who determines whether the
> incremented date is a valid one, and at what point in the process is the
> correction and validation done? If the datatype spec does the update
> automatically why shouldn't 30-02 just converted to either 02-03 or 01-03
> automatically as well, depending on the value taken for the year parameter?
> And how does the corrected value get sent back to the source?

This seems simpler than the previous one since there is nothing which
can't be done by XSLT or STX (even if it is rather verbose). And again,
a specific transformation library could be created if this was an
important requirement.

> Confused of Churchdown

It's quite difficult to split our work without having clearly defined
yet the limit of each part. I'd propose that the type system focuses on
making sure that the pieces we need are there (ie for instance named
timezones if it's important) and rely on the framework to change the
structure and format when needed.

Eric

-- 
See you in San Diego.
                                http://conferences.oreillynet.com/os2002/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
--
DSDL members discussion list
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-discuss-request@dsdl.org
(mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)
Received on Wed May 29 11:28:25 2002

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:00:27 UTC