Class BranchEditService

java.lang.Object
ai.chatur.cortex.core.branch.BranchEditService

public class BranchEditService extends Object
Applies reviewer edits — deletions, object edits, and subject renames — to the assertions staged on a branch pending review.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BranchEditService(org.apache.jena.query.Dataset assertions, BranchRepository branchRepository)
    Creates the service.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    renameBranchSubjects(String branch, List<ai.chatur.cortex.BranchRename> renames)
    Renames subjects staged on the given branch, as an RDF patch on the branch graph.
    boolean
    updateBranch(String branch, List<ai.chatur.cortex.BranchChange> changes)
    Applies reviewer changes — deletions and object edits — to the assertions staged on the given branch, as an RDF patch on the branch graph.

    Methods inherited from class java.lang.Object

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

    • BranchEditService

      public BranchEditService(org.apache.jena.query.Dataset assertions, BranchRepository branchRepository)
      Creates the service.
      Parameters:
      assertions - the dataset holding the approved assertions and the staged branches
      branchRepository - guards every operation against an unknown branch
  • Method Details

    • updateBranch

      public boolean updateBranch(String branch, List<ai.chatur.cortex.BranchChange> changes)
      Applies reviewer changes — deletions and object edits — to the assertions staged on the given branch, as an RDF patch on the branch graph.

      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

      public boolean renameBranchSubjects(String branch, List<ai.chatur.cortex.BranchRename> renames)
      Renames subjects staged on the given branch, as an RDF patch on the branch graph.

      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