XQuery/Southampton Pubs

Pubs of Southampton edit

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 KML edit

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= "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
declare namespace rdfs= "http://www.w3.org/2000/01/rdf-schema#";
declare namespace pub= "http://www.johngoodwin.me.uk/pubs/";
declare namespace geo ="http://www.w3.org/2003/01/geo/wgs84_pos#";
declare namespace con ="http://www.w3.org/2000/10/swap/pim/contact#";

declare option exist:serialize "method=xhtml media-type=application/vnd.google-earth.kml+xml highlight-matches=none"; 

let $x := response:set-header('Content-disposition','Content-disposition: inline;filename=sotonpubs.kml;')
let $pubs := doc("http://www.johngoodwin.me.uk/pubs/models/pubs.rdf")/rdf:RDF
return
<Folder>
 {for $pub in $pubs/rdf:Description
  let $description :=
     <div>
             <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>
             <hr/>
             <div style="font-size:10pt">{$pub/pub:dateSurveyed}</div>
     </div>
  return 
    <Placemark>
       <name>{string($pub/rdfs:label) } </name>
       <description>{  util:serialize($description,"method=xhtml")}</description>
       <Point>
          <coordinates>{concat($pub/geo:long,",",$pub/geo:lat,",0")}</coordinates>
       </Point>
   </Placemark>
 }
</Folder>

On GoogleMap