Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

On 2009-03-05 20:15, Markus Krötzsch wrote:
>> 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.

Hm... but do you really think it's the right thing™ to let SMW invent a part
of the date even though that missing part may have been omitted deliberately?
As it is now, whenever you see "-01-01" you have to wonder: is it really
January 1st or did SMW make that up? I just don't feel very comfortable with 
that.

> 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).

To be honest, I think we NEED to get into the "hell of date formatting". SMW
is nice and all, enabling us to store and query - but what does it help when
we can't get the stuff in exactly the way we need it out again? Maybe we could
extend the SRF extension and add all the date formatters there? Another
approach would be to let the *user* specify the output template (like it was
in some older SMW version, where strftime date formatting strings were
accepted, or based on MediaWiki's template "language" with a few
well-documented magic words that return the date parts, like
"__SMWYEAR4D__"...). I know there were problems because of a limited date
range with strftime, but for some (maybe many) users those problems are
actually more acceptable than just not having any options when it comes to
formatting dates.

I think this is really important - finding out that you can't get your queries
to return exactly what you want is a huge show-stopper for people trying to
*really* make use of SMW (more than just some proof of concept).

Patrick.

- --
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmwyEgACgkQyYHmhobjRtR4GACfdPYlcxCLTVDQlMGz1xlg5G6y
MO0An0AcCy3qKj1yVBRRZmXNbjK2jmnO
=3srF
-END PGP SIGNATURE-

--
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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Markus,

On 2009-03-05 20:10, Markus Krötzsch wrote:
> * I can imagine a global "date format" switch that may be set to ISO to make 
> it a default for all dates. But I do not know which printout modifier to use 
> for "normal" dates then (note that "ISO" is rather language neutral). I am 
> thus inclined to opt against this extension.

What about my proposal "localized"? Or maybe just "standard" or "normal"?

Patrick.

- --
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmvwjUACgkQyYHmhobjRtSkuwCfQtMPUex/n0W6XQMsmT0YZ/JL
qUUAoJF5J5KjCC1qExIyRtUvsFlQLJFH
=4tau
-END PGP SIGNATURE-

--
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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Markus Krötzsch
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 "-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 MediaWikihttp://semantic-mediawiki.org
http://korrekt.orgmar...@semantic-mediawiki.org



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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Markus Krötzsch
My aggregated comments:
* ISO dates are not generally accepted as inputs. this is so because the 
default ISO order of date parts is not the same as the preferred default order 
in most languages (even in English). One could attempt a work-around based on 
the fact that all ISO years must be 4 digits long. I think there is even a bug 
for this already.
* I can imagine a global "date format" switch that may be set to ISO to make 
it a default for all dates. But I do not know which printout modifier to use 
for "normal" dates then (note that "ISO" is rather language neutral). I am 
thus inclined to opt against this extension.

-- Markus


On Donnerstag, 5. März 2009, CNIT wrote:
> Patrick Nagel пишет:
> > I'll try to come up with a patch that makes SMW understand more ISO8601
> > dates. I will only implement the (recommended) "extended format" (with
> > hyphens / colons), not the "basic format" (without hyphens / colons). I
> > don't know about week dates and ordinal dates yet, maybe in a second
> > step.
>
> Ordinal dates as input are very nice thing, they allow easily to build
> anniversaries
> (memorable events that happened on the same day in previous years).
> I was hoping to implement something like this myself, but not having enough
> free time (and my coding probably is not reliable enough).
> Dmitriy
>
> ---
>--- 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



-- 
Markus Krötzsch
Semantic MediaWikihttp://semantic-mediawiki.org
http://korrekt.orgmar...@semantic-mediawiki.org



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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread CNIT
Patrick Nagel пишет:
> I'll try to come up with a patch that makes SMW understand more ISO8601 
> dates. 
> I will only implement the (recommended) "extended format" (with hyphens / 
> colons), not the "basic format" (without hyphens / colons). I don't know 
> about 
> week dates and ordinal dates yet, maybe in a second step.
>
>   
Ordinal dates as input are very nice thing, they allow easily to build 
anniversaries
(memorable events that happened on the same day in previous years).
I was hoping to implement something like this myself, but not having enough
free time (and my coding probably is not reliable enough).
Dmitriy

--
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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
Hi Dmitriy,

On 2009-03-05 16:51, CNIT wrote:
>> I think it would be best to also have a possibility to set the 
>> SMW-wide default to ISO8601, like in my proposal. Adding a possible 
>> printout modifier value "localized" (which would override the SMW-wide 
>> default setting) would then give all possibilities.
[...]
> Only optionally. My users need localized dates.

Yes, it should be optional (as in a global variable that can be set in 
LocalSettings.php), imo. The default should stay at 'localized', for backwards 
compatibility.

 > I wonder whether the input of ISO8601 is accepted
 > (because the ISO8601 output may be given as input to another #ask
 > template)..
 > ISO should be interesting for templating (both input and output).
 > Dmitriy

There are a number of problems I discovered during a quick check:
Time zone designators are interpreted in the wrong way (try 
'2009-03-05T12:12:34+02:00', which should be output as '2009-03-05T10:12:34' on 
a Wiki that's running with UTC time and as '2009-03-05T18:12:34' on a Wiki 
that's running with China Standard Time timezone set). Or they cause the string 
to not be understood (try '2009-03-05T12:12:34+0200').

I'll try to come up with a patch that makes SMW understand more ISO8601 dates. 
I will only implement the (recommended) "extended format" (with hyphens / 
colons), not the "basic format" (without hyphens / colons). I don't know about 
week dates and ordinal dates yet, maybe in a second step.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread CNIT

> Hi,
>
> it's me again... I thought some more about
>
> On 2009-03-05 03:09, Markus Krötzsch wrote:
>   
>> 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
>> }}
>> 
>
> I think it would be best to also have a possibility to set the SMW-wide 
> default 
> to ISO8601, like in my proposal. Adding a possible printout modifier value 
> "localized" (which would override the SMW-wide default setting) would then 
> give 
> all possibilities.
>
> My reason behind this: I think users who are accustomed to the ISO8601 date 
> format will find it peculiar to see the localised dates, which are still the 
> unchangeable default in your implementation, and they show up in the Browse 
> Properties output, for example.
>
> Patrick.
>
>   
Only optionally. My users need localized dates.
I wonder whether the input of ISO8601 is accepted
(because the ISO8601 output may be given as input to another #ask 
template)..
ISO should be interesting for templating (both input and output).
Dmitriy

--
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


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
Hi,

it's me again... I thought some more about

On 2009-03-05 03:09, Markus Krötzsch wrote:
> 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
> }}

I think it would be best to also have a possibility to set the SMW-wide default 
to ISO8601, like in my proposal. Adding a possible printout modifier value 
"localized" (which would override the SMW-wide default setting) would then give 
all possibilities.

My reason behind this: I think users who are accustomed to the ISO8601 date 
format will find it peculiar to see the localised dates, which are still the 
unchangeable default in your implementation, and they show up in the Browse 
Properties output, for example.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
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