Example SPARQL queries

Try executing the queries using our SPARQL endpoint.

Choose the "HTML Table" output format to preview the results in your web browser. Also note that no more than 500 results will be listed.

Hospitals of the 18. district of Vienna

PREFIX schema: <http://schema.org/>.
PREFIX dc: <http://purl.org/dc/terms/>.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
SELECT ?s ?t WHERE {
  ?s schema:district "18".
  ?s rdf:type schema:Hospital.
  ?s dc:title ?t.
}

All hospitals combined

This query shows all imported hospitals in a combined view, i.e. it shows all hospitals although they stem from different data sources.

PREFIX schema: <http://schema.org/>.
PREFIX dc: <http://purl.org/dc/terms/>.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
PREFIX foaf: <http://xmlns.com/foaf/0.1/> .
SELECT ?s ?title ?l WHERE {
  ?s rdf:type schema:Hospital.
  ?s dc:title ?title.
  ?s foaf:source ?source.
  ?source rdfs:label ?l.
}

Places in the first district

PREFIX schema: <http://schema.org/>.
PREFIX dc: <http://purl.org/dc/terms/>.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
SELECT DISTINCT ?s ?title WHERE {
  ?s schema:district "1".
  ?s rdf:type schema:Place.
  ?s dc:title ?title.
}

Bathing areas from Vienna's data source

Lists all bathing areas from Vienna's data source.

PREFIX schema: <http://schema.org/>.
PREFIX dc: <http://purl.org/dc/terms/>.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
PREFIX foaf: <http://xmlns.com/foaf/0.1/> .
SELECT ?s ?title ?district WHERE {
  ?s dc:title ?title.
  ?s schema:district ?district.
  ?s foaf:source "http://austria.drupaldata.com/taxonomy_term/21".
}

Data of Vienna

Lists all data steming from the city of Vienna.

PREFIX schema: <http://schema.org/>.
PREFIX dc: <http://purl.org/dc/terms/>.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
PREFIX foaf: <http://xmlns.com/foaf/0.1/> .
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
SELECT ?s ?title ?source ?source_label WHERE {
  ?s dc:title ?title.
  ?s foaf:source ?source.
  ?source rdfs:label ?source_label.
  ?source foaf:city "http://austria.drupaldata.com/taxonomy_term/1".
}

Count the number of RDF triples

SELECT COUNT(?s) as ?count WHERE {
  ?s ?p ?o . 
}