OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] limits of the generic

[ Lists Home | Date Index | Thread Index ]

Hi Dare,

> xs:duration is broken and should never have made it into the W3C XML
> Schema REC in the first place. Simple question; Is an xs:duration
> representing 3 months equivalent to an xs:duration representing 90
> days?

According to the latest XPath 2.0 F&O WD, you can actually do
xs:duration('P3M') = xs:duration('P90D') and if they're not "exactly
equal" the answer is false.

But I think that you're getting at the fact that it's undefined. I can
think of several ways of dealing with that which don't rule out
perfectly legitimate uses of durations that mix years or months and
days or times:

We could simply say that if it's undefined it's false (though I
believe that this leads to optimisation problems because it means that
it's no longer true that a values must be one of equal, greater than
or less than another value):

  P3M = P90D  =>   false
  P3M > P90D  =>   false
  P3M < P90D  =>   false

We could introduce three-value logic:

  P3M = P90D  =>   ()
  P3M > P90D  =>   ()
  P3M < P90D  =>   ()
  
We could ban direct comparisons of durations, forcing users to add
them to dates in order to compare them:

  2002-09-28 + P3M = 2002-09-28 + P90D  =>  false
  2002-09-28 + P3M > 2002-09-28 + P90D  =>  true
  2002-09-28 + P3M < 2002-09-28 + P90D  =>  false

Or we could use the current date/time automatically in a comparison
like the above. Or we could pick a date in the past and use that
consistently for all duration comparisons.

Any of these would be better than making it an error for people to ask
perfectly legitimate, and answerable, questions and introducing two
new, more restrictive, data types that users have to use instead of
xs:duration in order for their schemas to work with XPath 2.0. For
example, I think that "What is 2002-09-28 plus a year and a day?" is
also a simple question with a well-defined answer; I don't think it
should be an error to try to ask it.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS