This is a writeup of possible configurations for HTTP servers (using Apache 2.0.46 as the example), to support the use of HTTP URIs for identifying classes, properties and individuals in RDFS/OWL ontologies.
$Id: index.html,v 1.10 2005/11/01 16:08:38 ajm65 Exp $
@@TODO get these checked by HTTP and Apache experts
For each HTTP URI denoting an RDFS/OWL class, property or individual ...
These requirements are an extension of the minimum requirements.
For each HTTP URI denoting an RDFS/OWL class, property or individual ...
These examples assume you don't have access to the main apache configuration files, so all examples here use directives placed inside .htaccess files. All examples have been tested for Apache 2.0.46.
The use of both 'hash' and 'slash' HTTP URIs to denote RDFS/OWL classes, properties or individuals is potentially consistentent with the TAG resolution on httpRange-14 [@@TODO ref]. However, the practicalities of configuring an HTTP server to meet the minimum and good-practice requirements differ for hash and slash namespaces, therefore these are treated under different headings below.
'Hash URIs' are e.g.:
http://www.example.com/foo#bar http://www.example.com/foo/bar#baz
N.B. the fragment identifier (i.e. the bit after the '#') is not passed to the server in an HTTP request, this is mandated by the HTTP 1.1 specification (@@TODO ref).
For ontology ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example1
... defining classes ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example1#classA http://isegserv.itd.rl.ac.uk/VM/http-examples/example1#classB
... and properties ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example1#propA http://isegserv.itd.rl.ac.uk/VM/http-examples/example1#propB
...
/documentroot/VM/http-examples/ on the server./documentroot/VM/http-examples/ directory ...# Directive to ensure *.rdf files served as appropriate content type, # if not present in main apache config ... AddType application/rdf+xml .rdf # Rewrite engine setup ... RewriteEngine On RewriteBase /VM/http-examples # Rewrite rule to make sure we serve the RDF/XML content from the namespace URI ... RewriteRule ^example1$ example1.rdf
This setup ensures all HTTP GET requests return an RDF/XML serialisation, thereby meeting minimum requirements.
For ontology ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example2
... defining classes ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example2#classA http://isegserv.itd.rl.ac.uk/VM/http-examples/example2#classB
... and properties ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example2#propA http://isegserv.itd.rl.ac.uk/VM/http-examples/example2#propB
...
/documentroot/VM/http-examples/example2/rdf/ on the
server./documentroot/VM/http-examples/example2/html/ on the
server./documentroot/VM/http-examples/ directory ...# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config ...
AddType application/rdf+xml .rdf
# Rewrite engine setup ...
RewriteEngine On
RewriteBase /VM/http-examples
# Rewrite rule to make sure we serve HTML content from the namespace 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
RewriteRule ^example2$ example2/html/2005-10-31 [R=303]
# Rewrite rule to make sure we serve the RDF/XML content from the namespace URI by default ...
RewriteRule ^example2$ example2/rdf/2005-10-31 [R=303]
/documentroot/VM/http-examples/example2/html/
and /documentroot/VM/http-examples/example2/rdf/ .This setup means all URIs are 'clickable'. I.e. clicking on a link with a class or prop URI as the target takes you (via a redirect) to the most appropriate bit of documentation, which is part of a larger document. This is ideal for small to medium size vocabs.
This setup also means clients asking for 'application/rdf+xml' end up at a snapshot, and can use provenance to differentiate between conflicting descriptions as the ontology evolves.
N.B. because the frag id never gets to the server, we can't serve smaller chunks of html or rdf.
'Slash URIs' are e.g.:
http://www.example.com/foo/bar http://www.example.com/foo/bar/baz
For ontology ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example3/
... defining classes ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example3/classA http://isegserv.itd.rl.ac.uk/VM/http-examples/example3/classB
... and properties ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example3/propA http://isegserv.itd.rl.ac.uk/VM/http-examples/example3/propB
...
/documentroot/VM/http-examples/example3/ on the server./documentroot/VM/http-examples/example3/ directory ...# Directives to override inherited behaviour Options -MultiViews -Indexes # Directive to ensure *.rdf files served as appropriate content type, # if not present in main apache config ... AddType application/rdf+xml .rdf # Rewrite engine setup ... RewriteEngine on RewriteBase /VM/http-examples/example3/ # Rewrite rule to make sure we directly serve the RDF/XML content for the namespace URI ... RewriteRule ^$ index.rdf [L] # Rewrite rule to make sure we finish here after internal redirect from the above rule ... RewriteRule ^index.rdf$ - [L] # Rewrite rule to make sure we redirect for any other URI ... RewriteRule ^(.+)$ "/VM/http-examples/example3/" [R=303]
The second rule is required to catch the internal redirect from the first rule, and prevent us ending in an eternal redirect loop.
This setup means that a request for the ontology URI always returns RDF/XML content, and a request for a class or prop URI always results in a redirect, thereby satisfying minimum requirements.
For ontology ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/
... defining classes ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/classA http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/classB
... and properties ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/propA http://isegserv.itd.rl.ac.uk/VM/http-examples/example4/propB
...
/documentroot/VM/http-examples/example4-rdf/ on the
server./documentroot/VM/http-examples/example4-html/ on the
server./documentroot/VM/http-examples/ directory ...# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config ...
AddType application/rdf+xml .rdf
# Rewrite engine setup ...
RewriteEngine On
RewriteBase /VM/http-examples
# Rewrite rule to make sure we serve HTML content from the namespace 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
RewriteRule ^example4/(.*)$ example4-html/2005-10-31#$1 [R=303,NE]
# Rewrite rule to make sure we serve the RDF/XML content from the namespace URI by default ...
RewriteRule ^example4/.*$ example4-rdf/2005-10-31 [R=303]
# N.B. for the above to work, the 'example4/' directory must not actually exist in the file system.
example4-rdf/ and example4-html/ .N.B. the 'NE' flag must be added to the first rewrite rule, to prevent escaping of the '#' character after rewriting.
Because this allows all HTML documentation to be packaged into a single file with anchors, this setup is ideal for small to medium sized vocabs.
For ontology ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/
... defining classes ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/classA http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/classB
... and properties ...
http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/propA http://isegserv.itd.rl.ac.uk/VM/http-examples/example5/propB
...
/documentroot/VM/http-examples/example5-rdf/ on the
server./documentroot/VM/http-examples/example5-html/2005-10-31/ on
the server./documentroot/VM/http-examples/ directory ...# Directive to ensure *.rdf files served as appropriate content type,
# if not present in main apache config ...
AddType application/rdf+xml .rdf
# Rewrite engine setup ...
RewriteEngine On
RewriteBase /VM/http-examples
# Rewrite rule to make sure we serve HTML content from the namespace 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
RewriteRule ^example5/(.*)$ example5-html/2005-10-31/$1 [R=303]
# Rewrite rule to make sure we serve the RDF/XML content from the namespace URI by default ...
RewriteRule ^example5/.*$ example5-rdf/2005-10-31 [R=303]
# N.B. for the above to work, the 'example5/' directory must not actually exist in the file system.
example5-rdf/ and example5-html/2005-10-31/
.This setup is better for documenting large vocabs, as it allows documentation to be partitioned into separate files.
@@TODO conditionally rewrite URLs to go to HTML generating service for HTML requests, and to SPARQL service with DESCRIBE or CONSTRUCT queries for RDF requests ...