sgbr_facet_breakdown
sgbr_facet_breakdownCross-tabulate two dimensions into an exact grid of record counts, auto-discovering top values per axis to compare facets such as language by genre without approximate bucket estimates.
Instructions
Cross-tabulate two dimensions into one exact grid of record counts. E.g. language × genre, or library × availability. Auto-discovers the top values of each dimension, then prices every cell exactly with batched stats calls — not a facet-bucket approximation. Each axis is a top-N grid, not a complete enumeration: only the top size/breakdown_size values appear, and row_axis/col_axis report distinct_values/others_count/truncated so an absent value is not read as absent from the corpus (raise the sizes, or use sgbr_facet_values for the full list of one dimension). year and object_type are not supported as axes; use sgbr_facet_values or sgbr_search filters for those.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"facet": "<facet>",
"breakdown": "<breakdown>"
},
"name": "sgbr_facet_breakdown"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | Max number of row values, the most frequent first (max 25). | |
| facet | Yes | Row dimension. One of: library (holding library), language (language), resource_type (type of the original resource), genre (genre), publication_place (place of publication), subject_heading (catalogued subject heading; OR the German and English forms, which barely overlap (only the German carry a GND id)), subject_area (rule-based subject classification derived from the call number (enrichment)), topic (broad subject auto-derived from the call number (enrichment)), availability (type of data available in the portal (full text / metadata-only / external scans / single foldout page)), scan_source (platform or institution providing the scans (a record may list several)), object_type (object type: monograph (work/Werk), multivolume work (multivolume/Mehrbändig), volume (Band), or single foldout page (foldout/Einzelseite)), foldout_type (foldout content category — ~50 German terms (Karten, Tabellen, …) adapted from the Library of Congress Thesaurus for Graphic Materials (AI enrichment)), genre_ai (genre predicted by the ZB-Lab AI model (18 labels, high-confidence predictions only); ~4x the coverage of the catalogued `genre` (enrichment)), content_flags (~15 pipeline flags (IMAGE_ON_PAGE, CHAPTER_START, …) plus thousands of German volume-designation strings — not a controlled vocabulary (enrichment)), volume_info (volume designation within a multivolume work), parent_record (id of the parent record, gathering one work's volumes; filter the facet's BARE digits, never the id991… form), author (author), year (publication year). Must differ from `breakdown`; "year" and "object_type" are not supported as axes (see sgbr_facet_values / sgbr_search instead). | |
| query | No | Free-text query the grid is computed over (same symbolic-Lucene rules as sgbr_search; empty = whole corpus). | |
| scope | No | Restrict the query to one field group (same as sgbr_search). | all |
| exclude | No | Drop records carrying ANY of these values, per dimension (same keys and exact values as `filters`). Unlike a filter it keeps records with no value for that dimension, e.g. the untyped records filters.object_type can never reach. A misspelled value silently excludes nothing — take values from sgbr_facet_values. | |
| filters | No | Narrow the population the grid counts over, by dimension (same keys/values as sgbr_search). Values within one dimension are OR-ed; different dimensions AND. Dimension values are exact facet values — discover them with sgbr_facet_values facet=<dim> — except object_type, whose enum lists friendly keys. Note: subject_area, topic, foldout_type, genre_ai, content_flags are machine-derived enrichments, not catalogued data. | |
| year_to | No | Only records published in or before this year (inclusive publication-date range). | |
| breakdown | Yes | Column dimension. Same set as `facet` (and the same "year"/"object_type" exclusion); must differ from `facet`. | |
| pages_max | No | Only records with at most this many page images (see pages_min). | |
| pages_min | No | Only records with at least this many page images (a multivolume work counts all its volumes'); records without scans are excluded. | |
| year_from | No | Only records published in or after this year (inclusive publication-date range). | |
| breakdown_size | No | Max number of column values, the most frequent first (max 25). | |
| full_text_only | No | If true, count only digitised items that have machine-readable full text. | |
| ocr_quality_min | No | Only records whose OCR quality score (0–100, mostly 90–95) is at least this; records without their own scan (multivolume parent works, metadata-only records) are excluded. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| facet | Yes | ||
| query | Yes | ||
| scope | Yes | ||
| col_axis | Yes | ||
| row_axis | Yes | ||
| warnings | No | ||
| breakdown | Yes | ||
| full_text_only | Yes | ||
| applied_filters | No |