Class JenaCortex
- All Implemented Interfaces:
ai.chatur.cortex.Cortex,ai.chatur.cortex.CortexArchive,ai.chatur.cortex.CortexBranches,ai.chatur.cortex.CortexInference,ai.chatur.cortex.CortexIngestor,ai.chatur.cortex.CortexLinter,ai.chatur.cortex.CortexOntology,ai.chatur.cortex.CortexQuery,ai.chatur.cortex.CortexSearch,ai.chatur.cortex.CortexStatistics
Cortex implementation backed by Apache Jena.
Composes the core services: OntologyService for the ontology and its class hierarchy,
LintService for linting assertions against the ontology, IngestService for
validated ingestion, BranchRepository for branch existence and listing, BranchQueryService for reading a branch pending review, BranchEditService for reviewer
edits to a branch, BranchMergeService for approving or rejecting a branch, ArchiveService for exporting the approved assertions, InferenceService for rule-based
inference, QueryService for SPARQL queries and full-text search, and StatsService
for statistics. Approving a branch extends the inference closure incrementally with the newly
approved statements.
Backing the store up is deliberately not part of this surface — see BackupService.
-
Constructor Summary
ConstructorsConstructorDescriptionJenaCortex(OntologyService ontologyService, LintService lintService, IngestService ingestService, BranchRepository branchRepository, BranchQueryService branchQueryService, BranchEditService branchEditService, BranchMergeService branchMergeService, ArchiveService archiveService, InferenceService inferenceService, QueryService queryService, StatsService statsService) Creates the composed implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidList<ai.chatur.cortex.ProvenancedStatement> ai.chatur.cortex.BranchInfogetBranchInfo(String branch) List<ai.chatur.cortex.BranchSubject> getBranchSubjects(String branch) List<ai.chatur.cortex.OntologyClass> List<ai.chatur.cortex.Term> getInstances(String type) ai.chatur.cortex.CortexStatsgetStats()booleanai.chatur.cortex.IngestResultai.chatur.cortex.LintResultvoidvoidbooleanrenameBranchSubjects(String branch, List<ai.chatur.cortex.BranchRename> renames) List<ai.chatur.cortex.SearchResult> searchSubjects(String text) booleanupdateBranch(String branch, List<ai.chatur.cortex.BranchChange> changes)
-
Constructor Details
-
JenaCortex
public JenaCortex(OntologyService ontologyService, LintService lintService, IngestService ingestService, BranchRepository branchRepository, BranchQueryService branchQueryService, BranchEditService branchEditService, BranchMergeService branchMergeService, ArchiveService archiveService, InferenceService inferenceService, QueryService queryService, StatsService statsService) Creates the composed implementation.- Parameters:
ontologyService- the ontology and its class hierarchylintService- linting of assertions against the ontologyingestService- validated, branch-based ingestionbranchRepository- branch existence and listingbranchQueryService- reading the assertions staged on a branchbranchEditService- reviewer edits to a branchbranchMergeService- approving or rejecting a brancharchiveService- export of the approved assertionsinferenceService- rule-based inference over the approved assertionsqueryService- SPARQL queries and full-text searchstatsService- knowledge graph statistics
-
-
Method Details
-
getOntology
- Specified by:
getOntologyin interfaceai.chatur.cortex.CortexOntology
-
lint
- Specified by:
lintin interfaceai.chatur.cortex.CortexLinter
-
ingest
- Specified by:
ingestin interfaceai.chatur.cortex.CortexIngestor
-
listBranches
- Specified by:
listBranchesin interfaceai.chatur.cortex.CortexBranches
-
hasBranch
- Specified by:
hasBranchin interfaceai.chatur.cortex.CortexBranches
-
getBranch
- Specified by:
getBranchin interfaceai.chatur.cortex.CortexBranches
-
getBranchInfo
- Specified by:
getBranchInfoin interfaceai.chatur.cortex.CortexBranches
-
getBranchSubjects
- Specified by:
getBranchSubjectsin interfaceai.chatur.cortex.CortexBranches
-
updateBranch
- Specified by:
updateBranchin interfaceai.chatur.cortex.CortexBranches
-
renameBranchSubjects
- Specified by:
renameBranchSubjectsin interfaceai.chatur.cortex.CortexBranches
-
approve
The merge itself (
BranchMergeService.approve(java.lang.String)) is one atomic write transaction: it either fully commits or leaves the branch untouched. Extending the inference closure afterward, however, is a second, separate transaction against a different dataset — the two cannot be combined into one transaction, sinceInferenceServiceandBranchMergeServiceguard independentDatasetinstances. IfInferenceService.addInference(org.apache.jena.rdf.model.Model)throws, the branch is already merged and cannot be un-merged here; rather than leave the closure silently stale until restart, this recomputes it from scratch — which reads the assertions dataset the merge already committed to, so the closure is correct again even though the incremental update failed — and then rethrows so the caller still learns the approval did not complete cleanly.- Specified by:
approvein interfaceai.chatur.cortex.CortexBranches
-
reject
- Specified by:
rejectin interfaceai.chatur.cortex.CortexBranches
-
exportAssertions
- Specified by:
exportAssertionsin interfaceai.chatur.cortex.CortexArchive
-
getClassHierarchy
- Specified by:
getClassHierarchyin interfaceai.chatur.cortex.CortexOntology
-
getInstances
- Specified by:
getInstancesin interfaceai.chatur.cortex.CortexQuery
-
describe
- Specified by:
describein interfaceai.chatur.cortex.CortexQuery
-
query
- Specified by:
queryin interfaceai.chatur.cortex.CortexQuery
-
search
- Specified by:
searchin interfaceai.chatur.cortex.CortexSearch
-
searchSubjects
- Specified by:
searchSubjectsin interfaceai.chatur.cortex.CortexSearch
-
getStats
public ai.chatur.cortex.CortexStats getStats()- Specified by:
getStatsin interfaceai.chatur.cortex.CortexStatistics
-
recomputeInference
public void recomputeInference()- Specified by:
recomputeInferencein interfaceai.chatur.cortex.CortexInference
-