Chapter 2: The block
1 A block with every group of keys
The block names its identity, its order, its scope, its plan, its artefacts and its display. The instruction names an artefact of Chapter 1 by a placeholder.
From the list in {{ref:ch01/first-list.partners}}, keep the correspondents with at least ten letters.
Partitur
---
id: anatomy
depends_on: [ch01/first-list]
rerun: if-stale
collections: [pirckheimer]
years: {from: 1520, to: 1530}
display: tabelle
duckdb:
- alias: main
path: $PDAI_COLLECTIONS/pirckheimer/pirckheimer.duckdb
read_only: true
partiturs:
- id: duckdb-read
input:
sql: |
SELECT r.name, r.count
FROM read_json_auto('{{ref:ch01/first-list.partners}}') AS f,
unnest(f.data.data.rows) AS t(r)
WHERE r.count >= 10
ORDER BY r.count DESC, r.name
artefacts:
- name: frequent
kind: table
file: frequent.json
---
From the list in {{ref:ch01/first-list.partners}}, keep the correspondents
with at least ten letters.ohne Erwartung
- Donauwörth, Bürgermeister und Rat von127.0
- Erasmus, Desiderius21.0
- Pirckheimer, Klara20.0
- (unbekannt)19.0
- Schöner, Johann11.0
- Pirckheimer, Sabina10.0
2 The same question through a Partitur
The second form of plan names a subtask. The block then runs the query Partitur of ai-query, with a language model in the loop, instead of a SQL statement.
How many correspondents did Pirckheimer have between 1520 and 1530? Count distinct persons in letters_resolved, resolved through ent_canonical.
Partitur
---
id: subtask-count
years: {from: 1520, to: 1530}
subtask: correspondence-count
golden: golden-c782fab71c
display: kennzahl
oracle:
n_correspondents: 75
duckdb:
- alias: main
path: $PDAI_COLLECTIONS/pirckheimer/pirckheimer.duckdb
read_only: true
artefacts:
- name: report
kind: report
file: report.json
---
How many correspondents did Pirckheimer have between 1520 and 1530?
Count distinct persons in letters_resolved, resolved through ent_canonical.75 Briefpartner.
bestanden