W3C home > Mailing lists > Public > uri@w3.org > November 2009

Re: URI template: substring for dates

From: Roy T. Fielding <fielding@gbiv.com>
Date: Mon, 2 Nov 2009 11:01:43 -0800
Cc: uri@w3.org
Message-Id: <2A3CC2B8-D87F-493C-A0A9-32090A6EA0F0@gbiv.com>
To: James Manger <James@Manger.com.au>
On Nov 2, 2009, at 4:40 AM, James Manger wrote:

> [Comments on the URI Template working draft]
>
> Constructing a URI with a substring of a user-provided variable  
> value sounds useful. The current working draft has a dictionary site  
> as an example (/dictionary/{term:1}/{term} produces /dictionary/c/ 
> cat), and mentions hash-based storage.
>
> Another important example is dates. Many, many URI designs  
> incorporate dates, in quite a variety of ways (just year, year/month/ 
> day, XML-style timestamp...) -- which sounds like a perfect  
> situation to use a URI template.

Well, not really.  It is fairly common for URI layouts to incorporate
some portion of a date value, such as the year and/or month of  
publication.
Those are simple variable substitutions like:

    /post/{year}{month}/{title}

I have never seen a resource layout incorporate the current time.

In other words, there is no need for the template syntax to be aware
of date fields because (in this case) it is simpler for the variable
values to be limited as such.  String prefix/suffix makes sense because
they are ignorant of variable semantics no matter what the values
might be.  Using substrings to extract fields from a date value
means that we know it is a date value, and thus we can use a more
specific value definition like {seconds} without changing the syntax.

Thanks for the detailed proposal.  I think it would make sense if
we were trying to act like a programming language in the template,
but we are really trying hard to avoid that.

....Roy
Received on Monday, 2 November 2009 19:02:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:13 UTC