The SCTA resource API, v1: contract #
What the SCTA graph says about one resource, for linked-data clients and for the HTML catalogue client
(scta-catalogue). This file is the contract between them: change it before changing either side.
Example responses (real data, 2026-11-28) are in docs/examples/resource/.
URLs #
| URL | What |
|---|---|
https://scta.info/resource/{id} |
The SCTA URI itself. Dereferences with content negotiation (below). |
https://scta.info/api/resource/v1/resources/{id}?format=jsonld|ttl|rdf|nt&view=concise |
The same description, the format chosen in the URL (or by Accept if format is absent). |
https://scta.info/api/resource/v1/incoming/{id}?property=&type=&limit=&offset= |
Resources that link to {id}, a page at a time. |
…/resources?resource={id or IRI}, …/incoming?resource={id or IRI} |
The same, with the resource named in a query parameter (below). |
https://scta.info/api/resource/v1/ |
Describes the API. |
{id} is the part after http://scta.info/resource/, slashes included: lectio1, lectio1/critical/transcription, reims/1r.
?view=concise (on /resources/{id} and on /resource/{id}) gives the concise description: only the
resource's own triples (below). On /resource/{id} in a browser it asks the catalogue for its data view, the
same triples as a table.
The id in the path is the canonical form. The resource is the thing the URL names, so the path names
it, as /resource/{id} does. Ids with slashes are handled (the rest of the path is the id). It keeps API URLs
parallel to the URIs (/resource/lectio1 ↔ /api/resource/v1/resources/lectio1) and cacheable as plain paths.
?resource= is an alternative (added 2026-11-28), on /resources and /incoming (not on
/resource/{id}, which is the URI itself):
GET /api/resource/v1/resources?resource=lectio1
GET /api/resource/v1/resources?resource=http://scta.info/resource/lectio1&format=ttl
GET /api/resource/v1/incoming?resource=http://scta.info/resource/peter-plaoul&property=role:AUT
- The value is an SCTA id (
lectio1,lectio1/critical) or a full IRI (http://scta.info/resource/lectio1,httpsaccepted). So a client holding an IRI from the graph passes it as it is. (URL-encode it if your client doesn't:?resource=http%3A%2F%2Fscta.info%2Fresource%2Flectio1.) IRIs outsidehttp://scta.info/resource/answer 404 for now; this form is where other URI spaces (/property/…) could be served later. - The answer is the same, with 200 (no redirect), plus
Link: <path form>; rel="canonical"andContent-Locationnaming the path form, so caches and clients learn the one canonical URL. The other query parameters (format,view,property, …) are unchanged;next/prevlinks on/incominguse the path form. - 400: both a path id and
resourcegiven;resourceempty. 422:/resourcesor/incomingwith noresource(a missing required parameter). In the OpenAPI docs (/docs) the two forms are separate operations, each with its own required parameter. DTS (/api/dts/v1, planned) also names resources with?resource=, so a client using both sees one convention.
Dereferencing scta.info/resource/{id} #
The URI answers at itself, with 200, no redirect, in the representation the Accept header asks for:
| Accept | Gets |
|---|---|
text/html (browsers name it explicitly) |
the catalogue page, rendered by scta-catalogue (this app proxies it) |
application/ld+json, application/json |
JSON-LD (below) |
text/turtle |
Turtle |
application/rdf+xml (or application/xml) |
RDF/XML |
application/n-triples (or text/plain) |
N-Triples |
none, or */* |
JSON-LD |
| anything else only | 406 |
q-values are honoured (text/turtle;q=0.5, application/rdf+xml → RDF/XML). Every response carries
Vary: Accept, and Link: <…>; rel="alternate"; type="…" for each other representation. RDF responses add
Content-Location with the format-specific API URL, so the representation also has a URL of its own.
Is this good linked-data practice? Yes. The two recognized patterns for a URI that names a thing (a work,
a person) rather than a web page are (a) a 303 See Other to a document that describes it (DBpedia,
Wikidata) and (b) answering the URI directly with 200 and content negotiation. The W3C TAG accepted (b) when
it revisited httpRange-14 (2012); what matters is that the URI dereferences, that Vary: Accept is set so
caches keep the representations apart, and that each representation is also reachable on its own
(Content-Location, Link). scta.info already answers with 200, so (b) also changes nothing for existing
clients. The API URLs are an addition for clients that can't set headers, not the place the URI sends you.
Changes from scta-site: it served the same expanded JSON-LD for every RDF type, labelled text/plain
(N-Triples for no Accept), and the obsolete RDF/JSON (Talis) format for application/json. Now each syntax is
real and correctly labelled, and application/json gets the JSON-LD below. (No client of the RDF/JSON format
was found in LombardPress or the scta repos; worth a look in the access logs before switching.)
What a description contains #
-
Every triple whose subject is the resource. Nothing is filtered or renamed.
-
A few facts about every resource it links to, so a client can label, sort and attribute a link without another request. For each linked SCTA resource, those of these triples the graph has:
dc:title;sctap:totalOrderNumber,sctap:sectionOrderNumber(expressions: reading order),sctap:order(surfaces: page order);role:AUT, with the author's owndc:title(a second hop).
The set is fixed, the same for every property the link comes through. These are extra triples about the linked resources, present in every syntax.
The concise description (?view=concise) is part 1 alone: the resource's own predicates and objects, objects as
IRIs with nothing about them.
Is it right to send triples about other resources? Yes. Linked-data practice asks that a URI, looked up,
give useful information in RDF; nothing limits that to triples with the URI as subject. Labelling linked
resources is a common pattern (Linked Data Patterns: "Label Everything"), and descriptions routinely reach
further (DBpedia includes incoming links; Concise Bounded Descriptions follow blank nodes). The rule kept here:
every triple sent is a triple in the graph, about its own subject. <lectio2> sctap:totalOrderNumber "0002"
in lectio1's description is a fact about lectio2, and an RDF client files it under lectio2. Nothing about a
linked resource is ever stated about the resource itself.
Not included: triples about the resource from elsewhere (incoming links; see /incoming). RDF values are
unordered: dcterms:hasPart lists parts sorted by IRI. For reading order, sort them by the order numbers they
carry (above); /api/corpus/v1/nav/{id} also gives the structure in order. There is no paging: the biggest
descriptions seen (a codex's 426 surfaces, a work group's expressions) are a few hundred values.
The JSON-LD shape (what scta-catalogue relies on) #
{
"@context": { "sctar": "http://scta.info/resource/", "sctap": "http://scta.info/property/", "dc": "…",
"dcterms": "…", "rdf": "…", "rdfs": "…", "owl": "…", "ldp": "…", "role": "…", "xsd": "…",
"dc:title": {"@container": "@set"}, "…every property used": {"@container": "@set"} },
"@id": "http://scta.info/resource/lectio1",
"@type": ["sctar:expression"],
"dc:title": ["Lectio 1, De fide"],
"sctap:level": ["3"],
"dcterms:isPartOf": [{"@id": "http://scta.info/resource/pp-deFide", "dc:title": ["de Fide"],
"sctap:totalOrderNumber": ["0003"], "sctap:sectionOrderNumber": ["0002"],
"role:AUT": [{"@id": "http://scta.info/resource/peter-plaoul", "dc:title": ["Peter Plaoul"]}]}],
"role:AUT": [{"@id": "http://scta.info/resource/peter-plaoul", "dc:title": ["Peter Plaoul"]}],
"owl:sameAs": [{"@id": "http://www.wikidata.org/entity/Q7176408"}]
}
Rules (stable within v1):
- Keys are compact IRIs with the prefixes in the context:
dc:title,sctap:hasManifestation,role:AUT(LoC relators: AUT author, EDT editor). A predicate with no known prefix appears as its full IRI. @idis always the full IRI (http://scta.info/resource/…,http://, as in the graph). A client turns an SCTA IRI into its own link by taking the part after/resource/.@typeis an array of compact IRIs:sctar:expression,sctar:manifestation,sctar:transcription,sctar:person,sctar:workGroup,sctar:codex,sctar:surface, ….- Every property's value is an array, even when there is one value (
@container: @set). No single-value special case to handle. - Literals are plain strings. (Everything in the graph is an
xsd:stringtoday: numbers such assctap:level"3" orsctap:totalOrderNumber"0005" are strings.) A literal with a language would be{"@value", "@language"}; with another datatype,{"@value", "@type"}. - Linked resources are objects
{"@id": …}, with the facts above when the graph has them:"dc:title": [...],"sctap:totalOrderNumber": [...],"sctap:sectionOrderNumber": [...],"sctap:order": [...](strings),"role:AUT": [{"@id", "dc:title"}]. External IRIs (Wikidata, DBpedia, GitHub, the ldp inbox) have none. A client sorts parts bytotalOrderNumber(ororderfor surfaces) as strings: they are zero-padded. In the concise view a linked resource is{"@id"}alone. - Keys are in alphabetical order (in a linked resource:
@id,dc:title, the order numbers,role:AUT); values: linked resources first, sorted by IRI, then literals.
It is valid JSON-LD: an RDF tool can parse it (it produces the same graph as the Turtle; checked with rdflib),
and a plain-JSON client can read it with the rules above and ignore @context.
/incoming/{id} #
Resources that link to {id}, sorted by property then IRI, a page at a time:
GET /api/resource/v1/incoming/peter-plaoul?property=role:AUT&type=sctar:expression&limit=5
{
"@context": {"…prefixes": "…", "dc:title": {"@container": "@set"}},
"@id": "http://scta.info/resource/peter-plaoul",
"property": "role:AUT", "type": "sctar:expression", "limit": 5, "offset": 0,
"items": [{"@id": "http://scta.info/resource/deIncarnatione", "property": "role:AUT", "dc:title": ["de Incarnatione"]}],
"next": "https://scta.info/api/resource/v1/incoming/peter-plaoul?limit=5&offset=5&property=role:AUT&type=sctar:expression"
}
property: only links through this predicate (compact or full IRI).type: only linking resources of this rdf:type.limit1–1000 (default 100),offset.next/prevappear when there is another page. There is no total count (counting can be slow on 80 million triples).- Some resources have very many incoming links (a person is the
role:AUTof every part of every work), so a catalogue page should always filter bypropertyand usually bytype.
Errors #
- 404: no triple has the resource as subject (or the id can't be an IRI).
- 400: unknown
formatorview; aproperty/typethat isn't an IRI; an id both in the path and inresource, or an emptyresource. - 422: the query form without
resource; alimit/offsetout of range. - 406:
/resource/{id}with an Accept that allows none of the representations.
Open #
- An author's top-level works (not every part) still needs a filter on
/incomingor its own endpoint. - Caching: descriptions change only with the nightly build; an ETag/cache keyed on the build is planned (REDESIGN.md, Idea 2).
- Other URI spaces under
http://scta.info/(e.g./property/…) are not served yet.