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

RE: URI Templates - optional variables?

From: Mike Schinkel <mikeschinkel@gmail.com>
Date: Wed, 1 Aug 2007 15:55:24 -0400
To: "'Marc Hadley'" <Marc.Hadley@Sun.COM>
Cc: <uri@w3.org>
Message-ID: <002201c7d475$e9ea3150$0702a8c0@Guides.local>

Marc Hadley wrote:
> I'd be interested to hear more about the use case for a URI 
> template that behaves in this way. E.g. I'd expect that:
> 
> http://www.example.com/
> http://www.example.com/foo/
> 
> would identify two quite different resources, whereas:
> 
> http://www.example.com/foo/
> http://www.example.com/bar/
> 
> *could* identify two instances of particular kind of 
> resource. I'd like to understand what is the planned use for 
> a URI template that can resolve to either of the first pair - 
> why wouldn't you use two different URI templates ?

>From the exploration I've been doing the examples for benefit of optional
parameters are more in the area of parameters and fragments, but it is still
applicable for in path segments and if the use of the question mark were
allowed to define optional parameters and fragments then it shouldn't be
undefined when found in a path segment.

Where it would be most useful in path segments is when you view the URL path
segments as a generalized query mechanism:

    http://example.com/{make?}/{model?}/{year?}/
    
For make=bmw, model=, and year=2004 you would have:
    
    http://example.com/bmw/2004/
    
For make=, model=m5, and year= you would have:
    
    http://example.com/m5/
    
Now perchance you object to the fact that we could have a make or model with
the same name, or two models with the same name I will say 1.) that's an
orthogonal issue and should be debated seperately from the the URI template
spec, and 2.) you would list them all using id tags that would identify them
as unique:

    http://example.com/neon/#dodge-model
    http://example.com/neon/#plymouth-model

Or in the case a hypothetical new car make came on the market that had the
same name as a model from another make:

    http://example.com/mustang/#make
    http://example.com/mustang/#ford-model

Of course that begs the question of how to represent the fragments in the
URI template, but I'll let this sink in first before I try to tackle that.

-- 
-Mike Schinkel
http://www.mikeschinkel.com/blogs/
http://www.welldesignedurls.org
http://atlanta-web.org - http://t.oolicio.us


P.S. And yes, I am actively designing websites with these concepts.  One
concern others may have is it can result in equivalent content on multiple
URIs and some people don't like this for various reasons (caching, other?),
but I think that concern conflicts with URI opacity, i.e. the URI
authority's right to be able to design their own URL structure.  And like
how URI Templates is addressing the issues some people like me have with the
limits URI Opacity previously placed on system design, I think other
initiatives could be presented to address the issues of equivalent content
on multiple URIs. 
Received on Wednesday, 1 August 2007 19:55:42 UTC

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