Cooking HTTP
content negotiation
with Vapour




Diego Berrueta, Sergio Fernández and Iván Frade (Fundación CTIC)

ESWC2008 workshop on Scripting for the Semantic Web (SFSW2008)

June 2nd 2008

Motivation

Content negotiation

Content negotiation in Apache

Apache HTTP Server provides three different approaches to implement content negotiation:

  1. Type Map
  2. MultiViews
  3. Rewrite request

Content negotiation in the Semantic Web

Common used for the Semantic Web purposes:

content negotiation

Content negotiation for vocabularies

Recipes

Recipes (II)

Recipes: example recipe 3

# Rewrite rule to serve HTML content if requested
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml)
RewriteCond %{HTTP_ACCEPT} text/html [OR]
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*
RewriteRule ^example3$ example3.html [R=303]

# Rewrite rule to serve RDF/XML content if requested
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml
RewriteRule ^example3$ example3.rdf [R=303]

# Rewrite rule to serve the RDF/XML content by default 
RewriteRule ^example3$ example3.rdf [R=303]

Vapour

Vapour: architecture

architecture of vapour

Vapour: architecture (II)

cup
provides the web interface
teapot
is the core of the application that launches HTTP dialogs to evaluate the responses and stores the results into the RDF store
strainer
generates the reports, both in XHTML and RDF/XML

Vapour RDF model

Vapour RDF model: example (I)

An example of a test over SIOC ontology's namespace:

#req12 a earl:TestRequirement ;
  dct:hasPart a earl:Assertion ;
    earl:mode http://www.w3.org/WAI/ER/EARL/nmg-strawman#automatic ;
    earl:assertedBy #vapour ;
    earl:test #TestResponseCode200 ;
    earl:subject :rFmCDRcX137 .

:rFmCDRcX137 a earl:TestSubject ;
  dc:title "1st request while dereferencing vocabulary URI" ;
  dc:date "2008-05-27T20:36:21.318143" ;
  earl:httpRequest a http:GetRequest ;
    http:accept application/rdf+xml ;
    uri:uri http://rdfs.org/sioc/ns# .
  earl:httpResponse a http:Response ;
    http:responseCode "200" ;
    http:content-type "application/rdf+xml" .

Vapour RDF model: example (II)

Another example of a test over foaf:Person class:

:FmCDRcX51 a earl:TestSubject ;
  dc:title "1st request while dereferencing class URI" ;
  dc:date "2008-05-27T20:38:34.433181" ;
  earl:httpRequest a http:GetRequest ;
    http:accept application/rdf+xml ;
    uri:uri http://xmlns.com/foaf/0.1/Person .
  earl:httpResponse a http:Response ;
    http:responseCode "303" ;
    http:location http://xmlns.com/foaf/spec/ ;
  vapour:nextSubject :FmCDRcX52 .

:FmCDRcX52 a earl:TestSubject ;
  dc:title "2nd request while dereferencing vocabulary URI" ;
  dc:date "2008-05-27T20:36:24.318251" ;
  vapour:previousSubject :FmCDRcX51;
  earl:httpRequest a http:GetRequest ;
    http:accept application/rdf+xml ;
    uri:uri http://xmlns.com/foaf/spec/ .
  earl:httpResponse a http:Response ;
    http:responseCode "200" ;
    http:content-type "application/rdf+xml" .

Experimental results

Vapour against a list of ten popular vocabularies (retrieved on 12/Mar/2008):

Namespace Acccept RDF/XML Accept HTML Default response
http://www.w3.org/1999/02/22-rdf-syntax-ns# 3/3 N/A RDF/XML
http://www.w3.org/2000/01/rdf-schema# 3/3 N/A RDF/XML
http://xmlns.com/foaf/0.1/ 3/3 3/3 RDF/XML
http://purl.org/dc/elements/1.1/ 2/2 0/2 RDF/XML
http://www.w3.org/2003/01/geo/wgs84_pos# 3/3 0/3 RDF/XML
http://rdfs.org/sioc/ns# 3/3 0/3 RDF/XML
http://www.w3.org/2004/02/skos/core# 3/3 3/3 RDF/XML
http://usefulinc.com/ns/doap# 3/3 0/3 RDF/XML
http://purl.org/rss/1.0/ 1/3 0/3 HTML
http://semantic-mediawiki.org/swivt/1.0# 0/3 0/3 text/plain

Conclusions and future work

Thank you

Thank you!

Diego Berrueta <diego.berrueta@fundacionctic.org>

Sergio Fernández <sergio.fernandez@fundacionctic.org>

Iván Frade <ivan.frade@gmail.com>

http://vapour.sourceforge.net/