Skip to content

Ontologies and shapes

Ontologies and versions

The ontologies of a project are versioned. A job that renders an ontology either creates one or extends one by writing a new version; a version names the versions it derives from. A head is a version nothing newer derives from. An ontology with several heads has diverged: a job cannot extend it, but an upload or an edit merges it, since a new version from a file derives from every head.

  • GET /ontologies?project=…: the project's ontologies with their heads. A job in fixed_single_ontology mode takes an ontology_id from here.
  • GET /ontologies/{id}: the version history, with the job or upload each version came from.
  • GET /ontologies/{id}/versions/{key}/turtle: one version; GET /ontologies/{id}/diff?from=&to=: the terms added, removed or changed between two versions (by default, a head against the version it derives from).
  • POST /ontologies (multipart file, optional name): upload an ontology. Turtle, N-Triples, JSON-LD and RDF/XML are read. A file whose ontology IRI is new starts a new ontology (name sets its id: never cd, doc, facts, oc or ontocast, and a standard prefix such as prov only for the ontology in that prefix's namespace); one whose IRI the project holds becomes that ontology's next version. The answer's created says which: ontology, version, or unchanged when the content equals the head's and nothing was stored.
  • POST /ontologies/{id}/versions (body: the whole ontology as text/turtle): save an edit as the next version, under the same rules. POST /ontologies/{id}/preview takes the same body and answers what saving it would store (its label and its changes against the head) without writing anything.
  • A new version's label is the file's owl:versionInfo when it is higher than every head's; otherwise the highest head's label with the minor part bumped. It keeps the ontology's IRI and id.
  • DELETE /ontologies/{id} deletes an ontology; DELETE /ontologies/{id}/versions/{key} removes an older version's content and keeps its place in the history. A head cannot be removed alone.

Only one writer changes a project's ontologies at a time: while a job renders an ontology, changes through the API answer 409 ontology_writer_running. Facts-only jobs run alongside.

The gallery holds curated public ontologies you can add to a project in one call.

  • GET /gallery?project=…: the entries, grouped by domain, each with its licence and attribution, its class, property and triple counts, fits_plan (your plan takes an ontology that size) and in_project (the project already holds its ontology IRI).
  • POST /ontologies/gallery/{id}?project=…: add an entry as a new ontology, named by the entry's id. It answers 201 with what an upload answers. The gallery accepts files up to its own size cap (10 MB), so an entry may be larger than a file you can upload; the triple limits still apply, the server's and your plan's (409 plan_limit). An entry the project already holds answers 409 ontology_exists; to add a version, upload the file instead.

Shapes

SHACL shapes validate a project's facts. POST /shapes (multipart file, optional name) uploads a shapes document; an upload under the same name replaces it. GET /shapes lists them, GET /shapes/turtle?graph=… downloads one and DELETE /shapes?graph=… deletes one.