RE: [VM] content-dependent redirects in apache ... help!

So just writing this up for the benefit of all ...

Requirements for URI dereferencing of RDF(S) classes and props: 

(1) If a person tries to dereference the URI of a class or property (i.e. via a web browser), they end up at the relevant bit of human-readable documentation.

(2) If a machine tries to dereference the URI of a class or property, they end up with a serialisation of a set of RDF statements describing that class or property, with a provenance that allows differentiation of different 'versions' of an RDF schema/ontology.

(3) The whole thing complies with TAG resolution on httpRange-14.

E.g. Implementation with Apache 1.3 (probably works for 2.0 too although I haven't checked)for 'hash' namespace http://www.w3.org/2004/02/skos/core:

In directory corresponding to URL /2004/02/skos/ there is a type-map file (e.g. 'core.var') containing the following...
---
URI: core

URI: core-latest-rdf
Content-type: application/rdf+xml

URI: core-latest-html
Content-type: text/html

URI: core-latest-html
Content-type: text/xml

URI: core-latest-html
Content-type: application/xml

URI: core-latest-html
Content-type: application/xhtml+xml
---

... and in directory corresponding to URL /2004/02/skos/ there is a .htaccess file containing the following...
---
Options -MultiViews
RewriteEngine On
RewriteRule ^core$ core.var
RewriteRule ^core-latest-rdf$ /2004/02/skos/core/history/2005-03-31 [R=303]
RewriteRule ^core-latest-html$ /TR/2005/WD-swbp-skos-core-spec-20050510 [R=303]
---

N.B. this is not actually implemented for http://www.w3.org/2004/02/skos/core although it is proposed to do so.  It is implemented for the dummy resource http://www.w3.org/2004/02/skos/bar to test that it works.

Cheers,

Al.



> -----Original Message-----
> From: public-swbp-wg-request@w3.org
> [mailto:public-swbp-wg-request@w3.org]On Behalf Of Miles, AJ 
> (Alistair)
> Sent: 03 October 2005 17:29
> To: Benjamin Nowack
> Cc: semantic-web@w3.org; public-esw-thes@w3.org; public-swbp-wg@w3.org
> Subject: RE: [VM] content-dependent redirects in apache ... help!
> 
> 
> 
> Hi Benjamin,
> 
> Thanks for this hint, I've got it working now.
> 
> I added a couple of lines to the .htaccess file, so it has:
> ---
> Options -MultiViews
> RewriteRule ^bar$ bar.var
> RewriteRule ^core-latest-rdf$ 
> /2004/02/skos/core/history/2005-03-31 [R=303]
> RewriteRule ^core-latest-html$ 
> /TR/2005/WD-swbp-skos-core-spec-20050510 [R=303]
> ---
> 
> Now http://www.w3.org/2004/02/skos/bar behaves as desired.
> 
> Cheers,
> 
> Al.
> 
> > -----Original Message-----
> > From: Benjamin Nowack [mailto:bnowack@appmosphere.com]
> > Sent: 03 October 2005 16:50
> > To: Miles, AJ (Alistair)
> > Cc: semantic-web@w3.org; public-esw-thes@w3.org; 
> public-swbp-wg@w3.org
> > Subject: Re: [VM] content-dependent redirects in apache ... help!
> > 
> > 
> > 
> > Hi Alistair,
> > 
> > just guessing, but do you have Multiviews enabled?
> > 
> > cheers,
> > benjamin
> > 
> > --
> > Benjamin Nowack
> > 
> > Kruppstr. 100
> > 45145 Essen, Germany
> > http://www.bnode.org/
> > 
> > On 03.10.2005 16:20:16, Miles, AJ \(Alistair\) wrote:
> > >
> > >Hi all,
> > >
> > >A short while ago I posted a proposed URI dereferencing 
> > policy & setup for
> > >SKOS Core [1] as a possible candidate for future best 
> > practice wrt 'hash' RDF
> > >namespaces.  To sum up what it does: basically, if the 
> > client asks for html,
> > >it gets redirect to the latest version of the html 
> > documentation, and if the
> > >client asks for rdf, it gets redirected to the latest 
> > version of the rdf
> > >description.  This was to satisfy two requirements:
> > >
> > >(Requirement 1) property & class URIs are 'clickable' in web 
> > browsers and take
> > >you to human readable stuff.
> > >
> > >(Requirement 2) provenance of any rdf statements about 
> > classes/props is always
> > >a date-stamped version of the 'ontology', allowing 
> > determination of which
> > >'version' is being used by an application at run-time.
> > >
> > >I've tried to implement this setup as a test on the W3C 
> > server, but have run
> > >into a problem and so am posting this in the hope that those 
> > who know apache
> > >better than me can tell me what's going on (i.e. help! :)
> > >
> > >I've got the following setup:
> > >
> > >In the directory /2004/02/skos/ there is a file 'bar.var' 
> > which looks like ...
> > >---
> > >URI: bar
> > >
> > >URI: core-latest-rdf
> > >Content-type: application/rdf+xml
> > >
> > >URI: core-latest-html
> > >Content-type: text/html
> > >
> > >URI: core-latest-html
> > >Content-type: text/xml
> > >
> > >URI: core-latest-html
> > >Content-type: application/xml
> > >
> > >URI: core-latest-html
> > >Content-type: application/xhtml+xml
> > >---
> > >
> > >I added the following lines to .htaccess in /2004/02/skos/ ...
> > >---
> > >RewriteRule ^core-latest-rdf$ 
> > /2004/02/skos/core/history/2005-03-31 [R=303]
> > >RewriteRule ^core-latest-html$ 
> > /TR/2005/WD-swbp-skos-core-spec-20050510 [R=303]
> > >---
> > >
> > >(So the idea was to test if I could make the URI
> > >http://www.w3.org/2004/02/skos/bar behave how we ultimately 
> > want the URI
> > >http://www.w3.org/2004/02/skos/core to behave).
> > >
> > >Now, if I try to GET http://www.w3.org/2004/02/skos/bar.var 
> > everything behaves
> > >as I would like, with a redirect to different resources 
> > dependent on the
> > >'Accept:' header in the original request.
> > >
> > >However, if I try to GET http://www.w3.org/2004/02/skos/bar 
> > I get a 404 not
> > >found.  It's obviously getting to the type-map file, because 
> > of the header
> > >returned by the server (see below, the 'Content-Location:' 
> > field), but for
> > >some reason is not doing the subsequent redirect.
> > >
> > >Here's the HTTP trace, anyone know what's going on? ...
> > >---
> > >http://www.w3.org/2004/02/skos/bar
> > >
> > >GET /2004/02/skos/bar HTTP/1.1
> > >Host: www.w3.org
> > >User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
> > rv:1.7.11)
> > >Gecko/20050728
> > >Accept:
> > >text/xml,application/xml,application/xhtml+xml,text/html;q=0.
> > 9,text/plain;q=0.8
> > >,image/png,*/*;q=0.5
> > >Accept-Language: en-us,en;q=0.5
> > >Accept-Encoding: gzip,deflate
> > >Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > >Keep-Alive: 300
> > >Proxy-Connection: keep-alive
> > >
> > >HTTP/1.x 404 Not Found
> > >Date: Mon, 03 Oct 2005 15:10:16 GMT
> > >Server: Apache/1.3.33 (Unix) PHP/4.3.10
> > >Content-Location: core-latest-html
> > >Vary: negotiate,accept
> > >TCN: choice
> > >P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
> > >Last-Modified: Mon, 05 Sep 2005 07:47:53 GMT
> > >Etag: "431bf829;43414560"
> > >Accept-Ranges: bytes
> > >Content-Length: 2006
> > >Content-Type: text/html; charset=iso-8859-1
> > >X-Cache: MISS from wwwcache.rl.ac.uk
> > >Proxy-Connection: close
> > >----------------------------------------------------------
> > >http://www.w3.org/2004/02/skos/bar
> > >
> > >GET /2004/02/skos/bar HTTP/1.1
> > >Host: www.w3.org
> > >User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
> > rv:1.7.11)
> > >Gecko/20050728
> > >Accept: application/rdf+xml
> > >Accept-Encoding: gzip,deflate
> > >Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > >Keep-Alive: 300
> > >Proxy-Connection: keep-alive
> > >
> > >HTTP/1.x 404 Not Found
> > >Date: Mon, 03 Oct 2005 15:15:13 GMT
> > >Server: Apache/1.3.33 (Unix) PHP/4.3.10
> > >Content-Location: core-latest-rdf
> > >Vary: negotiate,accept
> > >TCN: choice
> > >P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
> > >Last-Modified: Mon, 05 Sep 2005 07:47:53 GMT
> > >Etag: "431bf829;43414560"
> > >Accept-Ranges: bytes
> > >Content-Length: 2006
> > >Content-Type: text/html; charset=iso-8859-1
> > >X-Cache: MISS from wwwcache.rl.ac.uk
> > >Proxy-Connection: close
> > >----------------------------------------------------------
> > >http://www.w3.org/2004/02/skos/bar.var
> > >
> > >GET /2004/02/skos/bar.var HTTP/1.1
> > >Host: www.w3.org
> > >User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
> > rv:1.7.11)
> > >Gecko/20050728
> > >Accept:
> > >text/xml,application/xml,application/xhtml+xml,text/html;q=0.
> > 9,text/plain;q=0.8
> > >,image/png,*/*;q=0.5
> > >Accept-Language: en-us,en;q=0.5
> > >Accept-Encoding: gzip,deflate
> > >Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > >Keep-Alive: 300
> > >Proxy-Connection: keep-alive
> > >
> > >HTTP/1.x 303 See Other
> > >Date: Mon, 03 Oct 2005 15:15:50 GMT
> > >Server: Apache/1.3.33 (Unix) PHP/4.3.10
> > >Content-Location: core-latest-html
> > >Vary: negotiate,accept
> > >TCN: choice
> > >Location: http://www.w3.org/TR/2005/WD-swbp-skos-core-spec-20050510
> > >Content-Type: text/html; charset=iso-8859-1
> > >X-Cache: MISS from wwwcache.rl.ac.uk
> > >Proxy-Connection: close
> > >----------------------------------------------------------
> > >http://www.w3.org/2004/02/skos/bar.var
> > >
> > >GET /2004/02/skos/bar.var HTTP/1.1
> > >Host: www.w3.org
> > >User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; 
> > rv:1.7.11)
> > >Gecko/20050728
> > >Accept: application/rdf+xml
> > >Accept-Encoding: gzip,deflate
> > >Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > >Keep-Alive: 300
> > >Proxy-Connection: keep-alive
> > >
> > >HTTP/1.x 303 See Other
> > >Date: Mon, 03 Oct 2005 15:15:43 GMT
> > >Server: Apache/1.3.33 (Unix) PHP/4.3.10
> > >Content-Location: core-latest-rdf
> > >Vary: negotiate,accept
> > >TCN: choice
> > >Location: http://www.w3.org/2004/02/skos/core/history/2005-03-31
> > >Content-Type: text/html; charset=iso-8859-1
> > >X-Cache: MISS from wwwcache.rl.ac.uk
> > >Proxy-Connection: close
> > >---
> > >
> > >Cheers,
> > >
> > >Al.
> > >
> > >[1] 
> http://lists.w3.org/Archives/Public/public-esw-thes/2005Sep/0008.html
> >
> >---
> >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
> >
> >
> >
> >
> 
> 
> 

Received on Monday, 3 October 2005 16:44:31 UTC