Interface CortexBranches

All Known Subinterfaces:
Cortex

public interface CortexBranches
Lists, inspects, edits, and resolves the review branches staged by ingestion.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    approve(String branch)
    Merges the assertions staged on the given branch into the knowledge graph.
    getBranch(String branch)
    Returns the assertions staged on the given branch.
    Summarizes a branch pending review from the provenance activity recorded when it was staged.
    Returns the assertions staged on the given branch grouped by subject, excluding the provenance activity of the ingestion.
    boolean
    hasBranch(String branch)
    Reports whether a branch with the given name is pending review.
    Returns the names of all branches with staged assertions awaiting review.
    void
    reject(String branch)
    Rejects the given branch, discarding its staged assertions.
    boolean
    Renames subjects staged on the given branch.
    boolean
    updateBranch(String branch, List<BranchChange> changes)
    Applies reviewer changes — deletions and object edits — to the assertions staged on the given branch.
  • Method Details

    • listBranches

      List<String> listBranches()
      Returns the names of all branches with staged assertions awaiting review.
      Returns:
      the branch names, empty if nothing is pending
    • hasBranch

      boolean hasBranch(String branch)
      Reports whether a branch with the given name is pending review.
      Parameters:
      branch - the branch name
      Returns:
      true if the branch exists
    • getBranch

      String getBranch(String branch)
      Returns the assertions staged on the given branch.
      Parameters:
      branch - the branch name
      Returns:
      the staged assertions serialized in Turtle syntax
    • getBranchInfo

      BranchInfo getBranchInfo(String branch)
      Summarizes a branch pending review from the provenance activity recorded when it was staged.
      Parameters:
      branch - the branch name
      Returns:
      the branch summary
    • getBranchSubjects

      List<BranchSubject> getBranchSubjects(String branch)
      Returns the assertions staged on the given branch grouped by subject, excluding the provenance activity of the ingestion.
      Parameters:
      branch - the branch name
      Returns:
      the staged subjects sorted by name, each with its statements sorted by predicate
    • updateBranch

      boolean updateBranch(String branch, List<BranchChange> changes)
      Applies reviewer changes — deletions and object edits — to the assertions staged on the given branch.

      When the deletions remove every statement a subject carried, its IRI is gone from the branch, so every staged statement referencing that IRI as object is deleted as well.

      Changes addressing the provenance activity of the branch are ignored.

      Parameters:
      branch - the branch name
      changes - the changes to apply
      Returns:
      true if the branch existed and the changes were applied
    • renameBranchSubjects

      boolean renameBranchSubjects(String branch, List<BranchRename> renames)
      Renames subjects staged on the given branch.

      Every staged statement referencing a renamed IRI as object is rewritten to reference the new IRI; the statements describing the renamed subject — those carrying the IRI as subject — are removed rather than rewritten.

      Renames addressing the provenance activity of the branch are ignored.

      Parameters:
      branch - the branch name
      renames - the renames to apply
      Returns:
      true if the branch existed and the renames were applied
    • approve

      void approve(String branch)
      Merges the assertions staged on the given branch into the knowledge graph.

      Each merged statement is recorded with creation provenance, the branch is deleted, and the newly approved statements are added to the inference closure incrementally. Does nothing if the branch does not exist.

      Parameters:
      branch - the branch name
    • reject

      void reject(String branch)
      Rejects the given branch, discarding its staged assertions.

      Does nothing if the branch does not exist.

      Parameters:
      branch - the branch name