Quantcast

querying for parts of date

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

querying for parts of date

Krabina Bernhard
Hi,

is there a way to query only for parts of a date? The wildcards * and ? don't seem to work for type date.

I have properties birthdate of type date and I want to query persons who's birthday is on a specific date (no matter what year the birthdate is)...

regards,
Bernhard

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

planetenxin
Hi Bernhard,

how about saving the birthday as a Text property in ISO format, like
1978-04-29 and doing some string magic with parser functions...

/Alexander

Am 11.09.2013 13:58, schrieb Krabina Bernhard:
> Hi,
>
> is there a way to query only for parts of a date? The wildcards * and ? don't seem to work for type date.
>
> I have properties birthdate of type date and I want to query persons who's birthday is on a specific date (no matter what year the birthdate is)...
>
> regards,
> Bernhard


--
________________________________________________
semantic::apps by gesinn.it
Business Applications with Semantic Mediawiki.
http://semantic-apps.com

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Hans Oleander
Hi Bernhard,

>> is there a way to query only for parts of a date?

> how about saving the birthday as a Text property in ISO format, like
> 1978-04-29 and doing some string magic with parser functions...

It doesn't have to be text format. Assumed you have a form and a template "Person" with a property "Geburtstag" of type date, than you could include the following in the template:

{{#if: {{{Geburtstag|}}} | [[birthday::true| ]][[birth-day::{{#time: j | {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n | {{{Geburtstag|}}} }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd:: {{#time: j | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr: {{#time: j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n | {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n | {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} + 1 }} }}| ]]| [[birthday::false| ]]}}

This will achieve the following:

1.) check, if the attribute has been set at all. Depending on that, set "birthday" to either true or false (because if not set, it does not contain simply an empty string but rather does not exist, thus casting errors in further processing)

2.) Write the components to the properties birth-day, birth-month and birth-year, which then can further be used

3.) Write the next upcoming birthday of this person to the property "nextbd".

This is at least what works fine for the birthday list in my SMW.

Cheers,
Hans


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
wow, this looks great, thank you.

Can it handle incomplete dates? I have birthdates of historical persons, where only 1857 or "Mai 1487" is available...

regards,
Bernhard

----- Ursprüngliche Mail -----

> Hi Bernhard,
>
> >> is there a way to query only for parts of a date?
>
> > how about saving the birthday as a Text property in ISO format,
> > like
> > 1978-04-29 and doing some string magic with parser functions...
>
> It doesn't have to be text format. Assumed you have a form and a
> template
> "Person" with a property "Geburtstag" of type date, than you could
> include
> the following in the template:
>
> {{#if: {{{Geburtstag|}}} | [[birthday::true| ]][[birth-day::{{#time:
> j |
> {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n | {{{Geburtstag|}}}
> }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> {{#time: j
> | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr:
> | {{#time:
> j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> {{{Geburtstag|}}}
> }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} + 1
> }} }}|
> ]]| [[birthday::false| ]]}}
>
> This will achieve the following:
>
> 1.) check, if the attribute has been set at all. Depending on that,
> set
> "birthday" to either true or false (because if not set, it does not
> contain
> simply an empty string but rather does not exist, thus casting errors
> in
> further processing)
>
> 2.) Write the components to the properties birth-day, birth-month and
> birth-year, which then can further be used
>
> 3.) Write the next upcoming birthday of this person to the property
> "nextbd".
>
> This is at least what works fine for the birthday list in my SMW.
>
> Cheers,
> Hans
>
>
>
>
>
>
> --
> View this message in context:
> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> Sent from the Semantic Mediawiki - User mailing list archive at
> Nabble.com.
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Hans Oleander-2
> Can it handle incomplete dates? I have birthdates of historical persons,
where only 1857 or "Mai 1487" is available...

The original Post had asked "... and I want to query persons who's birthday
is on a specific date (no matter what year the birthdate is)...". If only
the year 1857 is available and you want to ask for specific dates no matter
what year, then this is going to become difficult... ;-)  SCNR.

But yes, there is some handling of incomplete dates by the parser function
#time that is used here. If you just enter "1857" as birthdate, the Parser
will assume the current day and month (e.g. Sept. 12th 1857, which probably
is of no help). If you enter "April 1857", the parser will give you the 1st
of April as the complete date.

One of your options is to force the user to enter complete date strings,
e.g. using a date picker in the form, and define a rule that in case of
unknown months January should be selected and in case of unknown days the
1st.

If you require a more explicit handling (e.g. if full date is known display
a congratulation box at the birthday, whereas if only the month is known,
display a text like "... during this month it's xxx's birthday ..."), then
you will need to do the parsing of the date entry string yourself. #time
will return identical results e.g. for "January 1857" and "1857/1/1", i.e.
not let you know wheter the user entered January 1st or whether it was
added by the parser.

Another option is to have three separate fields for the user to enter birth
day/month/year so that you know which have been set.

Hope that helps,
Hans



2013/9/12 Krabina Bernhard <[hidden email]>

> wow, this looks great, thank you.
>
> Can it handle incomplete dates? I have birthdates of historical persons,
> where only 1857 or "Mai 1487" is available...
>
> regards,
> Bernhard
>
> ----- Ursprüngliche Mail -----
> > Hi Bernhard,
> >
> > >> is there a way to query only for parts of a date?
> >
> > > how about saving the birthday as a Text property in ISO format,
> > > like
> > > 1978-04-29 and doing some string magic with parser functions...
> >
> > It doesn't have to be text format. Assumed you have a form and a
> > template
> > "Person" with a property "Geburtstag" of type date, than you could
> > include
> > the following in the template:
> >
> > {{#if: {{{Geburtstag|}}} | [[birthday::true| ]][[birth-day::{{#time:
> > j |
> > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n | {{{Geburtstag|}}}
> > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> > {{#time: j
> > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr:
> > | {{#time:
> > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > {{{Geburtstag|}}}
> > }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} + 1
> > }} }}|
> > ]]| [[birthday::false| ]]}}
> >
> > This will achieve the following:
> >
> > 1.) check, if the attribute has been set at all. Depending on that,
> > set
> > "birthday" to either true or false (because if not set, it does not
> > contain
> > simply an empty string but rather does not exist, thus casting errors
> > in
> > further processing)
> >
> > 2.) Write the components to the properties birth-day, birth-month and
> > birth-year, which then can further be used
> >
> > 3.) Write the next upcoming birthday of this person to the property
> > "nextbd".
> >
> > This is at least what works fine for the birthday list in my SMW.
> >
> > Cheers,
> > Hans
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> > Sent from the Semantic Mediawiki - User mailing list archive at
> > Nabble.com.
> >
> >
> ------------------------------------------------------------------------------
> > How ServiceNow helps IT people transform IT departments:
> > 1. Consolidate legacy IT systems to a single system of record for IT
> > 2. Standardize and globalize service processes across IT
> > 3. Implement zero-touch automation to replace manual, redundant tasks
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
> > Can it handle incomplete dates? I have birthdates of historical
> > persons, where only 1857 or "Mai 1487" is available...
>
> The original Post had asked " ... and I want to query persons who's
> birthday is on a specific date (no matter what year the birthdate
> is)...". If only the year 1857 is available and you want to ask for
> specific dates no matter what year, then this is going to become
> difficult... ;-) SCNR.

sure, by use case is May 1857, I want to get may as month and nothing as day.

> But yes, there is some handling of incomplete dates by the parser
> function #time that is used here. If you just enter "1857" as
> birthdate, the Parser will assume the current day and month (e.g.
> Sept. 12th 1857, which probably is of no help). If you enter "April
> 1857", the parser will give you the 1st of April as the complete
> date.

But this doesn't work:
http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
It shows an error message below the info box. Does work perfectly with complete dates.

> One of your options is to force the user to enter complete date
> strings, e.g. using a date picker in the form, and define a rule
> that in case of unknown months January should be selected and in
> case of unknown days the 1st.

no. if the exact birth date of a historical person is just not known, I can't let the users enter something else as the information that is know. birhtdate 1. January 1482 is simply wrong, if it was not on the 1st of January.

> If you require a more explicit handling (e.g. if full date is known
> display a congratulation box at the birthday, whereas if only the
> month is known, display a text like "... during this month it's
> xxx's birthday ..."), then you will need to do the parsing of the
> date entry string yourself. #time will return identical results e.g.
> for "January 1857" and "1857/1/1", i.e. not let you know wheter the
> user entered January 1st or whether it was added by the parser.
>
> Another option is to have three separate fields for the user to enter
> birth day/month/year so that you know which have been set.

Yes, this would have been the best option, but I now have a wiki with 18.000 entries and cannot re-do this :-(

> Hope that helps,

thank you for your help. Do incomplete dates (May 1875) work in your wiki?

regards,
Bernhard


> 2013/9/12 Krabina Bernhard < [hidden email] >
>
>
> wow, this looks great, thank you.
>
> Can it handle incomplete dates? I have birthdates of historical
> persons, where only 1857 or "Mai 1487" is available...
>
> regards,
> Bernhard
>
> ----- Ursprüngliche Mail -----
> > Hi Bernhard,
> >
> > >> is there a way to query only for parts of a date?
> >
> > > how about saving the birthday as a Text property in ISO format,
> > > like
> > > 1978-04-29 and doing some string magic with parser functions...
> >
> > It doesn't have to be text format. Assumed you have a form and a
> > template
> > "Person" with a property "Geburtstag" of type date, than you could
> > include
> > the following in the template:
> >
> > {{#if: {{{Geburtstag|}}} | [[birthday::true|
> > ]][[birth-day::{{#time:
> > j |
> > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> > {{{Geburtstag|}}}
> > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> > {{#time: j
> > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr:
> > | {{#time:
> > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > {{{Geburtstag|}}}
> > }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} +
> > 1
> > }} }}|
> > ]]| [[birthday::false| ]]}}
> >
> > This will achieve the following:
> >
> > 1.) check, if the attribute has been set at all. Depending on that,
> > set
> > "birthday" to either true or false (because if not set, it does not
> > contain
> > simply an empty string but rather does not exist, thus casting
> > errors
> > in
> > further processing)
> >
> > 2.) Write the components to the properties birth-day, birth-month
> > and
> > birth-year, which then can further be used
> >
> > 3.) Write the next upcoming birthday of this person to the property
> > "nextbd".
> >
> > This is at least what works fine for the birthday list in my SMW.
> >
> > Cheers,
> > Hans
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> > http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> > Sent from the Semantic Mediawiki - User mailing list archive at
> > Nabble.com.
> >
> > ------------------------------------------------------------------------------
> > How ServiceNow helps IT people transform IT departments:
> > 1. Consolidate legacy IT systems to a single system of record for
> > IT
> > 2. Standardize and globalize service processes across IT
> > 3. Implement zero-touch automation to replace manual, redundant
> > tasks
> > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >
>
>

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Hans Oleander-2
> thank you for your help. Do incomplete dates (May 1875) work in your wiki?

They do work, but it is language specific. So "May 1875" does work and
returns May 1st 1875, "Mai 1875" (as on your page) doest not. This is
because the PHP function strtotime() is used for the conversion and expects
english input. I am afraid you will need to include a few replace
instructions to handle this.

Best,
Hans


2013/9/12 Krabina Bernhard <[hidden email]>

