Documentation
¶
Overview ¶
Package wikidata resolves a Work's creators to Wikidata entities and caches their EXPLICITLY-STATED demographic claims as enrichment statements -- the creator-demographics half of the diversity-audit feature.
The contract, in order of importance:
- No name inference, ever. Resolution goes ISBN -> edition (P212/P957) -> work (P629) -> author (P50): every hop is a cataloged identifier or an explicit Wikidata statement. A creator's name is never matched against anything, and a work without a resolvable identifier yields nothing.
- Explicit claims only, with provenance. Only the values Wikidata states outright for P21 (sex or gender), P27 (country of citizenship), P91 (sexual orientation), and P172 (ethnic group) are recorded, each as the claim's own entity URI plus label, alongside the QID it came from, what identifier matched it, and the retrieval date. Birth/death dates are deliberately not fetched.
- Aggregate use. These statements exist so a collection-level audit can report distributions with coverage; they are enrichment-graph data, not display fields, and the projector does not surface them on work pages.
Coverage will be partial and skewed (Wikidata's own coverage is); the audit reading this data is responsible for reporting match rate and unknowns first. Statements land in the enrichment:wikidata graph, dropped and replaced on each run, so a re-run refreshes and a removed claim upstream disappears here too.
Index ¶
Constants ¶
const DefaultEndpoint = "https://query.wikidata.org/sparql"
DefaultEndpoint is the public Wikidata Query Service SPARQL endpoint.
const Name = "wikidata"
Name is the enrichment source name; statements land in enrichment:wikidata.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enricher ¶
type Enricher struct {
// contains filtered or unexported fields
}
Enricher resolves creators via the Wikidata Query Service.
func (*Enricher) Enrich ¶
func (e *Enricher) Enrich(ctx context.Context, works []ingest.WorkSummary) ([]ingest.Enrichment, error)
Enrich resolves each Work's ISBNs and returns creator-claim enrichments for the Works that matched. Works with no ISBN, or whose ISBNs Wikidata does not know, are absent from the result -- RunEnrich leaves them untouched, and the audit reports them as unmatched rather than guessing.
type Option ¶
type Option func(*Enricher)
Option configures the enricher.
func WithClient ¶
WithClient injects the HTTP client (tests; a caller with its own limits).
func WithEndpoint ¶
WithEndpoint points at a different SPARQL endpoint (a mirror, a test stub).
func WithRetryBase ¶ added in v0.181.1
WithRetryBase overrides the first retry pause (tests use 0).