simplification

This commit is contained in:
felix
2026-09-26 18:56:43 +02:00
parent 41b91e65d9
commit 00eeb35923
12 changed files with 91 additions and 279 deletions

View File

@@ -1,12 +1,10 @@
import { sparqlEscapeUri, sparqlEscapeString, sparqlEscapeDateTime, sparqlEscapeDate } from '../db.js';
// Subject selection. One paged query per page; stops at ROW_LIMIT.
// onPage(n) fires after every answered page with the subject count so far,
// so a caller waiting on this run can tell a live one from a stalled one.
const ROW_LIMIT = Number(process.env.ROW_LIMIT || 200000);
const PAGE_SIZE = Number(process.env.SEED_PAGE_SIZE || 5000);
export async function seed(sessionQuery, spec, shape = null, onPage = null) {
export async function seed(sessionQuery, spec, shape = null) {
const subjects = [];
let offset = 0;
for (;;) {
@@ -14,7 +12,6 @@ export async function seed(sessionQuery, spec, shape = null, onPage = null) {
const result = await sessionQuery(query);
const rows = result.results.bindings.map(b => b.s.value);
subjects.push(...rows);
onPage?.(subjects.length);
if (subjects.length > ROW_LIMIT) {
throw new Error(`the question matches more than ${ROW_LIMIT} subjects. Add a filter, for example a date range or a bestuurseenheid.`);
}