> > > Can it handle incomplete dates? I have birthdates of historical
> > > persons, where only 1857 or "Mai 1487" is available...
> >
> > The original Post had asked " ... and I want to query persons who's
> > birthday is on a specific date (no matter what year the birthdate
> > is)...". If only the year 1857 is available and you want to ask for
> > specific dates no matter what year, then this is going to become
> > difficult... ;-) SCNR.
>
> sure, by use case is May 1857, I want to get may as month and nothing as
> day.
>
> > But yes, there is some handling of incomplete dates by the parser
> > function #time that is used here. If you just enter "1857" as
> > birthdate, the Parser will assume the current day and month (e.g.
> > Sept. 12th 1857, which probably is of no help). If you enter "April
> > 1857", the parser will give you the 1st of April as the complete
> > date.
>
> But this doesn't work:
> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> It shows an error message below the info box. Does work perfectly with
> complete dates.
>
> > One of your options is to force the user to enter complete date
> > strings, e.g. using a date picker in the form, and define a rule
> > that in case of unknown months January should be selected and in
> > case of unknown days the 1st.
>
> no. if the exact birth date of a historical person is just not known, I
> can't let the users enter something else as the information that is know.
> birhtdate 1. January 1482 is simply wrong, if it was not on the 1st of
> January.
>
> > If you require a more explicit handling (e.g. if full date is known
> > display a congratulation box at the birthday, whereas if only the
> > month is known, display a text like "... during this month it's
> > xxx's birthday ..."), then you will need to do the parsing of the
> > date entry string yourself. #time will return identical results e.g.
> > for "January 1857" and "1857/1/1", i.e. not let you know wheter the
> > user entered January 1st or whether it was added by the parser.
> >
> > Another option is to have three separate fields for the user to enter
> > birth day/month/year so that you know which have been set.
>
> Yes, this would have been the best option, but I now have a wiki with
> 18.000 entries and cannot re-do this :-(
>
> > Hope that helps,
>
> thank you for your help. Do incomplete dates (May 1875) work in your wiki?
>
> regards,
> Bernhard
>
>
> > 2013/9/12 Krabina Bernhard < [hidden email] >
> >
> >
> > wow, this looks great, thank you.
> >
> > Can it handle incomplete dates? I have birthdates of historical
> > persons, where only 1857 or "Mai 1487" is available...
> >
> > regards,
> > Bernhard
> >
> > ----- Ursprüngliche Mail -----
> > > Hi Bernhard,
> > >
> > > >> is there a way to query only for parts of a date?
> > >
> > > > how about saving the birthday as a Text property in ISO format,
> > > > like
> > > > 1978-04-29 and doing some string magic with parser functions...
> > >
> > > It doesn't have to be text format. Assumed you have a form and a
> > > template
> > > "Person" with a property "Geburtstag" of type date, than you could
> > > include
> > > the following in the template:
> > >
> > > {{#if: {{{Geburtstag|}}} | [[birthday::true|
> > > ]][[birth-day::{{#time:
> > > j |
> > > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> > > {{{Geburtstag|}}}
> > > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> > > {{#time: j
> > > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr:
> > > | {{#time:
> > > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > > {{{Geburtstag|}}}
> > > }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} +
> > > 1
> > > }} }}|
> > > ]]| [[birthday::false| ]]}}
> > >
> > > This will achieve the following:
> > >
> > > 1.) check, if the attribute has been set at all. Depending on that,
> > > set
> > > "birthday" to either true or false (because if not set, it does not
> > > contain
> > > simply an empty string but rather does not exist, thus casting
> > > errors
> > > in
> > > further processing)
> > >
> > > 2.) Write the components to the properties birth-day, birth-month
> > > and
> > > birth-year, which then can further be used
> > >
> > > 3.) Write the next upcoming birthday of this person to the property
> > > "nextbd".
> > >
> > > This is at least what works fine for the birthday list in my SMW.
> > >
> > > Cheers,
> > > Hans
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> > > Sent from the Semantic Mediawiki - User mailing list archive at
> > > Nabble.com.
> > >
> > >
> ------------------------------------------------------------------------------
> > > How ServiceNow helps IT people transform IT departments:
> > > 1. Consolidate legacy IT systems to a single system of record for
> > > IT
> > > 2. Standardize and globalize service processes across IT
> > > 3. Implement zero-touch automation to replace manual, redundant
> > > tasks
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Semediawiki-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> > >
> >
> >
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Cavila Contrafibularity
In reply to this post by Krabina Bernhard
Bernhard, what you describe sounds like what SMW and SIO refer to as "recurring events". I think you'd be better off using SIO. See:

SIO:
http://www.mediawiki.org/wiki/Extension:Semantic_Internal_Objects#Creating_recurring_events

SMW:
http://semantic-mediawiki.org/wiki/Help:Recurring_events
http://semantic-mediawiki.org/wiki/Help:Queriable_recurring_events

Best,
Cav

> Date: Thu, 12 Sep 2013 13:43:53 +0200
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [Semediawiki-user] querying for parts of date
>
> > > Can it handle incomplete dates? I have birthdates of historical
> > > persons, where only 1857 or "Mai 1487" is available...
> >
> > The original Post had asked " ... and I want to query persons who's
> > birthday is on a specific date (no matter what year the birthdate
> > is)...". If only the year 1857 is available and you want to ask for
> > specific dates no matter what year, then this is going to become
> > difficult... ;-) SCNR.
>
> sure, by use case is May 1857, I want to get may as month and nothing as day.
>
> > But yes, there is some handling of incomplete dates by the parser
> > function #time that is used here. If you just enter "1857" as
> > birthdate, the Parser will assume the current day and month (e.g.
> > Sept. 12th 1857, which probably is of no help). If you enter "April
> > 1857", the parser will give you the 1st of April as the complete
> > date.
>
> But this doesn't work:
> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> It shows an error message below the info box. Does work perfectly with complete dates.
>
> > One of your options is to force the user to enter complete date
> > strings, e.g. using a date picker in the form, and define a rule
> > that in case of unknown months January should be selected and in
> > case of unknown days the 1st.
>
> no. if the exact birth date of a historical person is just not known, I can't let the users enter something else as the information that is know. birhtdate 1. January 1482 is simply wrong, if it was not on the 1st of January.
>
> > If you require a more explicit handling (e.g. if full date is known
> > display a congratulation box at the birthday, whereas if only the
> > month is known, display a text like "... during this month it's
> > xxx's birthday ..."), then you will need to do the parsing of the
> > date entry string yourself. #time will return identical results e.g.
> > for "January 1857" and "1857/1/1", i.e. not let you know wheter the
> > user entered January 1st or whether it was added by the parser.
> >
> > Another option is to have three separate fields for the user to enter
> > birth day/month/year so that you know which have been set.
>
> Yes, this would have been the best option, but I now have a wiki with 18.000 entries and cannot re-do this :-(
>
> > Hope that helps,
>
> thank you for your help. Do incomplete dates (May 1875) work in your wiki?
>
> regards,
> Bernhard
>
>
> > 2013/9/12 Krabina Bernhard < [hidden email] >
> >
> >
> > wow, this looks great, thank you.
> >
> > Can it handle incomplete dates? I have birthdates of historical
> > persons, where only 1857 or "Mai 1487" is available...
> >
> > regards,
> > Bernhard
> >
> > ----- Ursprüngliche Mail -----
> > > Hi Bernhard,
> > >
> > > >> is there a way to query only for parts of a date?
> > >
> > > > how about saving the birthday as a Text property in ISO format,
> > > > like
> > > > 1978-04-29 and doing some string magic with parser functions...
> > >
> > > It doesn't have to be text format. Assumed you have a form and a
> > > template
> > > "Person" with a property "Geburtstag" of type date, than you could
> > > include
> > > the following in the template:
> > >
> > > {{#if: {{{Geburtstag|}}} | [[birthday::true|
> > > ]][[birth-day::{{#time:
> > > j |
> > > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> > > {{{Geburtstag|}}}
> > > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> > > {{#time: j
> > > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}} }}.{{#ifexpr:
> > > | {{#time:
> > > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > > {{{Geburtstag|}}}
> > > }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}} +
> > > 1
> > > }} }}|
> > > ]]| [[birthday::false| ]]}}
> > >
> > > This will achieve the following:
> > >
> > > 1.) check, if the attribute has been set at all. Depending on that,
> > > set
> > > "birthday" to either true or false (because if not set, it does not
> > > contain
> > > simply an empty string but rather does not exist, thus casting
> > > errors
> > > in
> > > further processing)
> > >
> > > 2.) Write the components to the properties birth-day, birth-month
> > > and
> > > birth-year, which then can further be used
> > >
> > > 3.) Write the next upcoming birthday of this person to the property
> > > "nextbd".
> > >
> > > This is at least what works fine for the birthday list in my SMW.
> > >
> > > Cheers,
> > > Hans
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > > http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> > > Sent from the Semantic Mediawiki - User mailing list archive at
> > > Nabble.com.
> > >
> > > ------------------------------------------------------------------------------
> > > How ServiceNow helps IT people transform IT departments:
> > > 1. Consolidate legacy IT systems to a single system of record for
> > > IT
> > > 2. Standardize and globalize service processes across IT
> > > 3. Implement zero-touch automation to replace manual, redundant
> > > tasks
> > > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Semediawiki-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> > >
> >
> >
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
     
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
In reply to this post by Hans Oleander-2
Dear all,

I was very close to accomplish a correct parsing of already entered, partly incomplete dates in a wiki. I managed to get the Birthday, Birthmonth and Bithyear of a Attributte:Birthdate of type date with birthdates like 24/07/1894 or 24. September 1894. It was even possible to use "Jänner" and "März". [1]

The one thing that destroys it all is that the time parser function thinks it's more clever than it should be "Full or partial absolute dates can be specified; the function will "fill in" parts of the date that are not specified using the current values" [2]

How stupid is that? From an incomplete date Mai 1875 I get "19" as the day today and will get "20" tomorrow without the possibility to switch this off!

I am very annoyed by this :-(

I think this cannot only be the problem of the parser functions extension, I think that SMW (offering the type "date" attribute) should provide something to handle incomplete dates or let somebody query "what's the year of a person's birthdate set to "24/07/1894". This is all I want and cannot be accomplished after hours of trying and hacking around with parser functions.

The learning is never to use dates als Type:Date with forms or date pickers if you happen to have incomplete dates. Instead you have to provide separate fields for day, month and year and do it the other way around: combine the user entries to a birthdate (which then can be of type date again).

BTW: there is a bug in Parser functions returning a wrong DAY if the dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to an error but the time function understands "Juni" and "Juli", but delivers one day too less: 14. Juni will deliver 13 as day (!), 14. Mai will deliver 14...
You can see this here: [3])

regards,
Bernhard

[1] http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
[2] http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
[3] http://standards.kdz.eu/index.php?title=Benutzer:Admin

----- Ursprüngliche Mail -----

