W3C home > Mailing lists > Public > uri@w3.org > October 2007

Re: URI Templates - optional variables?

From: Joe Gregorio <joe@bitworking.org>
Date: Tue, 16 Oct 2007 01:30:32 -0400
Message-ID: <3f1451f50710152230hc0ebd4do9ec5f7efa349bfd6@mail.gmail.com>
To: "Roy T. Fielding" <fielding@gbiv.com>
Cc: "Mark Nottingham" <mnot@mnot.net>, URI <uri@w3.org>, "Stefan Eissing" <stefan.eissing@greenbytes.de>

On 10/15/07, Roy T. Fielding <fielding@gbiv.com> wrote:
> I am struggling to think of a use case for arrays in real practice.
> I could understand modifying join such that it treats single variables
> with array values the same as multiple variables with single values,
> e.g,
>    http://example.org/sausage?{+,|condiments} =
>    http://example.org/sausage?condiments=tomato%20sauce,chutney,relish
> but I can't think of a case where I would need that for a web service.
> Also, how does the reader of the template know that the variable is
> supposed to be an array?

The 'listjoin' operator, <&>, is the part of my proposal that I
feel the least comfortable with, as it ends up introducing 'types'
into the grammar. The parsing is simple enough that you
don't need a type declaration since only 'listjoin' takes
a variable of type 'list', and you could carry that type information
along and flag ambiguous/invalid templates such as:


But there is a need for something that allows me to
create templates for two situations I put in the proposal, my
own blog:

   URI Template
   Template Variable(s)
       id := ['RESTLog_Specification']

   Template Variable(s)
       id := ['240', 'Newsqueak']

and the GData boolean logic:

    URI Template
    Template Vars
          categories = ["A|-B", "-C"]

If there are other ways to achieve the same result
without resorting to lists I'd love to avoid them
if possible.

> An alternative would be to go the perl direction and add a form
> of type annotation to the variable names, as in
>     http://example.org/checkaddress{,&|name,@address}
> but variable types might be a slope too slippery.

Types and type decorators? I shudder at the thought :)


Joe Gregorio        http://bitworking.org
Received on Tuesday, 16 October 2007 05:30:41 UTC

This archive was generated by hypermail 2.4.0 : Sunday, 10 October 2021 22:17:50 UTC