URI Best Practices (Was: [PhotoStuff] Bad foaf.owl)

Kendall Grant Clark kendall at monkeyfist.com
Wed Oct 15 15:35:30 EDT 2003


>>>>> "bijan" == Bijan Parsia <bparsia at isr.umd.edu> writes:


  bijan> Though kendall should explain why .foo urls are bad (and suggest
  bijan> principles for constructing RESTful uris).

Okay, since Bijan requested this, I disclaim all responsibility if it
pisses people off...

1. This Semantic Web stuff is still *web* stuff, so we should be adopting
   best practices with regard to, well, web stuff. That includes the W3C's
   Technical Architecture Group's efforts to define first principles for
   the Web, many of which have clear operational significance:

   Architecture of the World Wide Web (Editor's Draft)
   http://www.w3.org/2001/tag/webarch/
   
2. Perhaps the most important rule is to hide extraneous implementation
   detail. URIs are not API method names, but you can think of them in
   that way, which is to say, URIs which do not expose extraneous
   implementation detail are less brittle, less likely to change, and thus
   more likely to endure -- which gives them more *web* value.

   So, in general, except in cases (which are rare, IMO) where it simply
   cannot be helped, URIs should not include file extensions. Thus,

	  http://foo.bar/blap

   is a better URI than
   
	  http://foo.bar/blap.rdf

   because the latter is more likely to change than the former.

   Remember that HTTP types resource representations by specifying a MIME
   type in the HTTP Content-type: header, and that the file extension (if
   that's what it really is, and we can only ever *guess* at that, by the
   way, for resources we don't control or own) is not semantically
   significant for HTTP or for User Agents (well, I think that last bit is
   right; there may be User Agents which rely on file extensions, but
   that's deeply broken behavior).

   Note: some Origin Servers, and Apache is one such, let you map MIME
   types to local resources via file extensions, as well as by other
   means; but that's merely an implementation detail which has little, if
   any bearing on the semantics of HTTP or the Web. Apache gives you other
   ways of setting the type of a (class of) resource(s), like adding an
   AddType to an .htaccess file -- but in theory one can imagine various
   other ways of doing this, which would be perfectly legal.

   Also, for what it's worth, I'll remind folks that the OWL spec suggests
   that you can use either of two MIME types for OWL resources:
   application/xml and application/rdf+xml.

3. As for constructing URIs, one of the URI RFCs says that the only
   inference one may draw from the ordering of URI path elements is that
   leftmost elements are "more significant" (for some value of
   significance, which the RFC doesn't specify) than rightmost
   elements. So compare two URIs:

	  http://foo.bar/OWL/foaf/0.1

   and

          http://foo.bar/OWL/0.1/foaf

   The choice between those two rests on whether you think the path
   element which represents the version number is more or less significant
   than the path element which represents (presumably) the name of an
   ontology, say. (I think the former is better than the latter; a
   property of a thing, its version number, is less significant than the
   thing itself...)

4. Putting a version number into a namespace URI, especially one which
   points to a schema or ontology which may change often, is a reasonable
   best practice. The W3C uses a /YYYY/ pattern to "version" their
   namespace URIs, and that's also a reasonable choice (though I think it
   can be confusing, since sometimes people take it to imply a "freshness"
   metric or lack thereof).

5. Though I'm suddenly wary of offering anyone in this group any advice
   whatever, it might be reasonable for us to figure out a place on the
   Mindswap site to put our various XML, RDF, and OWL ontologies. (Of
   course this interacts with possible or actual ontology libraries,
   though in some subtle ways, IMO, and we can talk about that separately
   if anyone's interested.)

   But for our purposes, I think getting user account path elements out of
   namespace URIs is a Good Thing, given that users move on, accounts get
   recycled, which can lead to breakage. So, all things being equal, any
   of these URIs

          http://mindswap.org/OWL/foaf
	  http://mindswap.org/OWL/foaf/
	  http://mindswap.org/OWL/foaf/<version number>/

   is better than this one

          http://www.mindswap.org/~username/...

   If there systems & documents using the latter already, then it may not
   be worth the costs of changing, so consider this to be a Gentle
   Reminder for the Future, rather than a rule.

Best,
Kendall
-- 
Nobody said it was easy
No one ever said it would be this hard
Oh take me back to the start
  	       	--Coldplay, The Scientist


More information about the PhotoStuff mailing list