>
>
>
> > thank you for your help. Do incomplete dates (May 1875) work in
> > your wiki?
>
> They do work, but it is language specific. So "May 1875" does work
> and returns May 1st 1875, "Mai 1875" (as on your page) doest not.
> This is because the PHP function strtotime() is used for the
> conversion and expects english input. I am afraid you will need to
> include a few replace instructions to handle this.
>
> Best,
> Hans
>
>
>
>
> 2013/9/12 Krabina Bernhard < [hidden email] >
>
>
>
> > > Can it handle incomplete dates? I have birthdates of historical
> > > persons, where only 1857 or "Mai 1487" is available...
> >
> > The original Post had asked " ... and I want to query persons who's
> > birthday is on a specific date (no matter what year the birthdate
> > is)...". If only the year 1857 is available and you want to ask for
> > specific dates no matter what year, then this is going to become
> > difficult... ;-) SCNR.
>
> sure, by use case is May 1857, I want to get may as month and nothing
> as day.
>
>
> > But yes, there is some handling of incomplete dates by the parser
> > function #time that is used here. If you just enter "1857" as
> > birthdate, the Parser will assume the current day and month (e.g.
> > Sept. 12th 1857, which probably is of no help). If you enter "April
> > 1857", the parser will give you the 1st of April as the complete
> > date.
>
> But this doesn't work:
> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> It shows an error message below the info box. Does work perfectly
> with complete dates.
>
>
> > One of your options is to force the user to enter complete date
> > strings, e.g. using a date picker in the form, and define a rule
> > that in case of unknown months January should be selected and in
> > case of unknown days the 1st.
>
> no. if the exact birth date of a historical person is just not known,
> I can't let the users enter something else as the information that
> is know. birhtdate 1. January 1482 is simply wrong, if it was not on
> the 1st of January.
>
>
> > If you require a more explicit handling (e.g. if full date is known
> > display a congratulation box at the birthday, whereas if only the
> > month is known, display a text like "... during this month it's
> > xxx's birthday ..."), then you will need to do the parsing of the
> > date entry string yourself. #time will return identical results
> > e.g.
> > for "January 1857" and "1857/1/1", i.e. not let you know wheter the
> > user entered January 1st or whether it was added by the parser.
> >
> > Another option is to have three separate fields for the user to
> > enter
> > birth day/month/year so that you know which have been set.
>
> Yes, this would have been the best option, but I now have a wiki with
> 18.000 entries and cannot re-do this :-(
>
> > Hope that helps,
>
> thank you for your help. Do incomplete dates (May 1875) work in your
> wiki?
>
> regards,
> Bernhard
>
>
>
>
> > 2013/9/12 Krabina Bernhard < [hidden email] >
> >
> >
> > wow, this looks great, thank you.
> >
> > Can it handle incomplete dates? I have birthdates of historical
> > persons, where only 1857 or "Mai 1487" is available...
> >
> > regards,
> > Bernhard
> >
> > ----- Ursprüngliche Mail -----
> > > Hi Bernhard,
> > >
> > > >> is there a way to query only for parts of a date?
> > >
> > > > how about saving the birthday as a Text property in ISO format,
> > > > like
> > > > 1978-04-29 and doing some string magic with parser functions...
> > >
> > > It doesn't have to be text format. Assumed you have a form and a
> > > template
> > > "Person" with a property "Geburtstag" of type date, than you
> > > could
> > > include
> > > the following in the template:
> > >
> > > {{#if: {{{Geburtstag|}}} | [[birthday::true|
> > > ]][[birth-day::{{#time:
> > > j |
> > > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> > > {{{Geburtstag|}}}
> > > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]] [[nextbd::
> > > {{#time: j
> > > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
> > > | }}.{{#ifexpr:
> > > | {{#time:
> > > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > > {{{Geburtstag|}}}
> > > }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} | {{#expr: {{CURRENTYEAR}}
> > > +
> > > 1
> > > }} }}|
> > > ]]| [[birthday::false| ]]}}
> > >
> > > This will achieve the following:
> > >
> > > 1.) check, if the attribute has been set at all. Depending on
> > > that,
> > > set
> > > "birthday" to either true or false (because if not set, it does
> > > not
> > > contain
> > > simply an empty string but rather does not exist, thus casting
> > > errors
> > > in
> > > further processing)
> > >
> > > 2.) Write the components to the properties birth-day, birth-month
> > > and
> > > birth-year, which then can further be used
> > >
> > > 3.) Write the next upcoming birthday of this person to the
> > > property
> > > "nextbd".
> > >
> > > This is at least what works fine for the birthday list in my SMW.
> > >
> > > Cheers,
> > > Hans
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > > http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013125.html
> > > Sent from the Semantic Mediawiki - User mailing list archive at
> > > Nabble.com.
> > >
> > > ------------------------------------------------------------------------------
> > > How ServiceNow helps IT people transform IT departments:
> > > 1. Consolidate legacy IT systems to a single system of record for
> > > IT
> > > 2. Standardize and globalize service processes across IT
> > > 3. Implement zero-touch automation to replace manual, redundant
> > > tasks
> > > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> > > _______________________________________________
> > > Semediawiki-user mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> > >
> >
> >
>
>

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
In reply to this post by Krabina Bernhard
> Why do insist on using the dates functionality? Why don't you just
> create three properties for day, month and year, and build the logic
> yourself?

yes, this is the learning. but if you have a wiki with already 20.000 entries this doesn't help much.

I can't understand why I cant query in SMW what month a date is if its in there...

regards,
Bernhard

