This repository publishes Berlin’s official budgetary data as RDF / Linked Open Data.
The data are prepared from the budget datasets provided by the Senate Department for Finance (Senatsverwaltung für Finanzen). This repository takes the prepared RDF data and generates a browsable Linked Open Data website.
Currently, the dataset contains budgetary data for the years 2022–2027.
The original budget data are published by the Senate Department for Finance (Senatsverwaltung für Finanzen) via the Berlin Open Data Portal. Search for "Doppelhaushalt" to find the relevant datasets.
The source data are prepared using the separate budget2lod repository.
budget2lod processes the source data and generates several RDF datasets in Turtle (TTL) format. These files contain, among other things, the budget titles, chapters, groups, functions and observations.
Before generating the website, the individual TTL files need to be combined into one RDF dataset. The observationset-be.ttl file is excluded from this step, while the haushalt-cube-be.ttl file is added to the combined graph.
The basic workflow is:
Berlin Open Data Portal
↓
budget2lod
↓
RDF / TTL
↓
lod-budget
↓
Static Linked Open Data website
The individual TTL files generated by budget2lod can be combined using rdflib.
The following is a simplified example of the required approach:
from rdflib import Graph
import glob
graph = Graph()
for ttl_file in glob.glob("path/to/budget2lod/output/*.ttl"):
if ttl_file.endswith("observationset-be.ttl"):
continue
graph.parse(ttl_file, format="turtle")
graph.parse(
"path/to/budget2lod/data/haushalt-cube-be.ttl",
format="turtle"
)
graph.serialize(
destination="data/haushalt-be.ttl",
format="turtle"
)The resulting haushalt-be.ttl file is used as the input dataset for this repository.
The complete TTL dataset is relatively large. Consequently, generating the complete static website can take some time, especially when working with the full dataset.
To generate the static site locally, you need Python 3 and the dependencies listed in requirements.txt.
Create a Python virtual environment:
python3 -m venv .venvActivate the virtual environment:
source .venv/bin/activateInstall the dependencies:
pip install -r requirements.txtCreate the combined N-Triples dataset:
make data/temp/all.ntGenerate the static website:
make generateTo generate the website and start a local web server in one step:
make generate+serve_locallyThe website is then available at:
http://localhost:8000
The static website is generated and deployed automatically using GitHub Actions when changes are pushed to the main branch.
The published website is available at:
https://berlin.github.io/lod-budget/
All code in this repository is published under the MIT License. All data are published under CC0.