Open main menu

Wikibooks β

XQuery/Southampton Pubs

< XQuery

Pubs of SouthamptonEdit

Data on Pubs in Southampton has collected by a couple of enthusiasts. John Goodwin created an RDF representation of this data and an interface to the data.

Conversion to KMLEdit

The RDF is straightforward to convert to KML. The RDF uses a number of namespaces, not all of which are used in this extract.

March 2009: This script was discovered to be broken. The base RDF file has been changed to add a new namespace for addresses [1] in place of the local pub namespace. Since there is of course no notification of such changes, the user of published RDF data sets is not in a much better position than the web scraper, unless the application is written to first check that the vocabulary assumed by the application is still used. However there is no mechanism for expressing the mixture of bits of vocabs used in a RDF dataset. If there were, at least the interfaces could be checked by having a similar definition of the parts actually used in this application to compare.

5 March 2008

Sadly John has been forced to take down this data set due to adverse reaction to one of the pub reviews.

declare namespace rdf= "";
declare namespace rdfs= "";
declare namespace pub= "";
declare namespace geo ="";
declare namespace con ="";

declare option exist:serialize "method=xhtml media-type=application/ highlight-matches=none"; 

let $x := response:set-header('Content-disposition','Content-disposition: inline;filename=sotonpubs.kml;')
let $pubs := doc("")/rdf:RDF
 {for $pub in $pubs/rdf:Description
  let $description :=
             <div style="color:gray">{concat($pub/con:address//con:street," ", $pub/con:address//con:postalCode)}</div>
             <div style="color:blue">{string($pub/pub:description)}</div>
             <div style="font-size:10pt">{$pub/pub:dateSurveyed}</div>
       <name>{string($pub/rdfs:label) } </name>
       <description>{  util:serialize($description,"method=xhtml")}</description>

On GoogleMap