Class BranchQueryService
Every reader is routed through BranchRepository.onBranch(java.lang.String, java.lang.String, java.util.function.Function<org.apache.jena.rdf.model.Resource, T>, T), the same guard the write
operations in BranchEditService and BranchMergeService use, so the provenance graph — a named graph of the same dataset, but never a
branch — is never rendered as one: a branch named provenance is treated exactly like an
unknown branch. Each method's missing value is chosen to match what it already returns
for a genuinely unknown branch, so "provenance" and "unknown" are indistinguishable to callers:
getBranch(java.lang.String) returns the shared prefix header with no data, getBranchInfo(java.lang.String) returns
the requested name with a null start time and both counts 0, and getBranchSubjects(java.lang.String) returns an empty list.
-
Constructor Summary
ConstructorsConstructorDescriptionBranchQueryService(org.apache.jena.query.Dataset assertions, org.apache.jena.ontapi.model.OntModel ontModel, BranchRepository branchRepository) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionReturns the assertions staged on the given branch.ai.chatur.cortex.BranchInfogetBranchInfo(String branch) Summarizes a branch pending review from its staged provenance activity.List<ai.chatur.cortex.BranchSubject> getBranchSubjects(String branch) Returns the assertions staged on the given branch grouped by subject, excluding the provenance activity of the ingestion.
-
Constructor Details
-
BranchQueryService
public BranchQueryService(org.apache.jena.query.Dataset assertions, org.apache.jena.ontapi.model.OntModel ontModel, BranchRepository branchRepository) Creates the service.- Parameters:
assertions- the dataset holding the approved assertions and the staged branchesontModel- the ontology model, used to abbreviate terms for displaybranchRepository- guards every read against an unknown branch or the provenance graph
-
-
Method Details
-
getBranch
Returns the assertions staged on the given branch.- Parameters:
branch- the branch name- Returns:
- the staged assertions serialized in Turtle syntax, or just the shared prefix header with no data if the branch does not exist or is the reserved provenance graph name
-
getBranchInfo
Summarizes a branch pending review from its staged provenance activity.- Parameters:
branch- the branch name- Returns:
- the branch summary, counting separately what the branch stages for addition and what it
stages for removal, or
(branch, null, 0, 0)if the branch does not exist or is a reserved graph name
-
getBranchSubjects
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 and each statement flagged with whether the branch stages it for addition or for removal, or an empty list if the branch does not exist or is a reserved graph name
-