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

Re: draft-gregorio-uritemplate-02.txt

From: James M Snell <jasnell@gmail.com>
Date: Mon, 26 Nov 2007 08:56:51 -0800
Message-ID: <474AFAD3.3080809@gmail.com>
To: Joe Gregorio <joe@bitworking.org>
CC: URI <uri@w3.org>

Looks good overall, some comments:

1. varname is unnecessarily restrictive. There is no harm that I can see
   in using the following:

   unreservedsansdash  = (alphanum / "." / "_" / "~")
   varname             = unreservedsansdash *(unreserved)

   For URI Templates, this is *extremely* minor, but for IRI
   Templates (see below) this will have a significant impact on
   what characters can be used for varname (replace unreserved
   with iunreserved)

2. Did you decide against introducing cardinality indicators?
   e.g., {-list|&|foo+,bar}.

3. For -join, you need to specify what happens if the value is a list.
   e.g., foo = ['a','b'] would expand to foo=a&foo=b

4. There are interesting things that could be done if we allow prefix
   and append to use list values.  The prefix or postfix would be
   applied to each item  in the list. e.g., when foo = ['a','b'],
   {-prefix|/|foo} would expand to "/a/b" and {-append|/|foo} would
   expand to "a/b/".

   http://example.org{-opt|/-|categories}{-prefix|/|categories}

   http://example.org/-/a/b/c

   http://example.org{-opt|/-/|categories}{-append|/|categories}

   http://example.org/-/a/b/c/

5. We need to decide whether or not "extension operations" are going to
   be allowed, and if so, how are they to be handled.  Should an
   template processor signal an error if an unknown operation is used?
   Should the processor replace the unknown token with an empty string?

6. We should include a section on IRI Templates. I'll volunteer to write
   it up if you'd like.  An IRI template is generally identical to the
   URI Template with the exception of the characters allowed in varname,
   arg and the replacements.  The following is taken from my expanded
   ABNF:

   ivalue              = *(iunreserved / pct-encoded)
                         ; replacement value for token

   iunreservedsansdash = (alphanum / "." / "_" / "~" / ucschar)
   iarg                = *(reserved / iunreserved / pct-encoded)
   ivarname            = iunreservedsansdash *(iunreserved)
   ivardefault         = ivalue
   ivar                = ivarname [ "=" ivardefault ]
   ivars               = ivar [*(sep ivar)]
   ivarnodefault       = ivarname
   ivarsnodefault      = ivarname [*(sep ivarname)]

   iidentitytoken      = ivar
   ioperatortoken      = ( append   "|" iarg  "|" ivar  )         /
                         ( prefix   "|" iarg  "|" ivar  )         /
                         ( join     "|" iarg  "|" ivars )         /
                         ( listjoin "|" iarg  "|" ivarnodefault ) /
                         ( opt      "|" iarg  "|" ivarnodefault ) /
                         ( neg      "|" iarg  "|" ivarnodefault ) /
                         ( extop    "|" (iarg / range) "|"
                              (ivar / ivars / ivarnodefault /
                               ivarsnodefault) )

   itoken              = "{" iidentitytoken / ioperatortoken "}"

   itemplate           = *(reserved / ipchar / iprivate / itoken)
   itemplate-expansion = IRI / IRI-reference

- James

Joe Gregorio wrote:
> I've submitted draft-gregorio-uritemplate-02.txt, but it won't be
> officially published until Dec 3rd because of the upcoming
> IETF meeting. I've gone ahead and released the HTML and TXT
> versions of the draft and will update the pointer to the TXT version
> once it is published as an internet-draft.
> 
> As usual, it can be found here:
> 
>    http://bitworking.org/projecs/URI-Templates/
> 
> This version adds the '-cmd' commands we've been talking
> about, w/o the '-sub' command. I've also added an examples
> section and some example code in an Appendix to demonstrate
> how easy the parsing can be.
> 
> I've also written a parser that extracts the example
> templates and variable definitions from the final .TXT version
> of the specification and runs them through the template-expansion code to
> check them against the supplied expansions. Finally, the
> URI Template explainer web service has been updated to
> conform to this draft.
> 
>    Thanks,
>    -joe
> 
Received on Monday, 26 November 2007 16:57:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:37 GMT