Using SPARQL With Education Data

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

Sample Queries

  • Select the names of schools in the administrative district of the City of Bristol
    PREFIX sch-ont: <http://education.data.gov.uk/def/school/>
    SELECT ?name WHERE {
    	?school a sch-ont:School;
    	sch-ont:establishmentName ?name;
    	sch-ont:districtAdministrative	<http://statistics.data.gov.uk/id/local-authority-district/00HB>;
    }
    ORDER BY ?name
    LIMIT 10
    Insert
  • Which schools in the City of Bristol have a nursery?
    PREFIX sch-ont: <http://education.data.gov.uk/def/school/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    
    SELECT ?name WHERE {
    	?school a sch-ont:School;
    	sch-ont:establishmentName ?name;
    	sch-ont:districtAdministrative <http://statistics.data.gov.uk/id/local-authority-district/00HB>;
    	sch-ont:nurseryProvision "true"^^xsd:boolean
    }
    ORDER BY ?name
    LIMIT 10
    Insert
  • Select the names and addresses of schools in the administrative district of the City of Bristol
    PREFIX sch-ont: <http://education.data.gov.uk/def/school/>
    SELECT ?name ?address1 ?address2 ?postcode ?town WHERE {
    	?school a sch-ont:School;
    	sch-ont:establishmentName ?name;
    	sch-ont:districtAdministrative <http://statistics.data.gov.uk/id/local-authority-district/00AA>.
    	OPTIONAL {
    		?school sch-ont:address ?address.
    		?address sch-ont:address1 ?address1;
    		sch-ont:address2 ?address2;
    		sch-ont:postcode ?postcode;
    		sch-ont:town ?town.
    	}
    }
    ORDER BY ?name
    LIMIT 10
    Insert
  • List all the secondary schools for boys in the administrative district of Birmingham
    PREFIX sch-ont: <http://education.data.gov.uk/def/school/>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT ?name  WHERE {
           ?school a sch-ont:School;
           sch-ont:establishmentName ?name;
           sch-ont:phaseOfEducation ?phaseOfEducation;
           sch-ont:gender ?gender;
           sch-ont:districtAdministrative ?da.
           ?phaseOfEducation rdfs:label "Secondary".
           ?da rdfs:label "Birmingham".
           ?gender rdfs:label "Boys".
    }
    ORDER BY ?name
    LIMIT 10
    Insert
  • Select establishmentName and Pupil:Teacher ratio for all the educational establishments in the administrative district of Birmingham
    PREFIX sch-ont: <http://education.data.gov.uk/def/school/>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT ?name ?ptr WHERE {
           ?school a sch-ont:School;
           sch-ont:establishmentName ?name;        
           sch-ont:pupilTeacherRatio ?ptr;
           sch-ont:districtAdministrative ?da.        
           ?da rdfs:label "Birmingham".
            }
    ORDER BY ?name
    LIMIT 10
    Insert