[Fwd: [Linking-open-data] Redirect Recipe]

Hi all,

Find below a post by Joshua Tauberer to the Linking Open Data mailing
list. I think we should consider  his finding to be included in future
revisions of the Recipes document. It clearly fits into the second
pattern of recipe 6 [1].

Best regards,

[1] http://www.w3.org/2006/07/SWD/recipes/draft-20071203#pattern2

-------- Forwarded message --------
Asunto: 	[Linking-open-data] Redirect Recipe
Fecha: 	Sun, 20 Jan 2008 12:49:19 -0500
De: 	Joshua Tauberer <jt@occams.info>
Responder a: 	Linking Open Data <linking-open-data@simile.mit.edu>
Para: 	Linking Open Data <linking-open-data@simile.mit.edu>



Hi all,

To make my data linked data, I employ automatically generated redirects 
from a virtual space of URIs to SPARQL DESCRIBE queries through GET. For 
instance:

   http://www.rdfabout.com/rdf/usgov/geo/us
   ...redirects to...
   http://www.rdfabout.com/sparql?
      query=DESCRIBE+%3Chttp://www.rdfabout.com/rdf/usgov/geo/us%3E

This was accomplished with (sorry for broken line) this in an Apache 
.htaccess file:

RedirectMatch 303 (/rdf/.*) http://rdfabout.com/sparql?
                   query=DESCRIBE+%3Chttp://www.rdfabout.com$1%3E

It maps only URLs within the 'http://(host)/rdf/' path space.

I ran into a problem when I created some URIs with %20's in them, 
because the redirect would need to double-escape the %20's when they are 
put into the query string.

After some chin-scratching I found out that mod_rewrite could be used to 
do a proper redirect, and I've documented it here:

   http://rdfabout.com/demo/census/htaccess.txt

There's more explanation in the link, but the short story is putting 
into the main httpd.conf:

   RewriteMap esc int:escape

and then into .htaccess:

   RewriteEngine on
   RewriteBase "/"
   RewriteRule ^(rdf/.*) http://%{HTTP_HOST}/sparql?   (..all one line..)
               query=DESCRIBE+<http://%{HTTP_HOST}/${esc:$1}> [R]

Thought others may find that useful.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
_______________________________________________
Linking-open-data mailing list
Linking-open-data@simile.mit.edu
http://simile.mit.edu/mailman/listinfo/linking-open-data


-- 
Diego Berrueta
R&D Department  -  CTIC Foundation
E-mail: diego.berrueta@fundacionctic.org
Phone: +34 984 29 12 12
Parque Cientifico Tecnologico Gijon-Asturias-Spain
http://www.fundacionctic.org

Received on Sunday, 20 January 2008 19:27:38 UTC