Package ai.chatur.cortex.spring.archive
Class ArchiveController
java.lang.Object
ai.chatur.cortex.spring.archive.ArchiveController
Web UI for exporting the approved assertions and importing a Turtle document back in.
Import is not a restore. It goes through ingest like any other incoming assertions — linted, SHACL-validated, reduced to what is novel,
and staged on a branch — so an upload can no longer replace the graph, and lands on
/branches for a human to approve rather than silently taking effect.
-
Constructor Summary
ConstructorsConstructorDescriptionArchiveController(ai.chatur.cortex.CortexArchive archive, ai.chatur.cortex.CortexIngestor ingestor) Creates the controller. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> Downloads the approved assertions as a dated Turtle file.org.springframework.web.servlet.view.RedirectViewimportAssertions(org.springframework.web.multipart.MultipartFile file, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) Stages an uploaded Turtle document on a branch for review.
-
Constructor Details
-
ArchiveController
public ArchiveController(ai.chatur.cortex.CortexArchive archive, ai.chatur.cortex.CortexIngestor ingestor) Creates the controller.- Parameters:
archive- the archive role used to export the approved assertionsingestor- the ingestor role an uploaded document is staged through
-
-
Method Details
-
exportAssertions
Downloads the approved assertions as a dated Turtle file.- Returns:
- 200 OK with the assertions as the response body,
Content-Type: text/turtle, and aContent-Dispositionattachment header naming the filecortex-assertions-<today>.ttl
-
importAssertions
@PostMapping("/import") public org.springframework.web.servlet.view.RedirectView importAssertions(@RequestParam("file") org.springframework.web.multipart.MultipartFile file, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) throws IOException Stages an uploaded Turtle document on a branch for review.The extension check is not about trusting the upload —
ingestparses it and rejects anything that is not Turtle regardless. It exists so the one predictable wrong upload gets a comprehensible answer: Cortex 0.1.0 exported.trigwhole-dataset backups, and a raw parser error is not a useful way to learn those are no longer accepted.- Parameters:
file- the uploaded assertions, in Turtle syntaxredirectAttributes- receivesimportNoticeon success orimportErroron failure, rendered by the branches view- Returns:
- a redirect to
/branches - Throws:
IOException- if the uploaded file cannot be read
-