Using SPARQL With Gazettes Data

The SPARQL endpoint for Gazettes data is available at http://gov.tso.co.uk/gazettes/sparql.

Sample Queries

  • Select the first 100 notices after a given date.
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX gzt: <http://www.gazettes-online.co.uk/ontology#>
    
    SELECT ?n WHERE
     {
       ?n a gzt:Notice .
       ?n gzt:hasPublicationDate ?d .
       FILTER (?d >= "2010-09-01"^^xsd:date)
     }
     ORDER BY ?d
     LIMIT 100
    
    Insert
  • The RDF description of each notice is stored in a separate named graph, so all of the RDF for the notice can be retrieved with the following query.
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    
    CONSTRUCT { ?s ?p ?o } WHERE
     { 
       GRAPH <http://www.london-gazette.co.uk/id/issues/59588/notices/1232023> {?s ?p ?o }
     }
    Insert