>
> Met vriendelijke groet,
> Tom Kronenburg
>
>
>
> drs. T. Kronenburg
>
> PBLQ | Voor een sterke publieke sector
> Postbus 18607 | 2502 EP Den Haag | Van de Spiegelstraat 12 | 2518 ET
> Den Haag | T: 070 351 49 97 | F: 070 351 52 82 | M: 06 55 77 83 53 |
> I: www.pblq.nl
>
> Deze email is afkomstig van PBLQ, ingeschreven in het handelsregister
> van de Kamer van Koophandel onder nummer 27190312 te Den Haag. De
> disclaimer vindt u op http://www.pblq.nl/disclaimer
>
> Wilt u op de hoogte blijven van de activiteiten van PBLQ? Meld u aan
> voor de PBLQ nieuwsbrief via:
> http://www.pblq.nl/formulieren/nieuwsbrief
>
> Twitter: @pblq
>
> -----Oorspronkelijk bericht-----
> Van: Krabina Bernhard [mailto:[hidden email]]
> Verzonden: donderdag 19 september 2013 13:01
> Aan: Hans Oleander
> CC: Semantic MediaWiki users
> Onderwerp: Re: [Semediawiki-user] querying for parts of date
>
> Dear all,
>
> I was very close to accomplish a correct parsing of already entered,
> partly incomplete dates in a wiki. I managed to get the Birthday,
> Birthmonth and Bithyear of a Attributte:Birthdate of type date with
> birthdates like 24/07/1894 or 24. September 1894. It was even
> possible to use "Jänner" and "März". [1]
>
> The one thing that destroys it all is that the time parser function
> thinks it's more clever than it should be "Full or partial absolute
> dates can be specified; the function will "fill in" parts of the
> date that are not specified using the current values" [2]
>
> How stupid is that? From an incomplete date Mai 1875 I get "19" as
> the day today and will get "20" tomorrow without the possibility to
> switch this off!
>
> I am very annoyed by this :-(
>
> I think this cannot only be the problem of the parser functions
> extension, I think that SMW (offering the type "date" attribute)
> should provide something to handle incomplete dates or let somebody
> query "what's the year of a person's birthdate set to "24/07/1894".
> This is all I want and cannot be accomplished after hours of trying
> and hacking around with parser functions.
>
> The learning is never to use dates als Type:Date with forms or date
> pickers if you happen to have incomplete dates. Instead you have to
> provide separate fields for day, month and year and do it the other
> way around: combine the user entries to a birthdate (which then can
> be of type date again).
>
> BTW: there is a bug in Parser functions returning a wrong DAY if the
> dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to an
> error but the time function understands "Juni" and "Juli", but
> delivers one day too less: 14. Juni will deliver 13 as day (!), 14.
> Mai will deliver 14...
> You can see this here: [3])
>
> regards,
> Bernhard
>
> [1]
> http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
> [2]
> http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
> [3] http://standards.kdz.eu/index.php?title=Benutzer:Admin
>
> ----- Ursprüngliche Mail -----
> >
> >
> >
> > > thank you for your help. Do incomplete dates (May 1875) work in
> > > your
> > > wiki?
> >
> > They do work, but it is language specific. So "May 1875" does work
> > and
> > returns May 1st 1875, "Mai 1875" (as on your page) doest not.
> > This is because the PHP function strtotime() is used for the
> > conversion and expects english input. I am afraid you will need to
> > include a few replace instructions to handle this.
> >
> > Best,
> > Hans
> >
> >
> >
> >
> > 2013/9/12 Krabina Bernhard < [hidden email] >
> >
> >
> >
> > > > Can it handle incomplete dates? I have birthdates of historical
> > > > persons, where only 1857 or "Mai 1487" is available...
> > >
> > > The original Post had asked " ... and I want to query persons
> > > who's
> > > birthday is on a specific date (no matter what year the birthdate
> > > is)...". If only the year 1857 is available and you want to ask
> > > for
> > > specific dates no matter what year, then this is going to become
> > > difficult... ;-) SCNR.
> >
> > sure, by use case is May 1857, I want to get may as month and
> > nothing
> > as day.
> >
> >
> > > But yes, there is some handling of incomplete dates by the parser
> > > function #time that is used here. If you just enter "1857" as
> > > birthdate, the Parser will assume the current day and month (e.g.
> > > Sept. 12th 1857, which probably is of no help). If you enter
> > > "April
> > > 1857", the parser will give you the 1st of April as the complete
> > > date.
> >
> > But this doesn't work:
> > http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> > It shows an error message below the info box. Does work perfectly
> > with
> > complete dates.
> >
> >
> > > One of your options is to force the user to enter complete date
> > > strings, e.g. using a date picker in the form, and define a rule
> > > that in case of unknown months January should be selected and in
> > > case of unknown days the 1st.
> >
> > no. if the exact birth date of a historical person is just not
> > known,
> > I can't let the users enter something else as the information that
> > is
> > know. birhtdate 1. January 1482 is simply wrong, if it was not on
> > the
> > 1st of January.
> >
> >
> > > If you require a more explicit handling (e.g. if full date is
> > > known
> > > display a congratulation box at the birthday, whereas if only the
> > > month is known, display a text like "... during this month it's
> > > xxx's birthday ..."), then you will need to do the parsing of the
> > > date entry string yourself. #time will return identical results
> > > e.g.
> > > for "January 1857" and "1857/1/1", i.e. not let you know wheter
> > > the
> > > user entered January 1st or whether it was added by the parser.
> > >
> > > Another option is to have three separate fields for the user to
> > > enter birth day/month/year so that you know which have been set.
> >
> > Yes, this would have been the best option, but I now have a wiki
> > with
> > 18.000 entries and cannot re-do this :-(
> >
> > > Hope that helps,
> >
> > thank you for your help. Do incomplete dates (May 1875) work in
> > your
> > wiki?
> >
> > regards,
> > Bernhard
> >
> >
> >
> >
> > > 2013/9/12 Krabina Bernhard < [hidden email] >
> > >
> > >
> > > wow, this looks great, thank you.
> > >
> > > Can it handle incomplete dates? I have birthdates of historical
> > > persons, where only 1857 or "Mai 1487" is available...
> > >
> > > regards,
> > > Bernhard
> > >
> > > ----- Ursprüngliche Mail -----
> > > > Hi Bernhard,
> > > >
> > > > >> is there a way to query only for parts of a date?
> > > >
> > > > > how about saving the birthday as a Text property in ISO
> > > > > format,
> > > > > like
> > > > > 1978-04-29 and doing some string magic with parser
> > > > > functions...
> > > >
> > > > It doesn't have to be text format. Assumed you have a form and
> > > > a
> > > > template "Person" with a property "Geburtstag" of type date,
> > > > than
> > > > you could include the following in the template:
> > > >
> > > > {{#if: {{{Geburtstag|}}} | [[birthday::true|
> > > > ]][[birth-day::{{#time:
> > > > j |
> > > > {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> > > > {{{Geburtstag|}}}
> > > > }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]]
> > > > [[nextbd::
> > > > {{#time: j
> > > > | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
> > > > | }}.{{#ifexpr:
> > > > | {{#time:
> > > > j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> > > > {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> > > > {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} |
> > > > {{#expr: {{CURRENTYEAR}}
> > > > +
> > > > 1
> > > > }} }}|
> > > > ]]| [[birthday::false| ]]}}
> > > >
> > > > This will achieve the following:
> > > >
> > > > 1.) check, if the attribute has been set at all. Depending on
> > > > that, set "birthday" to either true or false (because if not
> > > > set,
> > > > it does not contain simply an empty string but rather does not
> > > > exist, thus casting errors in further processing)
> > > >
> > > > 2.) Write the components to the properties birth-day,
> > > > birth-month
> > > > and birth-year, which then can further be used
> > > >
> > > > 3.) Write the next upcoming birthday of this person to the
> > > > property "nextbd".
> > > >
> > > > This is at least what works fine for the birthday list in my
> > > > SMW.
> > > >
> > > > Cheers,
> > > > Hans
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > > http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013
> > > > 118p5013125.html Sent from the Semantic Mediawiki - User
> > > > mailing
> > > > list archive at Nabble.com.
> > > >
> > > > ------------------------------------------------------------------
> > > > ------------ How ServiceNow helps IT people transform IT
> > > > departments:
> > > > 1. Consolidate legacy IT systems to a single system of record
> > > > for
> > > > IT 2. Standardize and globalize service processes across IT 3.
> > > > Implement zero-touch automation to replace manual, redundant
> > > > tasks
> > > > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/os
> > > > tg.clktrk _______________________________________________
> > > > Semediawiki-user mailing list
> > > > [hidden email]
> > > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> > > >
> > >
> > >
> >
> >
>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New
> Multi-Library Power Pack includes Mobile, Cloud, Java, and UX
> Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Neill Mitchell
Hi Bernhard.

Can you not just add #set and #time in your templates to set new day,
month and year properties and then query those?

Example:
{{#set:Month={{#time:F|{{{Start Date|}}}}}}}
{{#set:Year={{#time:Y|{{{Start Date|}}}}}}}
{{#set:Day={{#time:l|{{{Start Date|}}}}}}}

That way you don't break your existing forms and templates or change
your data.

Cheers
Neill.
On 19/09/13 13:18, Krabina Bernhard wrote:

>> Why do insist on using the dates functionality? Why don't you just
>> create three properties for day, month and year, and build the logic
>> yourself?
> yes, this is the learning. but if you have a wiki with already 20.000 entries this doesn't help much.
>
> I can't understand why I cant query in SMW what month a date is if its in there...
>
> regards,
> Bernhard
>
>> Met vriendelijke groet,
>> Tom Kronenburg
>>
>>
>>
>> drs. T. Kronenburg
>>
>> PBLQ | Voor een sterke publieke sector
>> Postbus 18607 | 2502 EP Den Haag | Van de Spiegelstraat 12 | 2518 ET
>> Den Haag | T: 070 351 49 97 | F: 070 351 52 82 | M: 06 55 77 83 53 |
>> I: www.pblq.nl
>>
>> Deze email is afkomstig van PBLQ, ingeschreven in het handelsregister
>> van de Kamer van Koophandel onder nummer 27190312 te Den Haag. De
>> disclaimer vindt u op http://www.pblq.nl/disclaimer
>>
>> Wilt u op de hoogte blijven van de activiteiten van PBLQ? Meld u aan
>> voor de PBLQ nieuwsbrief via:
>> http://www.pblq.nl/formulieren/nieuwsbrief
>>
>> Twitter: @pblq
>>
>> -----Oorspronkelijk bericht-----
>> Van: Krabina Bernhard [mailto:[hidden email]]
>> Verzonden: donderdag 19 september 2013 13:01
>> Aan: Hans Oleander
>> CC: Semantic MediaWiki users
>> Onderwerp: Re: [Semediawiki-user] querying for parts of date
>>
>> Dear all,
>>
>> I was very close to accomplish a correct parsing of already entered,
>> partly incomplete dates in a wiki. I managed to get the Birthday,
>> Birthmonth and Bithyear of a Attributte:Birthdate of type date with
>> birthdates like 24/07/1894 or 24. September 1894. It was even
>> possible to use "Jänner" and "März". [1]
>>
>> The one thing that destroys it all is that the time parser function
>> thinks it's more clever than it should be "Full or partial absolute
>> dates can be specified; the function will "fill in" parts of the
>> date that are not specified using the current values" [2]
>>
>> How stupid is that? From an incomplete date Mai 1875 I get "19" as
>> the day today and will get "20" tomorrow without the possibility to
>> switch this off!
>>
>> I am very annoyed by this :-(
>>
>> I think this cannot only be the problem of the parser functions
>> extension, I think that SMW (offering the type "date" attribute)
>> should provide something to handle incomplete dates or let somebody
>> query "what's the year of a person's birthdate set to "24/07/1894".
>> This is all I want and cannot be accomplished after hours of trying
>> and hacking around with parser functions.
>>
>> The learning is never to use dates als Type:Date with forms or date
>> pickers if you happen to have incomplete dates. Instead you have to
>> provide separate fields for day, month and year and do it the other
>> way around: combine the user entries to a birthdate (which then can
>> be of type date again).
>>
>> BTW: there is a bug in Parser functions returning a wrong DAY if the
>> dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to an
>> error but the time function understands "Juni" and "Juli", but
>> delivers one day too less: 14. Juni will deliver 13 as day (!), 14.
>> Mai will deliver 14...
>> You can see this here: [3])
>>
>> regards,
>> Bernhard
>>
>> [1]
>> http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
>> [2]
>> http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
>> [3] http://standards.kdz.eu/index.php?title=Benutzer:Admin
>>
>> ----- Ursprüngliche Mail -----
>>>
>>>
>>>> thank you for your help. Do incomplete dates (May 1875) work in
>>>> your
>>>> wiki?
>>> They do work, but it is language specific. So "May 1875" does work
>>> and
>>> returns May 1st 1875, "Mai 1875" (as on your page) doest not.
>>> This is because the PHP function strtotime() is used for the
>>> conversion and expects english input. I am afraid you will need to
>>> include a few replace instructions to handle this.
>>>
>>> Best,
>>> Hans
>>>
>>>
>>>
>>>
>>> 2013/9/12 Krabina Bernhard < [hidden email] >
>>>
>>>
>>>
>>>>> Can it handle incomplete dates? I have birthdates of historical
>>>>> persons, where only 1857 or "Mai 1487" is available...
>>>> The original Post had asked " ... and I want to query persons
>>>> who's
>>>> birthday is on a specific date (no matter what year the birthdate
>>>> is)...". If only the year 1857 is available and you want to ask
>>>> for
>>>> specific dates no matter what year, then this is going to become
>>>> difficult... ;-) SCNR.
>>> sure, by use case is May 1857, I want to get may as month and
>>> nothing
>>> as day.
>>>
>>>
>>>> But yes, there is some handling of incomplete dates by the parser
>>>> function #time that is used here. If you just enter "1857" as
>>>> birthdate, the Parser will assume the current day and month (e.g.
>>>> Sept. 12th 1857, which probably is of no help). If you enter
>>>> "April
>>>> 1857", the parser will give you the 1st of April as the complete
>>>> date.
>>> But this doesn't work:
>>> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
>>> It shows an error message below the info box. Does work perfectly
>>> with
>>> complete dates.
>>>
>>>
>>>> One of your options is to force the user to enter complete date
>>>> strings, e.g. using a date picker in the form, and define a rule
>>>> that in case of unknown months January should be selected and in
>>>> case of unknown days the 1st.
>>> no. if the exact birth date of a historical person is just not
>>> known,
>>> I can't let the users enter something else as the information that
>>> is
>>> know. birhtdate 1. January 1482 is simply wrong, if it was not on
>>> the
>>> 1st of January.
>>>
>>>
>>>> If you require a more explicit handling (e.g. if full date is
>>>> known
>>>> display a congratulation box at the birthday, whereas if only the
>>>> month is known, display a text like "... during this month it's
>>>> xxx's birthday ..."), then you will need to do the parsing of the
>>>> date entry string yourself. #time will return identical results
>>>> e.g.
>>>> for "January 1857" and "1857/1/1", i.e. not let you know wheter
>>>> the
>>>> user entered January 1st or whether it was added by the parser.
>>>>
>>>> Another option is to have three separate fields for the user to
>>>> enter birth day/month/year so that you know which have been set.
>>> Yes, this would have been the best option, but I now have a wiki
>>> with
>>> 18.000 entries and cannot re-do this :-(
>>>
>>>> Hope that helps,
>>> thank you for your help. Do incomplete dates (May 1875) work in
>>> your
>>> wiki?
>>>
>>> regards,
>>> Bernhard
>>>
>>>
>>>
>>>
>>>> 2013/9/12 Krabina Bernhard < [hidden email] >
>>>>
>>>>
>>>> wow, this looks great, thank you.
>>>>
>>>> Can it handle incomplete dates? I have birthdates of historical
>>>> persons, where only 1857 or "Mai 1487" is available...
>>>>
>>>> regards,
>>>> Bernhard
>>>>
>>>> ----- Ursprüngliche Mail -----
>>>>> Hi Bernhard,
>>>>>
>>>>>>> is there a way to query only for parts of a date?
>>>>>> how about saving the birthday as a Text property in ISO
>>>>>> format,
>>>>>> like
>>>>>> 1978-04-29 and doing some string magic with parser
>>>>>> functions...
>>>>> It doesn't have to be text format. Assumed you have a form and
>>>>> a
>>>>> template "Person" with a property "Geburtstag" of type date,
>>>>> than
>>>>> you could include the following in the template:
>>>>>
>>>>> {{#if: {{{Geburtstag|}}} | [[birthday::true|
>>>>> ]][[birth-day::{{#time:
>>>>> j |
>>>>> {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
>>>>> {{{Geburtstag|}}}
>>>>> }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]]
>>>>> [[nextbd::
>>>>> {{#time: j
>>>>> | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
>>>>> | }}.{{#ifexpr:
>>>>> | {{#time:
>>>>> j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
>>>>> {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
>>>>> {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} |
>>>>> {{#expr: {{CURRENTYEAR}}
>>>>> +
>>>>> 1
>>>>> }} }}|
>>>>> ]]| [[birthday::false| ]]}}
>>>>>
>>>>> This will achieve the following:
>>>>>
>>>>> 1.) check, if the attribute has been set at all. Depending on
>>>>> that, set "birthday" to either true or false (because if not
>>>>> set,
>>>>> it does not contain simply an empty string but rather does not
>>>>> exist, thus casting errors in further processing)
>>>>>
>>>>> 2.) Write the components to the properties birth-day,
>>>>> birth-month
>>>>> and birth-year, which then can further be used
>>>>>
>>>>> 3.) Write the next upcoming birthday of this person to the
>>>>> property "nextbd".
>>>>>
>>>>> This is at least what works fine for the birthday list in my
>>>>> SMW.
>>>>>
>>>>> Cheers,
>>>>> Hans
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013
>>>>> 118p5013125.html Sent from the Semantic Mediawiki - User
>>>>> mailing
>>>>> list archive at Nabble.com.
>>>>>
>>>>> ------------------------------------------------------------------
>>>>> ------------ How ServiceNow helps IT people transform IT
>>>>> departments:
>>>>> 1. Consolidate legacy IT systems to a single system of record
>>>>> for
>>>>> IT 2. Standardize and globalize service processes across IT 3.
>>>>> Implement zero-touch automation to replace manual, redundant
>>>>> tasks
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/os
>>>>> tg.clktrk _______________________________________________
>>>>> Semediawiki-user mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>>>>
>>>>
>>>
>> ------------------------------------------------------------------------------
>> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
>> SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New
>> Multi-Library Power Pack includes Mobile, Cloud, Java, and UX
>> Design. Lowest price ever! Ends 9/20/13.
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Semediawiki-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
Hi Neill,

this is what I was doing. It works fine, except for the problem that #time returns the current day for a date where there is no day present. So #time:l|Janurary 2013 returns "20" today and "21" tomorrow...

regards,
Bernhard
----- Ursprüngliche Mail -----

> Hi Bernhard.
>
> Can you not just add #set and #time in your templates to set new day,
> month and year properties and then query those?
>
> Example:
> {{#set:Month={{#time:F|{{{Start Date|}}}}}}}
> {{#set:Year={{#time:Y|{{{Start Date|}}}}}}}
> {{#set:Day={{#time:l|{{{Start Date|}}}}}}}
>
> That way you don't break your existing forms and templates or change
> your data.
>
> Cheers
> Neill.
> On 19/09/13 13:18, Krabina Bernhard wrote:
> >> Why do insist on using the dates functionality? Why don't you just
> >> create three properties for day, month and year, and build the
> >> logic
> >> yourself?
> > yes, this is the learning. but if you have a wiki with already
> > 20.000 entries this doesn't help much.
> >
> > I can't understand why I cant query in SMW what month a date is if
> > its in there...
> >
> > regards,
> > Bernhard
> >
> >> Met vriendelijke groet,
> >> Tom Kronenburg
> >>
> >>
> >>
> >> drs. T. Kronenburg
> >>
> >> PBLQ | Voor een sterke publieke sector
> >> Postbus 18607 | 2502 EP Den Haag | Van de Spiegelstraat 12 | 2518
> >> ET
> >> Den Haag | T: 070 351 49 97 | F: 070 351 52 82 | M: 06 55 77 83 53
> >> |
> >> I: www.pblq.nl
> >>
> >> Deze email is afkomstig van PBLQ, ingeschreven in het
> >> handelsregister
> >> van de Kamer van Koophandel onder nummer 27190312 te Den Haag. De
> >> disclaimer vindt u op http://www.pblq.nl/disclaimer
> >>
> >> Wilt u op de hoogte blijven van de activiteiten van PBLQ? Meld u
> >> aan
> >> voor de PBLQ nieuwsbrief via:
> >> http://www.pblq.nl/formulieren/nieuwsbrief
> >>
> >> Twitter: @pblq
> >>
> >> -----Oorspronkelijk bericht-----
> >> Van: Krabina Bernhard [mailto:[hidden email]]
> >> Verzonden: donderdag 19 september 2013 13:01
> >> Aan: Hans Oleander
> >> CC: Semantic MediaWiki users
> >> Onderwerp: Re: [Semediawiki-user] querying for parts of date
> >>
> >> Dear all,
> >>
> >> I was very close to accomplish a correct parsing of already
> >> entered,
> >> partly incomplete dates in a wiki. I managed to get the Birthday,
> >> Birthmonth and Bithyear of a Attributte:Birthdate of type date
> >> with
> >> birthdates like 24/07/1894 or 24. September 1894. It was even
> >> possible to use "Jänner" and "März". [1]
> >>
> >> The one thing that destroys it all is that the time parser
> >> function
> >> thinks it's more clever than it should be "Full or partial
> >> absolute
> >> dates can be specified; the function will "fill in" parts of the
> >> date that are not specified using the current values" [2]
> >>
> >> How stupid is that? From an incomplete date Mai 1875 I get "19" as
> >> the day today and will get "20" tomorrow without the possibility
> >> to
> >> switch this off!
> >>
> >> I am very annoyed by this :-(
> >>
> >> I think this cannot only be the problem of the parser functions
> >> extension, I think that SMW (offering the type "date" attribute)
> >> should provide something to handle incomplete dates or let
> >> somebody
> >> query "what's the year of a person's birthdate set to
> >> "24/07/1894".
> >> This is all I want and cannot be accomplished after hours of
> >> trying
> >> and hacking around with parser functions.
> >>
> >> The learning is never to use dates als Type:Date with forms or
> >> date
> >> pickers if you happen to have incomplete dates. Instead you have
> >> to
> >> provide separate fields for day, month and year and do it the
> >> other
> >> way around: combine the user entries to a birthdate (which then
> >> can
> >> be of type date again).
> >>
> >> BTW: there is a bug in Parser functions returning a wrong DAY if
> >> the
> >> dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to an
> >> error but the time function understands "Juni" and "Juli", but
> >> delivers one day too less: 14. Juni will deliver 13 as day (!),
> >> 14.
> >> Mai will deliver 14...
> >> You can see this here: [3])
> >>
> >> regards,
> >> Bernhard
> >>
> >> [1]
> >> http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
> >> [2]
> >> http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
> >> [3] http://standards.kdz.eu/index.php?title=Benutzer:Admin
> >>
> >> ----- Ursprüngliche Mail -----
> >>>
> >>>
> >>>> thank you for your help. Do incomplete dates (May 1875) work in
> >>>> your
> >>>> wiki?
> >>> They do work, but it is language specific. So "May 1875" does
> >>> work
> >>> and
> >>> returns May 1st 1875, "Mai 1875" (as on your page) doest not.
> >>> This is because the PHP function strtotime() is used for the
> >>> conversion and expects english input. I am afraid you will need
> >>> to
> >>> include a few replace instructions to handle this.
> >>>
> >>> Best,
> >>> Hans
> >>>
> >>>
> >>>
> >>>
> >>> 2013/9/12 Krabina Bernhard < [hidden email] >
> >>>
> >>>
> >>>
> >>>>> Can it handle incomplete dates? I have birthdates of historical
> >>>>> persons, where only 1857 or "Mai 1487" is available...
> >>>> The original Post had asked " ... and I want to query persons
> >>>> who's
> >>>> birthday is on a specific date (no matter what year the
> >>>> birthdate
> >>>> is)...". If only the year 1857 is available and you want to ask
> >>>> for
> >>>> specific dates no matter what year, then this is going to become
> >>>> difficult... ;-) SCNR.
> >>> sure, by use case is May 1857, I want to get may as month and
> >>> nothing
> >>> as day.
> >>>
> >>>
> >>>> But yes, there is some handling of incomplete dates by the
> >>>> parser
> >>>> function #time that is used here. If you just enter "1857" as
> >>>> birthdate, the Parser will assume the current day and month
> >>>> (e.g.
> >>>> Sept. 12th 1857, which probably is of no help). If you enter
> >>>> "April
> >>>> 1857", the parser will give you the 1st of April as the complete
> >>>> date.
> >>> But this doesn't work:
> >>> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> >>> It shows an error message below the info box. Does work perfectly
> >>> with
> >>> complete dates.
> >>>
> >>>
> >>>> One of your options is to force the user to enter complete date
> >>>> strings, e.g. using a date picker in the form, and define a rule
> >>>> that in case of unknown months January should be selected and in
> >>>> case of unknown days the 1st.
> >>> no. if the exact birth date of a historical person is just not
> >>> known,
> >>> I can't let the users enter something else as the information
> >>> that
> >>> is
> >>> know. birhtdate 1. January 1482 is simply wrong, if it was not on
> >>> the
> >>> 1st of January.
> >>>
> >>>
> >>>> If you require a more explicit handling (e.g. if full date is
> >>>> known
> >>>> display a congratulation box at the birthday, whereas if only
> >>>> the
> >>>> month is known, display a text like "... during this month it's
> >>>> xxx's birthday ..."), then you will need to do the parsing of
> >>>> the
> >>>> date entry string yourself. #time will return identical results
> >>>> e.g.
> >>>> for "January 1857" and "1857/1/1", i.e. not let you know wheter
> >>>> the
> >>>> user entered January 1st or whether it was added by the parser.
> >>>>
> >>>> Another option is to have three separate fields for the user to
> >>>> enter birth day/month/year so that you know which have been set.
> >>> Yes, this would have been the best option, but I now have a wiki
> >>> with
> >>> 18.000 entries and cannot re-do this :-(
> >>>
> >>>> Hope that helps,
> >>> thank you for your help. Do incomplete dates (May 1875) work in
> >>> your
> >>> wiki?
> >>>
> >>> regards,
> >>> Bernhard
> >>>
> >>>
> >>>
> >>>
> >>>> 2013/9/12 Krabina Bernhard < [hidden email] >
> >>>>
> >>>>
> >>>> wow, this looks great, thank you.
> >>>>
> >>>> Can it handle incomplete dates? I have birthdates of historical
> >>>> persons, where only 1857 or "Mai 1487" is available...
> >>>>
> >>>> regards,
> >>>> Bernhard
> >>>>
> >>>> ----- Ursprüngliche Mail -----
> >>>>> Hi Bernhard,
> >>>>>
> >>>>>>> is there a way to query only for parts of a date?
> >>>>>> how about saving the birthday as a Text property in ISO
> >>>>>> format,
> >>>>>> like
> >>>>>> 1978-04-29 and doing some string magic with parser
> >>>>>> functions...
> >>>>> It doesn't have to be text format. Assumed you have a form and
> >>>>> a
> >>>>> template "Person" with a property "Geburtstag" of type date,
> >>>>> than
> >>>>> you could include the following in the template:
> >>>>>
> >>>>> {{#if: {{{Geburtstag|}}} | [[birthday::true|
> >>>>> ]][[birth-day::{{#time:
> >>>>> j |
> >>>>> {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> >>>>> {{{Geburtstag|}}}
> >>>>> }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]]
> >>>>> [[nextbd::
> >>>>> {{#time: j
> >>>>> | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
> >>>>> | }}.{{#ifexpr:
> >>>>> | {{#time:
> >>>>> j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> >>>>> {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> >>>>> {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} |
> >>>>> {{#expr: {{CURRENTYEAR}}
> >>>>> +
> >>>>> 1
> >>>>> }} }}|
> >>>>> ]]| [[birthday::false| ]]}}
> >>>>>
> >>>>> This will achieve the following:
> >>>>>
> >>>>> 1.) check, if the attribute has been set at all. Depending on
> >>>>> that, set "birthday" to either true or false (because if not
> >>>>> set,
> >>>>> it does not contain simply an empty string but rather does not
> >>>>> exist, thus casting errors in further processing)
> >>>>>
> >>>>> 2.) Write the components to the properties birth-day,
> >>>>> birth-month
> >>>>> and birth-year, which then can further be used
> >>>>>
> >>>>> 3.) Write the next upcoming birthday of this person to the
> >>>>> property "nextbd".
> >>>>>
> >>>>> This is at least what works fine for the birthday list in my
> >>>>> SMW.
> >>>>>
> >>>>> Cheers,
> >>>>> Hans
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> View this message in context:
> >>>>> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013
> >>>>> 118p5013125.html Sent from the Semantic Mediawiki - User
> >>>>> mailing
> >>>>> list archive at Nabble.com.
> >>>>>
> >>>>> ------------------------------------------------------------------
> >>>>> ------------ How ServiceNow helps IT people transform IT
> >>>>> departments:
> >>>>> 1. Consolidate legacy IT systems to a single system of record
> >>>>> for
> >>>>> IT 2. Standardize and globalize service processes across IT 3.
> >>>>> Implement zero-touch automation to replace manual, redundant
> >>>>> tasks
> >>>>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/os
> >>>>> tg.clktrk _______________________________________________
> >>>>> Semediawiki-user mailing list
> >>>>> [hidden email]
> >>>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>>>>
> >>>>
> >>>
> >> ------------------------------------------------------------------------------
> >> LIMITED TIME SALE - Full Year of Microsoft Training For Just
> >> $49.99!
> >> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> >> SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New
> >> Multi-Library Power Pack includes Mobile, Cloud, Java, and UX
> >> Design. Lowest price ever! Ends 9/20/13.
> >> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Semediawiki-user mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>
> > ------------------------------------------------------------------------------
> > LIMITED TIME SALE - Full Year of Microsoft Training For Just
> > $49.99!
> > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> > SharePoint
> > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power
> > Pack includes
> > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends
> > 9/20/13.
> > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Semediawiki-user mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>
>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
> includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Hans Oleander
In reply to this post by Krabina Bernhard
Hello Bernhard,

I very much agree with your analysis. The behavior of the date property is unsatisfactory in this respect. It should at least be configurable, and IMHO should as a default return undefined or zero values for information that actually does not exist. And this is not mentioning the language related issues...

However, as you have mentioned the large number of your article base again:

> yes, this is the learning. but if you have a wiki with already 20.000 entries this doesn't help much.

I would like to point you to the replace-text extension, which happens to be another of these very nice contributions of Yaron & Co.  :-)

Obviously you want to backup and/or clone your wiki before applying a regex search&replace. But as you would just be splitting up one property into three (rather than the other way building one property out of a set of three), I think it is actually quite feasible. What I suggest to do is to run several rather defensive search&replace operations, thus minimizing the danger of unwanted damage (however, you can undo it, and it is only a working copy anyhow).

Then go on and search for articles without the new properties. As long as there are many of them you are likely to find another pattern to catch these. The small rest can be done manually.

Best,
Hans
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Neill Mitchell
In reply to this post by Krabina Bernhard
Hi Bernhard.

So perhaps a little string parser function to work out if there is no
day component and then put a little #if around the #set:Day so it
doesn't get called if missing?
Fiddly, but do-able!

Cheers
Neill
On 20/09/13 13:41, Krabina Bernhard wrote:

> Hi Neill,
>
> this is what I was doing. It works fine, except for the problem that #time returns the current day for a date where there is no day present. So #time:l|Janurary 2013 returns "20" today and "21" tomorrow...
>
> regards,
> Bernhard
> ----- Ursprüngliche Mail -----
>> Hi Bernhard.
>>
>> Can you not just add #set and #time in your templates to set new day,
>> month and year properties and then query those?
>>
>> Example:
>> {{#set:Month={{#time:F|{{{Start Date|}}}}}}}
>> {{#set:Year={{#time:Y|{{{Start Date|}}}}}}}
>> {{#set:Day={{#time:l|{{{Start Date|}}}}}}}
>>
>> That way you don't break your existing forms and templates or change
>> your data.
>>
>> Cheers
>> Neill.
>> On 19/09/13 13:18, Krabina Bernhard wrote:
>>>> Why do insist on using the dates functionality? Why don't you just
>>>> create three properties for day, month and year, and build the
>>>> logic
>>>> yourself?
>>> yes, this is the learning. but if you have a wiki with already
>>> 20.000 entries this doesn't help much.
>>>
>>> I can't understand why I cant query in SMW what month a date is if
>>> its in there...
>>>
>>> regards,
>>> Bernhard
>>>
>>>> Met vriendelijke groet,
>>>> Tom Kronenburg
>>>>
>>>>
>>>>
>>>> drs. T. Kronenburg
>>>>
>>>> PBLQ | Voor een sterke publieke sector
>>>> Postbus 18607 | 2502 EP Den Haag | Van de Spiegelstraat 12 | 2518
>>>> ET
>>>> Den Haag | T: 070 351 49 97 | F: 070 351 52 82 | M: 06 55 77 83 53
>>>> |
>>>> I: www.pblq.nl
>>>>
>>>> Deze email is afkomstig van PBLQ, ingeschreven in het
>>>> handelsregister
>>>> van de Kamer van Koophandel onder nummer 27190312 te Den Haag. De
>>>> disclaimer vindt u op http://www.pblq.nl/disclaimer
>>>>
>>>> Wilt u op de hoogte blijven van de activiteiten van PBLQ? Meld u
>>>> aan
>>>> voor de PBLQ nieuwsbrief via:
>>>> http://www.pblq.nl/formulieren/nieuwsbrief
>>>>
>>>> Twitter: @pblq
>>>>
>>>> -----Oorspronkelijk bericht-----
>>>> Van: Krabina Bernhard [mailto:[hidden email]]
>>>> Verzonden: donderdag 19 september 2013 13:01
>>>> Aan: Hans Oleander
>>>> CC: Semantic MediaWiki users
>>>> Onderwerp: Re: [Semediawiki-user] querying for parts of date
>>>>
>>>> Dear all,
>>>>
>>>> I was very close to accomplish a correct parsing of already
>>>> entered,
>>>> partly incomplete dates in a wiki. I managed to get the Birthday,
>>>> Birthmonth and Bithyear of a Attributte:Birthdate of type date
>>>> with
>>>> birthdates like 24/07/1894 or 24. September 1894. It was even
>>>> possible to use "Jänner" and "März". [1]
>>>>
>>>> The one thing that destroys it all is that the time parser
>>>> function
>>>> thinks it's more clever than it should be "Full or partial
>>>> absolute
>>>> dates can be specified; the function will "fill in" parts of the
>>>> date that are not specified using the current values" [2]
>>>>
>>>> How stupid is that? From an incomplete date Mai 1875 I get "19" as
>>>> the day today and will get "20" tomorrow without the possibility
>>>> to
>>>> switch this off!
>>>>
>>>> I am very annoyed by this :-(
>>>>
>>>> I think this cannot only be the problem of the parser functions
>>>> extension, I think that SMW (offering the type "date" attribute)
>>>> should provide something to handle incomplete dates or let
>>>> somebody
>>>> query "what's the year of a person's birthdate set to
>>>> "24/07/1894".
>>>> This is all I want and cannot be accomplished after hours of
>>>> trying
>>>> and hacking around with parser functions.
>>>>
>>>> The learning is never to use dates als Type:Date with forms or
>>>> date
>>>> pickers if you happen to have incomplete dates. Instead you have
>>>> to
>>>> provide separate fields for day, month and year and do it the
>>>> other
>>>> way around: combine the user entries to a birthdate (which then
>>>> can
>>>> be of type date again).
>>>>
>>>> BTW: there is a bug in Parser functions returning a wrong DAY if
>>>> the
>>>> dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to an
>>>> error but the time function understands "Juni" and "Juli", but
>>>> delivers one day too less: 14. Juni will deliver 13 as day (!),
>>>> 14.
>>>> Mai will deliver 14...
>>>> You can see this here: [3])
>>>>
>>>> regards,
>>>> Bernhard
>>>>
>>>> [1]
>>>> http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
>>>> [2]
>>>> http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
>>>> [3] http://standards.kdz.eu/index.php?title=Benutzer:Admin
>>>>
>>>> ----- Ursprüngliche Mail -----
>>>>>
>>>>>> thank you for your help. Do incomplete dates (May 1875) work in
>>>>>> your
>>>>>> wiki?
>>>>> They do work, but it is language specific. So "May 1875" does
>>>>> work
>>>>> and
>>>>> returns May 1st 1875, "Mai 1875" (as on your page) doest not.
>>>>> This is because the PHP function strtotime() is used for the
>>>>> conversion and expects english input. I am afraid you will need
>>>>> to
>>>>> include a few replace instructions to handle this.
>>>>>
>>>>> Best,
>>>>> Hans
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2013/9/12 Krabina Bernhard < [hidden email] >
>>>>>
>>>>>
>>>>>
>>>>>>> Can it handle incomplete dates? I have birthdates of historical
>>>>>>> persons, where only 1857 or "Mai 1487" is available...
>>>>>> The original Post had asked " ... and I want to query persons
>>>>>> who's
>>>>>> birthday is on a specific date (no matter what year the
>>>>>> birthdate
>>>>>> is)...". If only the year 1857 is available and you want to ask
>>>>>> for
>>>>>> specific dates no matter what year, then this is going to become
>>>>>> difficult... ;-) SCNR.
>>>>> sure, by use case is May 1857, I want to get may as month and
>>>>> nothing
>>>>> as day.
>>>>>
>>>>>
>>>>>> But yes, there is some handling of incomplete dates by the
>>>>>> parser
>>>>>> function #time that is used here. If you just enter "1857" as
>>>>>> birthdate, the Parser will assume the current day and month
>>>>>> (e.g.
>>>>>> Sept. 12th 1857, which probably is of no help). If you enter
>>>>>> "April
>>>>>> 1857", the parser will give you the 1st of April as the complete
>>>>>> date.
>>>>> But this doesn't work:
>>>>> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
>>>>> It shows an error message below the info box. Does work perfectly
>>>>> with
>>>>> complete dates.
>>>>>
>>>>>
>>>>>> One of your options is to force the user to enter complete date
>>>>>> strings, e.g. using a date picker in the form, and define a rule
>>>>>> that in case of unknown months January should be selected and in
>>>>>> case of unknown days the 1st.
>>>>> no. if the exact birth date of a historical person is just not
>>>>> known,
>>>>> I can't let the users enter something else as the information
>>>>> that
>>>>> is
>>>>> know. birhtdate 1. January 1482 is simply wrong, if it was not on
>>>>> the
>>>>> 1st of January.
>>>>>
>>>>>
>>>>>> If you require a more explicit handling (e.g. if full date is
>>>>>> known
>>>>>> display a congratulation box at the birthday, whereas if only
>>>>>> the
>>>>>> month is known, display a text like "... during this month it's
>>>>>> xxx's birthday ..."), then you will need to do the parsing of
>>>>>> the
>>>>>> date entry string yourself. #time will return identical results
>>>>>> e.g.
>>>>>> for "January 1857" and "1857/1/1", i.e. not let you know wheter
>>>>>> the
>>>>>> user entered January 1st or whether it was added by the parser.
>>>>>>
>>>>>> Another option is to have three separate fields for the user to
>>>>>> enter birth day/month/year so that you know which have been set.
>>>>> Yes, this would have been the best option, but I now have a wiki
>>>>> with
>>>>> 18.000 entries and cannot re-do this :-(
>>>>>
>>>>>> Hope that helps,
>>>>> thank you for your help. Do incomplete dates (May 1875) work in
>>>>> your
>>>>> wiki?
>>>>>
>>>>> regards,
>>>>> Bernhard
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> 2013/9/12 Krabina Bernhard < [hidden email] >
>>>>>>
>>>>>>
>>>>>> wow, this looks great, thank you.
>>>>>>
>>>>>> Can it handle incomplete dates? I have birthdates of historical
>>>>>> persons, where only 1857 or "Mai 1487" is available...
>>>>>>
>>>>>> regards,
>>>>>> Bernhard
>>>>>>
>>>>>> ----- Ursprüngliche Mail -----
>>>>>>> Hi Bernhard,
>>>>>>>
>>>>>>>>> is there a way to query only for parts of a date?
>>>>>>>> how about saving the birthday as a Text property in ISO
>>>>>>>> format,
>>>>>>>> like
>>>>>>>> 1978-04-29 and doing some string magic with parser
>>>>>>>> functions...
>>>>>>> It doesn't have to be text format. Assumed you have a form and
>>>>>>> a
>>>>>>> template "Person" with a property "Geburtstag" of type date,
>>>>>>> than
>>>>>>> you could include the following in the template:
>>>>>>>
>>>>>>> {{#if: {{{Geburtstag|}}} | [[birthday::true|
>>>>>>> ]][[birth-day::{{#time:
>>>>>>> j |
>>>>>>> {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
>>>>>>> {{{Geburtstag|}}}
>>>>>>> }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]]
>>>>>>> [[nextbd::
>>>>>>> {{#time: j
>>>>>>> | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
>>>>>>> | }}.{{#ifexpr:
>>>>>>> | {{#time:
>>>>>>> j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
>>>>>>> {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
>>>>>>> {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} |
>>>>>>> {{#expr: {{CURRENTYEAR}}
>>>>>>> +
>>>>>>> 1
>>>>>>> }} }}|
>>>>>>> ]]| [[birthday::false| ]]}}
>>>>>>>
>>>>>>> This will achieve the following:
>>>>>>>
>>>>>>> 1.) check, if the attribute has been set at all. Depending on
>>>>>>> that, set "birthday" to either true or false (because if not
>>>>>>> set,
>>>>>>> it does not contain simply an empty string but rather does not
>>>>>>> exist, thus casting errors in further processing)
>>>>>>>
>>>>>>> 2.) Write the components to the properties birth-day,
>>>>>>> birth-month
>>>>>>> and birth-year, which then can further be used
>>>>>>>
>>>>>>> 3.) Write the next upcoming birthday of this person to the
>>>>>>> property "nextbd".
>>>>>>>
>>>>>>> This is at least what works fine for the birthday list in my
>>>>>>> SMW.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Hans
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013
>>>>>>> 118p5013125.html Sent from the Semantic Mediawiki - User
>>>>>>> mailing
>>>>>>> list archive at Nabble.com.
>>>>>>>
>>>>>>> ------------------------------------------------------------------
>>>>>>> ------------ How ServiceNow helps IT people transform IT
>>>>>>> departments:
>>>>>>> 1. Consolidate legacy IT systems to a single system of record
>>>>>>> for
>>>>>>> IT 2. Standardize and globalize service processes across IT 3.
>>>>>>> Implement zero-touch automation to replace manual, redundant
>>>>>>> tasks
>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/os
>>>>>>> tg.clktrk _______________________________________________
>>>>>>> Semediawiki-user mailing list
>>>>>>> [hidden email]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>>>>>>
>>>> ------------------------------------------------------------------------------
>>>> LIMITED TIME SALE - Full Year of Microsoft Training For Just
>>>> $49.99!
>>>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
>>>> SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New
>>>> Multi-Library Power Pack includes Mobile, Cloud, Java, and UX
>>>> Design. Lowest price ever! Ends 9/20/13.
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Semediawiki-user mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>>>
>>> ------------------------------------------------------------------------------
>>> LIMITED TIME SALE - Full Year of Microsoft Training For Just
>>> $49.99!
>>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
>>> SharePoint
>>> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power
>>> Pack includes
>>> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends
>>> 9/20/13.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Semediawiki-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>
>> ------------------------------------------------------------------------------
>> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
>> SharePoint
>> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
>> includes
>> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Semediawiki-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Krabina Bernhard
Dear all,

I have put some more effort in this and accomplished a decent parsing of incomplete dates. But of course, the next bug was waiting for me: Years may be incorrectly stored as "1 January 1970" + timestamp (Bug 54151). A workaround is to add "AD" or "BC" to the value. [1]
In my wiki this happens if a date property is set to a year smaller than 1000. So "May 990" works, but "990" not.

You can see the template with the parsing here [2] and the result here [3].

If I use the "AD" my parsing does not work, so I still have to take care of that.

And all of this, just because SMW cannot query the month of a property of type::date "September 2013" :-/

[1] https://www.semantic-mediawiki.org/wiki/Help:Type_Date#Open_Issues
[2] http://standards.kdz.eu/index.php?title=Vorlage:Person&action=edit
[3] http://standards.kdz.eu/index.php?title=Benutzer:Admin

----- Ursprüngliche Mail -----

> Hi Bernhard.
>
> So perhaps a little string parser function to work out if there is no
> day component and then put a little #if around the #set:Day so it
> doesn't get called if missing?
> Fiddly, but do-able!
>
> Cheers
> Neill
> On 20/09/13 13:41, Krabina Bernhard wrote:
> > Hi Neill,
> >
> > this is what I was doing. It works fine, except for the problem
> > that #time returns the current day for a date where there is no
> > day present. So #time:l|Janurary 2013 returns "20" today and "21"
> > tomorrow...
> >
> > regards,
> > Bernhard
> > ----- Ursprüngliche Mail -----
> >> Hi Bernhard.
> >>
> >> Can you not just add #set and #time in your templates to set new
> >> day,
> >> month and year properties and then query those?
> >>
> >> Example:
> >> {{#set:Month={{#time:F|{{{Start Date|}}}}}}}
> >> {{#set:Year={{#time:Y|{{{Start Date|}}}}}}}
> >> {{#set:Day={{#time:l|{{{Start Date|}}}}}}}
> >>
> >> That way you don't break your existing forms and templates or
> >> change
> >> your data.
> >>
> >> Cheers
> >> Neill.
> >> On 19/09/13 13:18, Krabina Bernhard wrote:
> >>>> Why do insist on using the dates functionality? Why don't you
> >>>> just
> >>>> create three properties for day, month and year, and build the
> >>>> logic
> >>>> yourself?
> >>> yes, this is the learning. but if you have a wiki with already
> >>> 20.000 entries this doesn't help much.
> >>>
> >>> I can't understand why I cant query in SMW what month a date is
> >>> if
> >>> its in there...
> >>>
> >>> regards,
> >>> Bernhard
> >>>
> >>>> Met vriendelijke groet,
> >>>> Tom Kronenburg
> >>>>
> >>>>
> >>>>
> >>>> drs. T. Kronenburg
> >>>>
> >>>> PBLQ | Voor een sterke publieke sector
> >>>> Postbus 18607 | 2502 EP Den Haag | Van de Spiegelstraat 12 |
> >>>> 2518
> >>>> ET
> >>>> Den Haag | T: 070 351 49 97 | F: 070 351 52 82 | M: 06 55 77 83
> >>>> 53
> >>>> |
> >>>> I: www.pblq.nl
> >>>>
> >>>> Deze email is afkomstig van PBLQ, ingeschreven in het
> >>>> handelsregister
> >>>> van de Kamer van Koophandel onder nummer 27190312 te Den Haag.
> >>>> De
> >>>> disclaimer vindt u op http://www.pblq.nl/disclaimer
> >>>>
> >>>> Wilt u op de hoogte blijven van de activiteiten van PBLQ? Meld u
> >>>> aan
> >>>> voor de PBLQ nieuwsbrief via:
> >>>> http://www.pblq.nl/formulieren/nieuwsbrief
> >>>>
> >>>> Twitter: @pblq
> >>>>
> >>>> -----Oorspronkelijk bericht-----
> >>>> Van: Krabina Bernhard [mailto:[hidden email]]
> >>>> Verzonden: donderdag 19 september 2013 13:01
> >>>> Aan: Hans Oleander
> >>>> CC: Semantic MediaWiki users
> >>>> Onderwerp: Re: [Semediawiki-user] querying for parts of date
> >>>>
> >>>> Dear all,
> >>>>
> >>>> I was very close to accomplish a correct parsing of already
> >>>> entered,
> >>>> partly incomplete dates in a wiki. I managed to get the
> >>>> Birthday,
> >>>> Birthmonth and Bithyear of a Attributte:Birthdate of type date
> >>>> with
> >>>> birthdates like 24/07/1894 or 24. September 1894. It was even
> >>>> possible to use "Jänner" and "März". [1]
> >>>>
> >>>> The one thing that destroys it all is that the time parser
> >>>> function
> >>>> thinks it's more clever than it should be "Full or partial
> >>>> absolute
> >>>> dates can be specified; the function will "fill in" parts of the
> >>>> date that are not specified using the current values" [2]
> >>>>
> >>>> How stupid is that? From an incomplete date Mai 1875 I get "19"
> >>>> as
> >>>> the day today and will get "20" tomorrow without the possibility
> >>>> to
> >>>> switch this off!
> >>>>
> >>>> I am very annoyed by this :-(
> >>>>
> >>>> I think this cannot only be the problem of the parser functions
> >>>> extension, I think that SMW (offering the type "date" attribute)
> >>>> should provide something to handle incomplete dates or let
> >>>> somebody
> >>>> query "what's the year of a person's birthdate set to
> >>>> "24/07/1894".
> >>>> This is all I want and cannot be accomplished after hours of
> >>>> trying
> >>>> and hacking around with parser functions.
> >>>>
> >>>> The learning is never to use dates als Type:Date with forms or
> >>>> date
> >>>> pickers if you happen to have incomplete dates. Instead you have
> >>>> to
> >>>> provide separate fields for day, month and year and do it the
> >>>> other
> >>>> way around: combine the user entries to a birthdate (which then
> >>>> can
> >>>> be of type date again).
> >>>>
> >>>> BTW: there is a bug in Parser functions returning a wrong DAY if
> >>>> the
> >>>> dates MONTH is "Juni" or "Juli" (German, I know. "Mai" leads to
> >>>> an
> >>>> error but the time function understands "Juni" and "Juli", but
> >>>> delivers one day too less: 14. Juni will deliver 13 as day (!),
> >>>> 14.
> >>>> Mai will deliver 14...
> >>>> You can see this here: [3])
> >>>>
> >>>> regards,
> >>>> Bernhard
> >>>>
> >>>> [1]
> >>>> http://standards.kdz.eu/index.php?title=Spezial:Durchsuchen/Anna_Boschek
> >>>> [2]
> >>>> http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time
> >>>> [3] http://standards.kdz.eu/index.php?title=Benutzer:Admin
> >>>>
> >>>> ----- Ursprüngliche Mail -----
> >>>>>
> >>>>>> thank you for your help. Do incomplete dates (May 1875) work
> >>>>>> in
> >>>>>> your
> >>>>>> wiki?
> >>>>> They do work, but it is language specific. So "May 1875" does
> >>>>> work
> >>>>> and
> >>>>> returns May 1st 1875, "Mai 1875" (as on your page) doest not.
> >>>>> This is because the PHP function strtotime() is used for the
> >>>>> conversion and expects english input. I am afraid you will need
> >>>>> to
> >>>>> include a few replace instructions to handle this.
> >>>>>
> >>>>> Best,
> >>>>> Hans
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> 2013/9/12 Krabina Bernhard < [hidden email] >
> >>>>>
> >>>>>
> >>>>>
> >>>>>>> Can it handle incomplete dates? I have birthdates of
> >>>>>>> historical
> >>>>>>> persons, where only 1857 or "Mai 1487" is available...
> >>>>>> The original Post had asked " ... and I want to query persons
> >>>>>> who's
> >>>>>> birthday is on a specific date (no matter what year the
> >>>>>> birthdate
> >>>>>> is)...". If only the year 1857 is available and you want to
> >>>>>> ask
> >>>>>> for
> >>>>>> specific dates no matter what year, then this is going to
> >>>>>> become
> >>>>>> difficult... ;-) SCNR.
> >>>>> sure, by use case is May 1857, I want to get may as month and
> >>>>> nothing
> >>>>> as day.
> >>>>>
> >>>>>
> >>>>>> But yes, there is some handling of incomplete dates by the
> >>>>>> parser
> >>>>>> function #time that is used here. If you just enter "1857" as
> >>>>>> birthdate, the Parser will assume the current day and month
> >>>>>> (e.g.
> >>>>>> Sept. 12th 1857, which probably is of no help). If you enter
> >>>>>> "April
> >>>>>> 1857", the parser will give you the 1st of April as the
> >>>>>> complete
> >>>>>> date.
> >>>>> But this doesn't work:
> >>>>> http://standards.kdz.eu/index.php?title=Paul_Franz_Abdank
> >>>>> It shows an error message below the info box. Does work
> >>>>> perfectly
> >>>>> with
> >>>>> complete dates.
> >>>>>
> >>>>>
> >>>>>> One of your options is to force the user to enter complete
> >>>>>> date
> >>>>>> strings, e.g. using a date picker in the form, and define a
> >>>>>> rule
> >>>>>> that in case of unknown months January should be selected and
> >>>>>> in
> >>>>>> case of unknown days the 1st.
> >>>>> no. if the exact birth date of a historical person is just not
> >>>>> known,
> >>>>> I can't let the users enter something else as the information
> >>>>> that
> >>>>> is
> >>>>> know. birhtdate 1. January 1482 is simply wrong, if it was not
> >>>>> on
> >>>>> the
> >>>>> 1st of January.
> >>>>>
> >>>>>
> >>>>>> If you require a more explicit handling (e.g. if full date is
> >>>>>> known
> >>>>>> display a congratulation box at the birthday, whereas if only
> >>>>>> the
> >>>>>> month is known, display a text like "... during this month
> >>>>>> it's
> >>>>>> xxx's birthday ..."), then you will need to do the parsing of
> >>>>>> the
> >>>>>> date entry string yourself. #time will return identical
> >>>>>> results
> >>>>>> e.g.
> >>>>>> for "January 1857" and "1857/1/1", i.e. not let you know
> >>>>>> wheter
> >>>>>> the
> >>>>>> user entered January 1st or whether it was added by the
> >>>>>> parser.
> >>>>>>
> >>>>>> Another option is to have three separate fields for the user
> >>>>>> to
> >>>>>> enter birth day/month/year so that you know which have been
> >>>>>> set.
> >>>>> Yes, this would have been the best option, but I now have a
> >>>>> wiki
> >>>>> with
> >>>>> 18.000 entries and cannot re-do this :-(
> >>>>>
> >>>>>> Hope that helps,
> >>>>> thank you for your help. Do incomplete dates (May 1875) work in
> >>>>> your
> >>>>> wiki?
> >>>>>
> >>>>> regards,
> >>>>> Bernhard
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> 2013/9/12 Krabina Bernhard < [hidden email] >
> >>>>>>
> >>>>>>
> >>>>>> wow, this looks great, thank you.
> >>>>>>
> >>>>>> Can it handle incomplete dates? I have birthdates of
> >>>>>> historical
> >>>>>> persons, where only 1857 or "Mai 1487" is available...
> >>>>>>
> >>>>>> regards,
> >>>>>> Bernhard
> >>>>>>
> >>>>>> ----- Ursprüngliche Mail -----
> >>>>>>> Hi Bernhard,
> >>>>>>>
> >>>>>>>>> is there a way to query only for parts of a date?
> >>>>>>>> how about saving the birthday as a Text property in ISO
> >>>>>>>> format,
> >>>>>>>> like
> >>>>>>>> 1978-04-29 and doing some string magic with parser
> >>>>>>>> functions...
> >>>>>>> It doesn't have to be text format. Assumed you have a form
> >>>>>>> and
> >>>>>>> a
> >>>>>>> template "Person" with a property "Geburtstag" of type date,
> >>>>>>> than
> >>>>>>> you could include the following in the template:
> >>>>>>>
> >>>>>>> {{#if: {{{Geburtstag|}}} | [[birthday::true|
> >>>>>>> ]][[birth-day::{{#time:
> >>>>>>> j |
> >>>>>>> {{{Geburtstag|}}} }}]].[[birth-month::{{#time: n |
> >>>>>>> {{{Geburtstag|}}}
> >>>>>>> }}]].[[birth-year::{{#time: Y | {{{Geburtstag|}}} }}]]
> >>>>>>> [[nextbd::
> >>>>>>> {{#time: j
> >>>>>>> | {{{Geburtstag|}}} }}.{{#time: n | {{{Geburtstag|}}}
> >>>>>>> | }}.{{#ifexpr:
> >>>>>>> | {{#time:
> >>>>>>> j | {{{Geburtstag|}}} }} >= {{CURRENTDAY}} and {{#time: n |
> >>>>>>> {{{Geburtstag|}}} }} >= {{CURRENTMONTH}} or {{#time: n |
> >>>>>>> {{{Geburtstag|}}} }} > {{CURRENTMONTH}}| {{CURRENTYEAR}} |
> >>>>>>> {{#expr: {{CURRENTYEAR}}
> >>>>>>> +
> >>>>>>> 1
> >>>>>>> }} }}|
> >>>>>>> ]]| [[birthday::false| ]]}}
> >>>>>>>
> >>>>>>> This will achieve the following:
> >>>>>>>
> >>>>>>> 1.) check, if the attribute has been set at all. Depending on
> >>>>>>> that, set "birthday" to either true or false (because if not
> >>>>>>> set,
> >>>>>>> it does not contain simply an empty string but rather does
> >>>>>>> not
> >>>>>>> exist, thus casting errors in further processing)
> >>>>>>>
> >>>>>>> 2.) Write the components to the properties birth-day,
> >>>>>>> birth-month
> >>>>>>> and birth-year, which then can further be used
> >>>>>>>
> >>>>>>> 3.) Write the next upcoming birthday of this person to the
> >>>>>>> property "nextbd".
> >>>>>>>
> >>>>>>> This is at least what works fine for the birthday list in my
> >>>>>>> SMW.
> >>>>>>>
> >>>>>>> Cheers,
> >>>>>>> Hans
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> --
> >>>>>>> View this message in context:
> >>>>>>> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013
> >>>>>>> 118p5013125.html Sent from the Semantic Mediawiki - User
> >>>>>>> mailing
> >>>>>>> list archive at Nabble.com.
> >>>>>>>
> >>>>>>> ------------------------------------------------------------------
> >>>>>>> ------------ How ServiceNow helps IT people transform IT
> >>>>>>> departments:
> >>>>>>> 1. Consolidate legacy IT systems to a single system of record
> >>>>>>> for
> >>>>>>> IT 2. Standardize and globalize service processes across IT
> >>>>>>> 3.
> >>>>>>> Implement zero-touch automation to replace manual, redundant
> >>>>>>> tasks
> >>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/os
> >>>>>>> tg.clktrk _______________________________________________
> >>>>>>> Semediawiki-user mailing list
> >>>>>>> [hidden email]
> >>>>>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>>>>>>
> >>>> ------------------------------------------------------------------------------
> >>>> LIMITED TIME SALE - Full Year of Microsoft Training For Just
> >>>> $49.99!
> >>>> 1,500+ hours of tutorials including VisualStudio 2012, Windows
> >>>> 8,
> >>>> SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New
> >>>> Multi-Library Power Pack includes Mobile, Cloud, Java, and UX
> >>>> Design. Lowest price ever! Ends 9/20/13.
> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> >>>> _______________________________________________
> >>>> Semediawiki-user mailing list
> >>>> [hidden email]
> >>>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>>>
> >>> ------------------------------------------------------------------------------
> >>> LIMITED TIME SALE - Full Year of Microsoft Training For Just
> >>> $49.99!
> >>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> >>> SharePoint
> >>> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power
> >>> Pack includes
> >>> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends
> >>> 9/20/13.
> >>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> >>> _______________________________________________
> >>> Semediawiki-user mailing list
> >>> [hidden email]
> >>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>
> >> ------------------------------------------------------------------------------
> >> LIMITED TIME SALE - Full Year of Microsoft Training For Just
> >> $49.99!
> >> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> >> SharePoint
> >> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power
> >> Pack
> >> includes
> >> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends
> >> 9/20/13.
> >> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Semediawiki-user mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> >>
>
>

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

girlwithglasses
In reply to this post by Krabina Bernhard
Krabina Bernhard wrote
The one thing that destroys it all is that the time parser function thinks it's more clever than it should be "Full or partial absolute dates can be specified; the function will "fill in" parts of the date that are not specified using the current values" [2]

How stupid is that? From an incomplete date Mai 1875 I get "19" as the day today and will get "20" tomorrow without the possibility to switch this off!

I am very annoyed by this :-(

I think this cannot only be the problem of the parser functions extension, I think that SMW (offering the type "date" attribute) should provide something to handle incomplete dates or let somebody query "what's the year of a person's birthdate set to "24/07/1894". This is all I want and cannot be accomplished after hours of trying and hacking around with parser functions.
Is the incomplete date problem in SMW caused by the parser functions extension, or is it a separate issue with the same symptoms? From my investigations, whenever an incomplete date is processed by a template, it gets converted into today's date instead. Can Yaron or someone who knows what's going on in the backend comment on whereabouts this bug is arising?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: querying for parts of date

Yaron Koren-2
Hi,

Just to clarify, since I was mentioned - I don't know that much about the
inner workings of SMW; I mostly deal with related extensions. But I would
file a bug report about this on bugzilla.wikimedia.org, specifying one or
more specific strings that SMW doesn't process correctly.

-Yaron


On Thu, Sep 26, 2013 at 3:27 PM, girlwithglasses <[hidden email]>wrote:

> Krabina Bernhard wrote
> > The one thing that destroys it all is that the time parser function
> thinks
> > it's more clever than it should be "Full or partial absolute dates can be
> > specified; the function will "fill in" parts of the date that are not
> > specified using the current values" [2]
> >
> > How stupid is that? From an incomplete date Mai 1875 I get "19" as the
> day
> > today and will get "20" tomorrow without the possibility to switch this
> > off!
> >
> > I am very annoyed by this :-(
> >
> > I think this cannot only be the problem of the parser functions
> extension,
> > I think that SMW (offering the type "date" attribute) should provide
> > something to handle incomplete dates or let somebody query "what's the
> > year of a person's birthdate set to "24/07/1894". This is all I want and
> > cannot be accomplished after hours of trying and hacking around with
> > parser functions.
>
> Is the incomplete date problem in SMW caused by the parser functions
> extension, or is it a separate issue with the same symptoms? From my
> investigations, whenever an incomplete date is processed by a template, it
> gets converted into today's date instead. Can Yaron or someone who knows
> what's going on in the backend comment on whereabouts this bug is arising?
>
>
>
> --
> View this message in context:
> http://wikimedia.7.x6.nabble.com/querying-for-parts-of-date-tp5013118p5013977.html
> Sent from the Semantic Mediawiki - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
> from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>



--
WikiWorks · MediaWiki Consulting · http://wikiworks.com
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...