Exhibitions

Sprengel Museum Hannover — Exhibition Catalogue Records

Authors
Affiliations

Simon Worthington

HsH

TIB

Chloë Farr

University of Victoria

Published

June 18, 2026 00:00

Abstract

Catalogue exhibition contents using Linked Open Data and AI LLM assistants.

Keywords

Data Science, GLAM, Open Science

This page queries the project Wikibase instance live to display all uploaded Sprengel Museum exhibition catalogue records.

Note: The Wikibase SPARQL endpoint must be reachable when this page is rendered. If the endpoint returns no results, the pipeline notebooks (01–05) may not have been run yet.

Querying: https://query.wbworkshop.tibwiki.io/sparql
import requests
import pandas as pd

# wdt: and wd: are NOT auto-resolved on local Wikibase — must declare prefixes explicitly
WDT = f"{WB_URL.rstrip('/')}/prop/direct/"
WD  = f"{WB_URL.rstrip('/')}/entity/"

SPARQL = f"""
PREFIX wdt: <{WDT}>
PREFIX wd:  <{WD}>
SELECT ?item ?title ?idn ?year WHERE {{
  ?item wdt:P1 wd:Q4 .
  OPTIONAL {{ ?item wdt:P2 ?title . }}
  OPTIONAL {{ ?item wdt:P7 ?idn . }}
  OPTIONAL {{ ?item wdt:P3 ?year . }}
}}
ORDER BY DESC(?year)
"""

try:
    resp = requests.get(
        SPARQL_ENDPOINT,
        params={"query": SPARQL, "format": "json"},
        headers={"Accept": "application/sparql-results+json"},
        timeout=30,
    )
    resp.raise_for_status()
    bindings = resp.json()["results"]["bindings"]

    rows = []
    for b in bindings:
        qid   = b["item"]["value"].split("/")[-1]
        title = b.get("title", {}).get("value", "—")
        idn   = b.get("idn", {}).get("value", "")
        year  = b.get("year", {}).get("value", "")[:4] if b.get("year") else ""
        rows.append({"QID": qid, "Title": title, "Year": year, "DNB IDN": idn})

    df = pd.DataFrame(rows)
    print(f"Records returned: {len(df)}")

except Exception as e:
    print(f"SPARQL query failed: {e}")
    df = pd.DataFrame(columns=["QID", "Title", "Year", "DNB IDN"])
SPARQL query failed: 503 Server Error: Service Unavailable for url: https://query.wbworkshop.tibwiki.io/sparql?query=%0APREFIX+wdt%3A+%3Chttps%3A%2F%2Fwikibase.wbworkshop.tibwiki.io%2Fprop%2Fdirect%2F%3E%0APREFIX+wd%3A++%3Chttps%3A%2F%2Fwikibase.wbworkshop.tibwiki.io%2Fentity%2F%3E%0ASELECT+%3Fitem+%3Ftitle+%3Fidn+%3Fyear+WHERE+%7B%0A++%3Fitem+wdt%3AP1+wd%3AQ4+.%0A++OPTIONAL+%7B+%3Fitem+wdt%3AP2+%3Ftitle+.+%7D%0A++OPTIONAL+%7B+%3Fitem+wdt%3AP7+%3Fidn+.+%7D%0A++OPTIONAL+%7B+%3Fitem+wdt%3AP3+%3Fyear+.+%7D%0A%7D%0AORDER+BY+DESC%28%3Fyear%29%0A&format=json
from IPython.display import display, HTML

if df.empty:
    print("No records found. Run the pipeline notebooks (01–05) first.")
else:
    def make_link(row):
        wb = f'<a href="{WB_URL}/wiki/Item:{row["QID"]}" target="_blank">{row["QID"]}</a>'
        return pd.Series({"Wikibase": wb, "Title": row["Title"], "Year": row["Year"],
                          "DNB IDN": row["DNB IDN"]})

    display_df = df.apply(make_link, axis=1)
    display(HTML(display_df.to_html(escape=False, index=False)))
No records found. Run the pipeline notebooks (01–05) first.

SPARQL query used

The query above retrieves all items classified as Exhibition Catalogue (instance of P1 = Q4) from the project Wikibase. Properties used: P2 (title), P3 (start date), P7 (DNB IDN). Results are sorted by year descending.

You can run this query directly at the Wikibase SPARQL interface: Open in Wikibase Query Service