On Donnerstag, 5. März 2009, Patrick Nagel wrote:
> Hi Markus,
>
> On 2009-03-05 03:09, Markus Krötzsch wrote:
> >> Could something like this be included in SMW?
> >
> > Yes. I suggest a slightly different control interface, though. The output
> > is only a problem for #ask queries, right? My suggestion is to use the
> > existing "printout modifier" mechanism that works for #ask printouts, so
> > that one can choose for each single printout which format to use.
> > Example:
> >
> > {{#ask: ...
> >
> > | ?start date
> > | ?end date#ISO
> >
> > }}
>
> That's probably better for most. I have to go through all #ask queries
> then, and append '#ISO' everywhere, but that's ok :)
>
> > This will show a three column table with start date in localized format
> > and end date in ISO 8601 format. The ISO date is always completed
> > (assuming January and 01 as defaults for month and day as in sorting).
> > The time component may be omitted. If given, the time is separated by "T"
> > as defined in the spec. Years are padded up to four digits, so you get
> > things like "0010-05-06". Negative years, as suggested by ISO, represent
> > BC dates, with 0 corresponding to 1 BC, -1 corresponding to 2 BC, and so
> > on.
>
> Good catch, without the 'T' as separator between date and time it's not
> really ISO8601. Or at least something like "YYYY-MM-DD hh:mm:ss" (like in
> my patch) - according to [1] - "is considered two separate, but acceptable,
> representations - one for date and the other for time. It is then left to
> the reader to interpret the two separate representations as meaning a
> single time point based on the context".
>
> > All implemented in SVN.
>
> That was fast, thanks! :)
>
> There is one thing I'm not 100% sure about though: Your implementation
> always prints out a complete date, like '2009-03-05' by printing out a
> default of '01' for the MM and DD parts when they are undefined.
>
> The Wikipedia article describing ISO8601, section "General principles" [2]
> says: "For reduced accuracy, any number of values may be dropped from any
> of the date and time representations, but in the order from the least to
> the most significant."
>
> So it would be possible to just omit the '-DD' or '-MM-DD' part when they
> are undefined. I would prefer this over SMW implying that the date is "on
> January the 1st" even though the precise point in time may actually be
> unknown. What do you think?

I also read that article :-) I decided against using partial dates because I 
assumed that it would complicate the life of people who use parser functions 
to post-process the dates (I think this is the main application of using ISO 
right now). Also, the old behaviour was to complete the date, so it recovers 
the kind of downwards compatibility that was asked for.

One could introduce more strings than "ISO" to have more fine-grained 
formatting options. But this gets us into the hell of date formatting (there 
are far too many options there) and of localization (man common formatting 
directives for dates are heavily biased towards English).

Markus

>
> Patrick.
>
> [1]:
> http://en.wikipedia.org/wiki/ISO8601#Combined_date_and_time_representations
> [2]: http://en.wikipedia.org/wiki/ISO8601#General_principles


-- 
Markus Krötzsch
Semantic MediaWiki    http://semantic-mediawiki.org
http://korrekt.org    mar...@semantic-mediawiki.org

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to