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

RE: URI Templates - optional variables?

From: Hoop Somuah (???) <hoop@zune.net>
Date: Wed, 1 Aug 2007 18:07:52 -0700
To: "Roy T. Fielding" <fielding@gbiv.com>, "uri@w3.org" <uri@w3.org>
Message-ID: <E55C1C56C054D3469A89426B3CBA610D2953E64D81@DF-MASTIFF-MSG.exchange.corp.microsoft.com>

For array types like this:
     E.g. friend = [ "name1", "name2", "name3" ]

would you have:
     {,&:name} = "friend=name1&friend=name2&friend=name3"

OR
     {,&:name} = "friend=name1,name2,name3"
?

Also, is there any scenario where I might want the "=" to be a different character?

-----Original Message-----
From: uri-request@w3.org [mailto:uri-request@w3.org] On Behalf Of Roy T. Fielding
Sent: Wednesday, August 01, 2007 5:32 PM
To: uri@w3.org
Cc: Joe Gregorio
Subject: Re: URI Templates - optional variables?


On Aug 1, 2007, at 3:02 PM, Roy T. Fielding wrote:
>    {%separator:hashvar}
>         For each variable named in the value of hashvar (which could
>         be a space-separated string or some context-dependent hash
>         mechanism), if the named variable is defined and non-empty,
>         then substitute the concatenation of variable name, "=",
>         variable value.  If more than one substitution is made,
>         separate each substitution with the string of non-colon
>         separator characters between the '%' and ':'.
>            E.g.,   myhash = "name age sex location"
>                      name = "Fred"
>                       age = "41"
>                       sex = ""
>                  location = "USA"
>
>            then  {%&:myhash} = "name=Fred&age=41&location=USA"

Actually, that one isn't very useful for resource description.
An explicit list would be better:

    {,separator:var1,var2,var3,...}
         For each variable named in the comma-separated list,
         if the named variable is defined and non-empty, then
         substitute the concatenation of variable name, "=",
         variable value.  If more than one substitution is made,
         separate each substitution with the string of non-colon
         separator characters between the ',' and ':'.
            E.g., name     = "Fred"
                  age      = "41"
                  sex      = ""
                  location = "USA"
         {,&:name,age,sex,location} = "name=Fred&age=41&location=USA"

I hope it is clear what the use cases for that would be.

.....Roy
Received on Thursday, 2 August 2007 11:04:25 UTC

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