import type { PathBuilderLike } from "path-ts"; import type { SPARQLResults, WikidataClient } from "#tools/fetch/wikidata/subvenue"; import { type ProgressReporter } from "#tools/fetch/wikidata/vital-places/progress"; /** * A class under one of these roots makes its instances places. * * Covers geographic location, geographical feature, architectural structure, * `Q473972` (national parks), and archaeological site. */ export declare const PLACE_ROOTS: readonly string[]; /** * Direct `P31` classes for located physical features and public monuments whose Wikidata * class tree doesn't walk up to {@linkcode PLACE_ROOTS}: oceanic trench (`Q21285941`), * sculpture (`Q860861`), and statue (`Q179700`). */ export declare const DIRECT_PLACE_CLASSES: readonly string[]; /** * A class under one of these roots excludes its instances: occurrence * (an event such as a battle, placed at the coordinate where it happened) * and historical country (a polity no address names). */ export declare const EXCLUDED_ROOTS: readonly string[]; /** * A place whose class descends from one of these roots is a settlement or an * administrative area, and Who's On First already teaches its name: human settlement, * administrative territorial entity and country. */ export declare const SETTLEMENT_ROOTS: readonly string[]; /** * A place whose class descends from one of these roots is a site to visit, even * when a settlement root applies too: architectural structure (`Q811979`), * `Q473972` (national parks and reserves) and archaeological site (`Q839954`). */ export declare const SITE_ROOTS: readonly string[]; /** * A place whose class descends from one of these roots is a street or road: road and street. * * Wikidata files categorize streets under architectural structure, so a render of * them as venues teaches `Calle de Alcalá` as a venue. * The street sources already teach those names under `street`. * * Thoroughfare is left out because square descends from it, and Times Square is a venue. */ export declare const ROAD_ROOTS: readonly string[]; /** * Every root the descent query asks about: the inventory's and the render's. * * Keeps the v3 root order stable so cached `class-roots.v3.json` entries match without re-querying. */ export declare const DESCENT_ROOTS: readonly string[]; /** * The most class ids one descent query names. * * Measured on 2026-11-03: a batch of 150 answers within the service's 60-second limit. */ export declare const CLASS_QUERY_BATCH = 150; /** * The roots each class descends from, `[]` for a class under none of them. */ export type ClassRoots = Record; /** * What the class roots decide for one item. */ export declare const PLACE_VERDICTS: { readonly place: "place"; readonly excluded: "excluded"; readonly unclassified: "unclassified"; }; export type PlaceVerdict = (typeof PLACE_VERDICTS)[keyof typeof PLACE_VERDICTS]; /** * The SPARQL that names, for each class in the batch, every root it descends from. * * `wdt:P279*` includes the zero-length path, so a class that's itself a root descends from it. */ export declare function buildClassDescentQuery(classQIDs: readonly string[], roots?: readonly string[]): string; /** * The roots of every class in the batch from the descent query's answer: * a class the answer never names descends from none. * * A binding missing either column is refused rather than read as an unclassified class. */ export declare function readClassRoots(classQIDs: readonly string[], results: SPARQLResults): ClassRoots; /** * The verdict for an item from its classes' roots. * * Any class that excludes its instances keeps the item out, so a battle fought at a fortress stays out. * Otherwise any place root makes it a place. * A class with no cached roots leaves the item unclassified. */ export declare function placeVerdict(classes: readonly string[], roots: Readonly): PlaceVerdict; /** * Read the cached class roots, `{}` when no file exists yet. */ export declare function readClassRootsCache(path: PathBuilderLike): Promise; export interface ClassifyClassesOptions { /** * The JSON file the roots are cached in. */ cachePath: PathBuilderLike; report?: ProgressReporter; } export interface ClassifyClassesResult { roots: ClassRoots; /** * Classes whose query failed after the client's retries. * They stay out of the cache. */ failedClasses: string[]; } /** * Query the roots of every class the cache lacks, about 150 classes per query. * * The cache is rewritten after each answered batch, so an interrupted run keeps what it learned. */ export declare function classifyClasses(client: Pick, classQIDs: readonly string[], options: ClassifyClassesOptions): Promise; //# sourceMappingURL=classify.d.ts.map