Skip to content

documentation on the products of Statistik Stadt Zürich

Notifications You must be signed in to change notification settings

KlemensRosin/documentation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linked Open Statistical Data

This documentation covers using the linked open statistical data service provided by the Statistics Office of the City of Zurich.

Getting started

You can first start with the information in this document. As further documentation we provide a Jupyternotebook . You can use it to exercise to work with our data if you're new to SPARQL.

For using the Jupyter notebook correctly refer to the section about the installation of Jupyter in this context.

You can run your SPARQL query in https://ld.stadt-zuerich.ch/sparql/ and directly see the result as a table or chart. See the official SPARQL Query Language documentation for how to write your own query or modifify an existing one.

An online version of the Jupyter notebooks is available on binder. Currently the code blocks can't be executed, unfortunately.

list of available datasets

Use the following query to get a list of all datasets with their respective lables.

PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT  ?dataset (COUNT(*) AS ?count) ?label WHERE { GRAPH <https://linked.opendata.swiss/graph/zh/statistics> {

   #?obs a qb:Observation ;
   ?obs <http://purl.org/linked-data/cube#dataSet> ?dataset .

   ?dataset rdfs:label ?label .

}} GROUP BY ?dataset ?label

list of all measures

Use the following query to geta list of all available measures. Clicking on each measure will give you additional information like unit and description.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX qb: <http://purl.org/linked-data/cube#>
SELECT * WHERE {
  ?Kennzahl a qb:MeasureProperty ;
       rdfs:label ?KennzahlLabel .
} 
ORDER BY ?KennzahlLabel

Github

The relevant repositories are:

Api Reference

An API reference will be provided later on.

Install Jupyter to use our Jupyter notebook fully

The Jupyter notebook we provide will allow you to directly query the end-point from the notebook. For that reason the sparqlkernel and some extensions need to be installed. First you have to install python. When you have done that, then youse the following commands to install the necessary items:

python -m pip install --upgrade pip setuptools wheel
pip install jupyter
pip install sparqlkernel
jupyter sparqlkernel install
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter notebook

Then you download the notebook to your machine and start juptyter. When you have done that you may activate some extensions like "toc2"

Important notice: The Sparql kernel has some quirks within. This means you have to use the Lindas endpoint directly and not the one provided in the middleware for the time being. We work on this. Then it is especially useful to set the GRAPH as we have done in all examples in the jupyter notebook.

Licensing

This documentation is licensed under CC BY 4.0 (Statistik Stadt Zürich).

About

documentation on the products of Statistik Stadt Zürich

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published