Jobs and imports¶
Jobs¶
A job is one document on its way to a graph. A request with several files makes one job per file, and is admitted whole or not at all. Jobs wait in your queue and run in the order they arrived. GET /jobs lists yours, newest first; filter with project, status and q (title and file name), page with limit and offset, and read the total from the X-Total-Count header. POST /jobs/{id}/abort stops one: a queued job never runs, a running one stops within about a minute. PATCH /jobs/{id} renames it; DELETE /jobs/{id} deletes a finished one and its facts, while its charges stay on your statement.
To run a document again, say after editing its ontology, turn on keeping documents for the project (PATCH /projects/{slug} with {"keep_documents": true}). Each job then keeps its converted document, and POST /jobs/{id}/rerun queues a new job over it with the first run's options and any you send (render_mode, ontology_context_fixed_ontology_id, the instructions, max_cost_eur, title). Nothing is uploaded or converted again, so there is no conversion fee, and the document's entities keep their IRIs, so the two runs' facts can be compared. A job reports kept, and a re-run rerun_of. A kept document is deleted with the last job that needs it, with its project or account, and when the project stops keeping documents.
Importing a fact graph¶
POST /import loads a graph you already have. Send the RDF files as multipart parts (any field name, such as files) and optionally project; each file becomes one job, and the request is admitted whole or not at all. Files are read by suffix, from the list GET /policy gives as rdf_extensions; here .json is JSON-LD.
curl -X POST $ONTOCAST_API/import \
-H "Authorization: Bearer $ONTOCAST_KEY" \
-F "files=@facts.ttl" -F "project=thesis"
The job checks the graph against the project's ontologies and SHACL shapes, with no model call, and stores it as uploaded in its own graph (graph_uri): the same triples, RDF 1.2 reifiers included, with literals in canonical form ("01"^^xsd:integer is stored as "1"). While it runs, stage is read_graph, then check. The finished job's outputs.check holds the report:
findings: at most 500, errors first. Each has akind, aseverity(errororwarning) and amessage, and where they apply asubject,predicate,value,suggestions(terms it may have meant) andsource_shape.findings_total: every finding, those left out included;counts: findings by kind, then by severity, also complete.metrics: the graph'striplesandinstances, the instancesisolatedanduntyped, andtwin_labels(labels several instances share).shacl_evaluated:truewhen the shapes ran;nullwhen the project has none or the graph is too large for them.catalog_empty:truewhen the project has no ontologies; the checks that need one are skipped.
| Kind | Severity | Means |
|---|---|---|
non_catalog_vocabulary |
error | A term no ontology of the project defines |
unknown_term |
error | A term missing from the well-known vocabulary its namespace names, or in a placeholder namespace such as example.org |
domain_violation |
error | A subject whose type contradicts a property's rdfs:domain |
untyped_value |
warning | A value given as text that reads as the property's datatype |
invalid_literal |
error | A value that is not valid in its datatype or the property's declared one |
temporal_range_mismatch |
error | A value of another datatype where the property takes a date, time or duration |
functional_violation |
error | Several values on a property that allows one |
shacl |
the shape's | A result of the project's SHACL shapes |
untyped_instance |
warning | An instance with no class from the project's ontologies |
isolated_instance |
warning | An instance linked to no other instance |
silent_instance |
warning | An instance linked to nothing that states no value either |
dangling_reference |
warning | An IRI the graph points to but never describes |
twin_labels |
warning | One label on several instances, which may be duplicates |
catalog_subject |
warning | Statements about a term of the project's ontologies: schema, not facts |
schema_in_facts |
warning | A class or property the graph declares itself; a facts graph does not extend the ontologies |
An import is free: no fees, no tokens, no hold. Its triples count against your stored triples from the moment it is queued (a failed import counts nothing). It takes no feedback (409 not_extracted) and cannot run again (409 not_kept). Its result downloads like any job's: GET /jobs/{id}/result with format and profile, so reifiers are served as rdf:Statement unless you ask for profile=native (see Results). An import uses no ontology, so graph=ontology answers 404.