Package ai.chatur.cortex.core.branch
Class BranchEditService
java.lang.Object
ai.chatur.cortex.core.branch.BranchEditService
Applies reviewer edits — deletions, object edits, and subject renames — to the assertions staged
on a branch pending review.
-
Constructor Summary
ConstructorsConstructorDescriptionBranchEditService(org.apache.jena.query.Dataset assertions, BranchRepository branchRepository) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionbooleanrenameBranchSubjects(String branch, List<ai.chatur.cortex.BranchRename> renames) Renames subjects staged on the given branch, as an RDF patch on the branch graph.booleanupdateBranch(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.
-
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 branchesbranchRepository- guards every operation against an unknown branch
-
-
Method Details
-
updateBranch
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 namechanges- the changes to apply- Returns:
trueif the branch existed and the changes were applied
-
renameBranchSubjects
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 namerenames- the renames to apply- Returns:
trueif the branch existed and the renames were applied
-