Class BranchEditService
-
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.
A change flagged
retractedaddresses the statements the branch stages for removal from the approved assertions rather than those it stages for addition, and can only cancel one: a retraction has no object of its own to edit, because it names a statement that is already approved.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 in which a renamed IRI appears is rewritten to use the new IRI, in both positions: the statements describing the renamed subject keep their content under the new IRI, and the statements referencing it as object come to reference the new IRI.
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
-