import { type MarkupElement } from "@mailwoman/core/html/elements"; import { PathBuilder } from "path-ts"; import { type CorpusAdapter } from "#types"; /** * Registry id for this adapter. * * Stamped into every row it emits, so a corpus record can be traced back to the dataset it came from. */ export declare const VLAANDEREN_ADAPTER_ID = "vlaanderen"; /** * The terms the address-source register elects for `be-property-building-1`. * * The register's `electedTerms` for license * `unchecked-access-free-be-agentschap-digitaal-vlaanderen` states this value. * That license has no `spdx`, so `electedTermsLabel` answers this string * and the share-alike prefix filter matches it. */ export declare const VLAANDEREN_DEFAULT_LICENSE = "Modellicentie voor gratis hergebruik Vlaanderen"; /** * The one jurisdiction this adapter emits. * * The service publishes the Flemish Region. * ISO 3166-1 assigns that region no code of its own, so the set holds one code. * * A caller that requests any other gets {@linkcode UnsupportedCountryError} rather than zero rows. */ export declare const VLAANDEREN_COUNTRIES: readonly string[]; /** * What a harvest of the service holds, written beside its GML by the harvester. * * The manifest exists because the service grants no ordering: it records which pages were taken and in * which order, so the adapter's output is a function of the harvest rather than of a directory listing. */ export interface VlaanderenHarvest { /** * The service the pages came from. */ service: string; /** * The WFS version the harvester spoke. */ wfsVersion: string; /** * The `outputFormat` the pages are written in. */ outputFormat: string; /** * When the harvest ran, as the service's own `timeStamp` reported it. */ retrievedAt: string; /** * The `numberMatched` the service reported for `ad:Address` past index 0. */ addressCount: number; /** * The files holding each component feature type, in the order the adapter reads them. * * A list rather than one file per type, because page size caps at 10,000 * and `ad:ThoroughfareName` holds 167,218 features: the type needs 17 pages. * `ad:PostalDescriptor` (1,190) and `ad:AdminUnitName` (609) each fit in one, * and are still listed, so a type that grows past the cap needs no change here. */ components: { ThoroughfareName: readonly string[]; PostalDescriptor: readonly string[]; AdminUnitName: readonly string[]; }; /** * The address pages, in the order the adapter reads them. */ addressPages: readonly { startIndex: number; file: string; /** * The `numberReturned` the page's own root element states. * * The adapter checks the features it parsed against this, so a truncated page raises * rather than reading as a short one. */ numberReturned: number; }[]; } /** * Raised when the harvest cannot answer what the adapter asked it for. * * A harvest missing a component file or holding a short page cannot be read as a smaller * harvest: every address references all four components, so an absent component file * turns every row into a row with no street rather than into fewer rows. */ export declare class VlaanderenHarvestError extends Error { constructor(message: string); } /** * The `resourceId` that a component reference addresses in the same service. * * Flanders writes an absolute identifier URI rather than the local `#` fragment that * the Netherlands, Wallonia and Brussels write, and the service answers it under the * `gml:id` built from the URI's last two path segments joined with `_`. * A fragment is dropped, because `…/refnis1995/1000#id` addresses `refnis1995_1000`. * * @returns The id, or `null` when the href isn't a URL with at least two path segments. * A caller treats `null` as a reference it couldn't read rather than as a * reference the publisher left blank. */ export declare function componentResourceID(href: string): string | null; /** * A Flemish street name read apart from the homonym discriminator that follows it. * * `gn:text` on an `ad:ThoroughfareName` states more than the street name: the name, * an underscore, and a discriminator that's empty in most identifiers. * Over 20,000 values at twenty offsets, 19,979 end with `_` and the remaining * 21 have a discriminator after it. * * Exactly 21 values have an `_` somewhere other than the end. * Those same 21 values hold the only discriminators, so the field has one separator at one position. * * The same streets read through `ad:AddressRepresentation/ad:thoroughfare` have no separator, 0 of 10,000. * The publisher's own data therefore marks everything from the `_` onward as bookkeeping. * * The split takes the last `_` and keeps the head. * That drops a trailing separator and any discriminator in one step. */ export interface SplitStreetName { /** * The street name, with the separator and any discriminator removed. */ street: string; /** * The homonym discriminator, empty for all but 21 of the 20,000 values measured. */ discriminator: string; } /** * Splits an `ad:ThoroughfareName` `gn:text` value into its {@link SplitStreetName}. * * @throws {@linkcode VlaanderenHarvestError} when the value has no `_`. * Every one of the 20,000 measured values had one. * That would be a change in the publisher's field. * A guess at it would write a bookkeeping suffix into every row sharing the new shape. */ export declare function splitStreetName(value: string): SplitStreetName; /** * The house number an address states inline, or `null` when it states none this adapter can use. * * `designatorsByType` skips a designator the publisher marked void, so a void number * and an absent one both answer `null` here. * Both are refusals rather than addresses with no number, and the caller counts * them together for that reason. * * `ad:designator` was present and populated on 1,000 of 1,000 addresses sampled, * so neither condition has been seen on this service. */ export declare function houseNumberOf(address: MarkupElement): string | null; /** * Reads the harvest manifest and checks that it states what the adapter needs. */ export declare function readVlaanderenHarvest(root: PathBuilder): Promise; export declare function createVlaanderenAdapter(): CorpusAdapter; /** * The configured adapter instance registered with the corpus builder. */ export declare const vlaanderenAdapter: CorpusAdapter; //# sourceMappingURL=adapter.d.ts.map