Class BranchController

java.lang.Object
ai.chatur.cortex.spring.branch.BranchController

@Controller public class BranchController extends Object
Web UI for reviewing branches staged by ingestion: listing branches pending review, viewing a single branch's staged statements, and approving or rejecting it.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BranchController(ai.chatur.cortex.CortexBranches branches)
    Creates the controller.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.servlet.view.RedirectView
    Merges a branch's staged assertions into the knowledge graph.
    getBranch(String branch, org.springframework.ui.Model model)
    Renders the assertions staged on a single branch, grouped by subject.
    listBranches(org.springframework.ui.Model model)
    Lists every branch pending review with its provenance summary.
    org.springframework.web.servlet.view.RedirectView
    Rejects a branch, discarding its staged assertions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BranchController

      public BranchController(ai.chatur.cortex.CortexBranches branches)
      Creates the controller.
      Parameters:
      branches - the branches role used to list, inspect, and resolve pending branches
  • Method Details

    • listBranches

      @GetMapping("/branches") public String listBranches(org.springframework.ui.Model model)
      Lists every branch pending review with its provenance summary.
      Parameters:
      model - receives branches, the BranchInfo of every pending branch
      Returns:
      the branches view name
    • getBranch

      @GetMapping("/branches/{branch}") public String getBranch(@PathVariable("branch") String branch, org.springframework.ui.Model model)
      Renders the assertions staged on a single branch, grouped by subject.
      Parameters:
      branch - the branch name
      model - receives branch (the branch name) and subjects (the BranchSubjects staged on it)
      Returns:
      the branch view name
    • approveBranch

      @PostMapping("/branches/{branch}/approve") public org.springframework.web.servlet.view.RedirectView approveBranch(@PathVariable("branch") String branch)
      Merges a branch's staged assertions into the knowledge graph.
      Parameters:
      branch - the branch name
      Returns:
      a redirect to /branches, so a reviewer working through several branches lands back on the list rather than on a class tree that says nothing about what just merged
    • rejectBranch

      @PostMapping("/branches/{branch}/reject") public org.springframework.web.servlet.view.RedirectView rejectBranch(@PathVariable("branch") String branch)
      Rejects a branch, discarding its staged assertions.
      Parameters:
      branch - the branch name
      Returns:
      a redirect to /branches