Skip to content

lobid-gnd

bibliofabric.lobidgnd is a Python client for the lobid-gnd API, the linked-data service of the Integrated Authority File (Gemeinsame Normdatei, GND). It covers record search with paging and sorting, single record lookup, autocomplete suggestions, the JSONL bulk format, and the GND reconciliation service. Every call returns typed Pydantic models, and the client ships as an async class plus a generated sync twin.

The API needs no credentials, and the GND data is licensed CC0 1.0.

Quick start

import asyncio

from bibliofabric.lobidgnd import GndFilter, LobidGndClient


async def main() -> None:
    async with LobidGndClient() as client:
        goethe = await client.authorities.get("118540238")
        print(goethe.preferred_name, f"({goethe.date_of_birth[0]})")

        page = await client.authorities.search(
            query="preferredName:Twain",
            filters=GndFilter(entity_type="Person"),
            page_size=3,
        )
        print(page.total)
        for record in page.results:
            print(record.gnd_identifier, record.preferred_name)


asyncio.run(main())
Goethe, Johann Wolfgang von (1749-08-28)
4
121570924 Twain, Shania
118624822 Twain, Mark
1179733045 Twain, K. V.

Sync quick start

LobidGndSyncClient is generated from the async source and offers the same methods without async and await. The page Async and sync clients explains when to use which.

from bibliofabric.lobidgnd import LobidGndSyncClient

with LobidGndSyncClient() as client:
    goethe = client.authorities.get("118540238")
    print(goethe.preferred_name)
Goethe, Johann Wolfgang von

What the client offers

Attribute Routes Common methods Client-specific methods
client.authorities GET /search, GET /{id}.json search, iterate, collect, first, count, batch_get, get; exists raises ConfigurationError suggest, download_jsonl
client.reconcile GET /reconcile, POST /reconcile none manifest, query

Search results and record lookups return GndResource models. The search envelope carries the total and the facets in page.meta["aggregation"]. The shared behavior of search, iterate, collect, first, and count is described in Paging, and the fielded search syntax in Search.

Examples

Runnable scripts live in packages/bibliofabric/examples/lobidgnd/:

  • quickstart.py fetches one record, searches, iterates, suggests, and downloads a small bulk set.
  • reconcile_names.py matches a list of names with the reconciliation service.

Next