W3C home > Mailing lists > Public > uri@w3.org > September 2010

Re: URI Template 04 Questions

From: Thomas Van Lenten <thomasvl@google.com>
Date: Tue, 28 Sep 2010 09:20:27 -0400
Message-ID: <AANLkTimW54nyeSf+K4RBpOaKQ4d1WvuBdZMsDZ3VK-cL@mail.gmail.com>
To: Mike Burrows <mjb@asplake.co.uk>, uri@w3.org
On Tue, Sep 28, 2010 at 8:58 AM, Thomas Van Lenten <thomasvl@google.com> wrote:
> On Tue, Sep 28, 2010 at 5:52 AM, Mike Burrows <mjb@asplake.co.uk> wrote:
>>
>> Hi Thomas,
>>
>> On 27 September 2010 22:00, Thomas Van Lenten <thomasvl@google.com> wrote:
>>>
>>> I've been working on an Objective-C implementation of the 04 draft,
>>> and ran into some questions:
>>>
>>>  - How should empty strings be handled when the expression has more
>>> then one variable reference?  ('{x,empty,y}')
>>
>> I believe that this should expand to '1024,,768', because the empty string
>> is a value like any other.  This particular example isn't tested but it's
>> consistent with other tests.  For example, '{?x,y,empty}' expands to
>> '?x=1024&y=768&empty='.
>>
>>>
>>>  - Section 2.3, paragraph 4 says an variable appearing more then once
>>> should have the same value, what if a different default is listed in
>>> both places?  ('X{foo=val1}Y{foo=val2}Z')
>>
>> Mine expands this to 'Xval1Yval2Z'.  Uncontroversial I hope.
>
> It does sortof conflict with the statement that values should have the
> same value through the whole expression.
>
>>
>>>
>>>  - How should empty strings within arrays be handled? (list = ( 'a',
>>> '', 'b' ) :: '{list}' or '{?list}')
>>>
>>>  - How should empty strings as values in an associative array be
>>> handled? ('keys'  = {'key1': 'val1', 'key2': '', 'key3': 'val3' } ::
>>> '{keys}' or '{?keys}')
>>
>> Just more of the same I think, i.e. empty strings are not a special case.
>
> Right, the fact that empty arrays and associative arrays got special
> treatment was part of why I figured I'd check to make sure they there
> were additional expectations around empty strings within them.
>
>>
>>>  - How should empty strings as keys in an associative array be
>>> handled? ('keys'  = {'key1': 'val1', 'key2': 'val2', '': 'val3' } ::
>>> '{keys}' or '{?keys}')
>>
>> Hadn't thought of that one. Is it valid/useful?  But anyway, mine doesn't
>> treat the empty string key any differently.
>
> I wasn't sure, I was just trying to add more cases to cover all the
> combinations and the results were a little odd, so I figured I'd
> confirm that was intended and that a special case wasn't wanted.

Hit send too quick.  Given:

       "list"  : [ "val1", "", "val3" ],
       "keys1"  : {"key1": "", "key2": "val2"},
       "keys2"  : {"key1": "val1", "": "val2"}

Which are correct?

        "{list}" -> "val1,val3"
or
        "{list}" -> "val1,,val3"

        "{keys1}" -> "key2,val2"
or
        "{keys1}" -> "key1,,key2,val2"

        "{keys2}" -> "key1,val1"
or
        "{keys2}" -> ",val2,key1,val1"

I'd actually coded the first before thinking about it.  But maybe the
second ones are right.

TVL
Received on Tuesday, 28 September 2010 13:20:57 UTC

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