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

Re: Updated URI Template proposal

From: Joe Gregorio <joe@bitworking.org>
Date: Thu, 8 Nov 2007 13:28:24 -0500
Message-ID: <3f1451f50711081028v93bb6a0l5a3ece4b497deae4@mail.gmail.com>
To: "James M Snell" <jasnell@gmail.com>
Cc: URI <uri@w3.org>

On 11/5/07, James M Snell <jasnell@gmail.com> wrote:
> Lastly, you had previously mentioned that the cardinality of vars with
> the join op was an issue.  Could we not use +, * and ? for that?

I think cardinality can be solved at a more
granular level by choosing between
listjoin and join.

    {-listjoin|&num=|numbers}
    {-join|&|num}

What I do think can be done is indicate if a variable is optional or required.
Maybe append the variable name with '+' if the variable is required?

    {num+}                     // num is required
    {-join|&|num,start-index,q+}   // q is required, num and
start-index are optional

Note that setting a default value for a required element is
redundant, since if you don't supply a value the default will be
used. So this could probably be allowed, since it doesn't hurt
anything, but it doesn't add much:

   {num+=2}

Allowing it keeps the parsing simple, as you don't have to add
a rule to forbid it. And this now allows you to neatly cover all the
cardinality cases you mentioned using a combination of
join, listjoin, and requiredness:

    {num}               // 0 or 1
    {num+}             // 1
    {-join|&|num}     // 0 or more
    {-join|&|num+}   // 1 or more


   -joe

-- 
Joe Gregorio        http://bitworking.org
Received on Thursday, 8 November 2007 18:28:43 GMT

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