Skip to content
SCTAScholastic Commentaries and Texts Archive

APIs

OAI-PMH

The SCTA's records for library aggregators such as WorldCat.

Imported from scta-api · docs/oai.md · main @ c802747 · 2026-11-27

Documentation: all pages

OAI-PMH (/oai) #

OAI-PMH 2.0 for aggregators (WorldCat), at the old public path scta.info/oai, GET and POST. Ported from scta-site (lib/oai_functions.rb); code in src/scta_api/oai.py (protocol) and src/scta_api/routers/oai.py (route).

What stays the same #

What a harvester has already stored must not change, or it may re-harvest or duplicate records:

  • Records: the expressions of the scta work group (sctap:hasExpression) that have a title, an author with a title, a description and a shortId: the same query as before, so the same records (384 of the 400 expressions on 2026-11-27).
  • Identifiers http://scta.info/resource/<id>, record setSpec scta, format oai_dc.
  • Datestamp 2001-12-14 on every record, and the dc fields title, creator, description, date (2001-12-14), identifier, with the same values.

scripts/oai_parity.py checks this against the live service: ListRecords (every record, every field), ListIdentifiers, a sample of GetRecord, ListMetadataFormats. On 2026-11-27: 384/384 records identical.

What is fixed #

The old code answered everything with a 200 and built XML by string concatenation:

Old Now
Unknown or missing verb → an Identify response badVerb error
Extra, repeated or missing arguments ignored badArgument
set, from, until ignored (always all records) honoured: from/until are days (YYYY-MM-DD, the declared granularity); a time is badArgument
GetRecord of an unknown identifier: a record with empty fields, or a crash idDoesNotExist
Unknown metadataPrefix ignored cannotDisseminateFormat
resumptionToken ignored badResumptionToken (none are issued; all records fit in one response)
Values not XML-escaped built with lxml (no current value needs escaping, so no record changes)
responseDate fixed at 2002-05-01 the real time
earliestDatestamp 1990-02-01T12:00:00Z (finer than the granularity, and earlier than any record) 2001-12-14
ListSets said SCTA / SCTA:sententia, records said scta ListSets says scta / scta:sententia; set=SCTA is still accepted
baseURL http://scta.info/oai, request https://scta.info/oai both from the request's origin (https://scta.info/oai when deployed)
application/xml text/xml (what the protocol specifies)

Known limits (open) #

  • Fixed datestamps. Every record says 2001-12-14, so an incremental harvest (from= a later day) now correctly returns noRecordsMatch, and a new expression is never picked up incrementally, only by a full harvest. (The old service returned everything for any from, so a harvester that filtered by datestamp saw nothing new either.) A real datestamp per record (e.g. the last change of its EDF in scta-projectfiles, or the build date when its description changed) would fix this, at the cost of one re-harvest of the records whose datestamp moves. Decided 2026-11-27: keep the fixed datestamps for now.
  • scta:sententia is listed but empty: the graph has no hasExpression on sententia. Kept because the old ListSets advertised it.
  • Caching. SPARQL results are cached for the life of the process (as for /nav), so records added by a nightly build appear after a restart. A time-limited cache is a general to-do for the app.
  • Not yet run through an OAI-PMH validator (REDESIGN.md asks for one before switching the Traefik rule).