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

Re: URI Templates - optional variables?

From: Roy T. Fielding <fielding@gbiv.com>
Date: Wed, 1 Aug 2007 17:32:08 -0700
Message-Id: <DAF64A3F-D8BE-4757-A8D3-8B3745D28347@gbiv.com>
Cc: Joe Gregorio <joe@bitworking.org>
To: uri@w3.org

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 00:32:15 UTC

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