[VM] amibuous MIME types and conditional redirects

Hi all,

I had a further thought about the current state of the recipes [1] ...

E.g. recipe 3, the directives given at [1] that configure the content negotiation behaviour are currently:

---
# Rewrite rule to serve HTML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} text/xml [OR]
RewriteCond %{HTTP_ACCEPT} application/xml [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^example3$ example3-content/2005-10-31.html [R=303]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^example3$ example3-content/2005-10-31.rdf [R=303]
---

There are potential problems with including the content types 'text/xml' and 'application/xml' in the first conditional rewrite rule (redirect). 

These are ambiguous content types. They could be used to label either HTML content or RDF content, although in principle this is improper. For example, currently the Jena toolkit includes 'application/xml' in it's 'Accept:' header when attempting to retrieve RDF/XML content. Because the conditional rewrite rules are applied in order, even if Jena also includes 'application/rdf+xml' in an 'Accept:' header, the first rule would match, and Jena would get redirected to HTML content.

I suggest we remove 'application/xml' and 'text/xml' from conditional rewrite rules wherever they appear. So e.g. the rewrite directives for recipe 3 would become:

---
# Rewrite rule to serve HTML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^example3$ example3-content/2005-10-31.html [R=303]

# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^example3$ example3-content/2005-10-31.rdf [R=303]
---

N.B. when handling a request, rewrite rules are examined in order, and if a rule matches, it is applied. What this means is that the order in which the rules are given is significant. Therefore, when using conditional redirects to perform content negotiation, the server cannot account for a weighted preference given by the client. For example, if a hypothetical client were to use the following header:

Accept: application/rdf+xml;q=0.9,text/html;q=0.1

.. under the recipe 3 configuration they would be redirected to HTML content, because of the ordering of the rewrite rules.

If we do not envisage clients that accept both application/rdf+xml and (text/html or application/xhtml+xml) then this is not a problem. However, if we do envisage such clients, then we ought to investigate the use of 'type-map' files instead of conditional redirects, as these do allow the server to account for the weighted preference of the client. 

Al.

[1] http://www.w3.org/2001/sw/BestPractices/VM/http-examples/2006-01-18/
[rev 1.6]

---
Alistair Miles
Research Associate
CCLRC - Rutherford Appleton Laboratory
Building R1 Room 1.60
Fermi Avenue
Chilton
Didcot
Oxfordshire OX11 0QX
United Kingdom
Email:        a.j.miles@rl.ac.uk
Tel: +44 (0)1235 445440



> -----Original Message-----
> From: public-swbp-wg-request@w3.org
> [mailto:public-swbp-wg-request@w3.org]On Behalf Of Miles, AJ 
> (Alistair)
> Sent: 27 January 2006 04:49
> To: public-swbp-wg@w3.org
> Subject: [VM] new cookbook editor's draft 2006-01-18 v 1.6
> 
> 
> 
> 
> Hi all,
> 
> New editor's draft of the 'cookbook':
> 
>     
> http://www.w3.org/2001/sw/BestPractices/VM/http-examples/2006-01-18/
>     --- $Id: Overview.html,v 1.6 2006/01/27 04:23:11 ajm65 Exp $ ---
> 
> I now pass editorial control to Tom B.
> 
> Some notes:
> 
> Title is now 'Best Practice Recipes for Publishing RDFS and 
> OWL Vocabularies/Ontologies'. I argued for having the words 
> 'OWL' and 'ontologies' in the title somehow, to acknowledge 
> the community and improve search hits using those words. I 
> was, however, tempted by the tantalisingly snappy 'Best 
> Practice Recipes for Publishing RDF'.
> 
> Ralph argued for RDF as default response where content 
> negotiation is configured, because of dependency of current 
> Semantic Web applications. We found a way around the problem 
> in IE6 that allows URIs to be clickable even with RDF as the 
> default. Ralph argued for this 'workaround' to go into an 
> appendix. I tried doing this, but made a decision to 
> incorporate it into the recipes, because that way the vast 
> majority of people will be able to just copy and paste from 
> one location to another. It didn't make sense to recommend 
> RDF as the default, and then direct everyone who wanted IE6 
> clickability (i.e. almost everyone) to an appendix that says 
> how each recipe needs to be modified. See the new section 
> 'content negotiation' for an explanation.
> 
> PURL recipes are now all in an appendix.
> 
> I implemented and tested all the new configurations, using 
> the tests given in the document. Test log at:
> 
> http://www.w3.org/2001/sw/BestPractices/VM/http-examples/2006-
> 01-18/testlog20060127.txt
> 
> This tests the basic functionality of the recipes, but 
> doesn't test if the IE6 'hack' works. To test this, all the 
> following URIs should take you to HTML content when clicked 
> on in IE6 (it worked for me):
> 
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example3
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example3#ClassA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example3#ClassB
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example3#propA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example3#propB
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/ClassA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/ClassB
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/propA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/propB
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/ClassA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/ClassB
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/propA
> http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/propB
> http://purl.org/net/swbp-vm/example8
> http://purl.org/net/swbp-vm/example8#ClassA
> http://purl.org/net/swbp-vm/example8#ClassB
> http://purl.org/net/swbp-vm/example8#propA
> http://purl.org/net/swbp-vm/example8#propB
> http://purl.org/net/swbp-vm/ex9/
> http://purl.org/net/swbp-vm/ex9/ClassA
> http://purl.org/net/swbp-vm/ex9/ClassB
> http://purl.org/net/swbp-vm/ex9/propA
> http://purl.org/net/swbp-vm/ex9/propB
> http://purl.org/net/swbp-vm/ex10/
> http://purl.org/net/swbp-vm/ex10/ClassA
> http://purl.org/net/swbp-vm/ex10/ClassB
> http://purl.org/net/swbp-vm/ex10/propA
> http://purl.org/net/swbp-vm/ex10/propB
> 
> Cheers,
> 
> Al.
> 
> 

Received on Monday, 30 January 2006 12:31:00 UTC