- From: Norman Gray <norman@astro.gla.ac.uk>
- Date: Mon, 24 Sep 2012 09:40:17 +0100
- To: Sebastian Hellmann <hellmann@informatik.uni-leipzig.de>
- Cc: public-lod <public-lod@w3.org>, Kjetil Kjernsmo <kjetil@kjernsmo.net>
- Message-Id: <BF4789E1-599D-428C-93F4-47DFE2E84ECB@astro.gla.ac.uk>
Sebastian, hello. (...and pruning semantic-web from the cc list) On 24 Sep 2012, at 02:25, Kjetil Kjernsmo <kjetil@kjernsmo.net> wrote: >> Here are my questions: >> 1. Is this feasible or best practice? I am not sure, how many files can >> be handled, efficiently by Apache. > > I'm pretty sure the number of files wouldn't be a problem. Apache would > basically just serve the files in the file system. Indeed, it would be very > cheap to do it this way, and you would get the benefit of correct etags and > last-modified headers right out of the box. However, you would probably need > to handle 303 redirects with mod_rewrite. mod_rewrite is a piece of black > magic I prefer to stay away from. Without wishing to disagree with Kjetil's overall point (which I intend to study closely), I wouldn't rule out mod_rewrite, if you still find a static-files-plus-apache solution to be attractive. For me, mod_rewrite is legerdemain rather than black magic: it needs practice, but it's unlikely to imperil your immortal soul. I've included below a template .htaccess file which I've used to (statically) publish a set of SKOS vocabularies (see <http://www.ivoa.net/rdf/Vocabularies/AAkeys>). This maps <.../foo> to <.../release-n.m/foo/foo.html> or .rdf or .ttl as appropriate. The vocabularies in this case are single files rather than collections of lots of files, but this should give you the pattern. Incidentally, I'm also attaching the check-uris.sh.in script which is configured at the same time as this .htaccess file, and which checks that all of the files are being served as they should be. The .htaccess file has a nasty syntax, and it's hard to debug, so having a mechanical check like this can be very reassuring, especially after software changes, for example. Best wishes, Norman ## Template Apache .htaccess file for serving vocabularies. ## This file is configured at make time, with the following ## substitutions: ## ## @BASE@ should be the path component of the base URI of the ## vocabulary distribution, that is, without the protocol and ## authority components. ## ## @SUBDIR@ is a versioned subdirectory, where the public URIs ## redirect to. This is not an advertised directory, but it needs ## to be generally accessible. ## ## @FILEOPTS@ is a list of the supported vocabulary names, ## separated by vertical bars. For example 'AOIM|AAkeys'. This ## lists the vocabularies which this file will actually serve. ## ## This file is patterned after Recipe 3 in the W3C document 'Best ## Practice Recipes for Publishing RDF Vocabularies', at ## <http://www.w3.org/TR/swbp-vocab-pub/> # Apache .htaccess file AddType application/rdf+xml .rdf # The MIME type for .n3 should be text/rdf+n3, not application/n3: # see MIME notes at <http://www.w3.org/2000/10/swap/doc/changes.html> # # The MIME type for Turtle is text/turtle, though this has not # completed its registration: see # <http://www.w3.org/TeamSubmission/turtle/#sec-mediaReg> AddType text/rdf+n3 .n3 AddType text/turtle .ttl # For Charset types, see <http://www.iana.org/assignments/character-sets> AddCharset UTF-8 .n3 AddCharset UTF-8 .ttl AddCharset UTF-8 .html RewriteEngine On # This base must match the directory where this file is located. RewriteBase @BASE@ RewriteCond %{HTTP_ACCEPT} application/rdf\+xml RewriteRule ^(@FILEOPTS@)$ @SUBDIR@/$1/$1.rdf [R=303] RewriteCond %{HTTP_ACCEPT} text/rdf\+n3 [OR] RewriteCond %{HTTP_ACCEPT} application/n3 [OR] RewriteCond %{HTTP_ACCEPT} text/turtle RewriteRule ^(@FILEOPTS@)$ @SUBDIR@/$1/$1.ttl [R=303] # No accept conditions: make the .html version the default RewriteRule ^(@FILEOPTS@)$ @SUBDIR@/$1/$1.html [R=303] -- Norman Gray : http://nxg.me.uk SUPA School of Physics and Astronomy, University of Glasgow, UK
Attachments
- application/octet-stream attachment: check-uris.sh.in
- application/pkcs7-signature attachment: smime.p7s
Received on Monday, 24 September 2012 08:40:54 UTC