Skip to content

refactor(storage,query): decompose storage & AST god classes, decouple CoreseIO, and purge legacy dead code - #652

Merged
remiceres merged 9 commits into
feature/corese-nextfrom
refactor/core-next-storage-memory-decomposition
Oct 27, 2026
Merged

remiceres merged 9 commits into
feature/corese-nextfrom
refactor/core-next-storage-memory-decomposition

Conversation

@remiceres

Copy link
Copy Markdown
Contributor

Summary of Changes

  1. Storage God Classes Decomposition:

    • Extracted StatementCapture.java, GraphPartition.java, PartitionState.java, MemoryDatabase.java, SnapshotStatementSpliterator.java, and SnapshotTransaction.java from IndexedStatementStore.java (reduced by 49%).
    • Extracted PredicateStatisticsEstimator.java, SecondaryIndexBuilder.java, and TripleIndexCursor.java from TripleIndex.java (reduced by 24%).
    • Preserved all Copy-On-Write (COW), optimistic concurrency, and transaction invariants.
  2. SPARQL AST Builder Modularization:

    • Extracted SparqlPrologueBuilder.java and TriplePathExpander.java from SparqlAstBuilder.java.
    • Decoupled AST construction from direct query execution components.
  3. Inert Scaffolding & Dead Code Purge:

    • Deleted unused ResultListener.java and obsolete reportEnabled branches.
    • Streamlined ProcessVisitorDefault.java by eliminating uncalled empty hooks.
    • Removed dead nesting flags (Edge.isNested / setNested).
    • Purged dead opcodes from ExprType.java and dead types from ExpType.java.
    • Removed legacy 2010 Evaluator.Mode switch and unused setKGRAM / setProducer hooks.
  4. Architecture & Boundary Enforcement:

    • Decoupled query module from the io.CoreseIO facade using direct DefaultRDFParserFactory and DefaultRDFSerializerFactory.
    • Added automated enforcement test queryMustNotDependOnIoFacade() in NextModuleBoundaryTest.java.
  5. Quality & Validation:

    • 0 SonarLint alerts across the entire codebase.
    • 16/16 NextModuleBoundaryTest architectural isolation tests PASSED.
    • 3,433/3,433 JUnit tests PASSED (100% green).

…IndexBuilder from TripleIndex

- Extract predicate cardinality sampling logic into PredicateStatisticsEstimator
- Extract POS/OSP secondary index permutation build into SecondaryIndexBuilder
- Decouple GraphPartition and TripleIndex helper records
- Zero SonarLint alerts and 100% tests passing
- Extract positional traversal state machine into dedicated TripleIndexCursor
- Update SnapshotStatementSpliterator and cursor factories
- Zero SonarLint alerts and 100% tests passing
…ion forwarders

- Expose terms(), expressions() and paths() sub-builder accessors on SparqlAstBuilder
- Update all AST listeners to call specialized builders directly
- Prune 15 redundant forwarder methods and obsolete stubs from SparqlAstBuilder
- Zero SonarLint alerts and 100% tests passing
… from SparqlAstBuilder

- Extract BASE URI and PREFIX resolution into SparqlPrologueBuilder
- Extract property path, collection, and blank node path expansion into TriplePathExpander
- Update SparqlUpdateAstBuilder to use prologue replacement API
- Zero SonarLint alerts and 100% tests passing
…y test, and eliminate dead opcodes and evaluator hooks
@remiceres remiceres self-assigned this Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Overall Project 58.34% -0.07% 🍏
Files changed 91.02% 🍏

File Coverage
ExpType.java 100% 🍏
Evaluator.java 100% 🍏
ProcessVisitorDefault.java 100% 🍏
StagingTerms.java 100% 🍏
SecondaryIndexBuilder.java 100% 🍏
PartitionState.java 100% 🍏
EvalVisitorDispatcher.java 100% 🍏
SparqlKgramEvaluator.java 100% 🍏
DescribeQueryAstListener.java 100% 🍏
ServiceAstListener.java 100% 🍏
BindAstListener.java 100% 🍏
DatasetClauseAstListener.java 100% 🍏
SparqlQuadTemplateBuilder.java 99.61% 🍏
TripleIndexCursor.java 99.53% -0.47% 🍏
GraphPartition.java 99.39% -0.61% 🍏
UpdateLoader.java 98.55% 🍏
SnapshotStatementSpliterator.java 98.31% -1.69% 🍏
IndexedStatementStore.java 97.83% 🍏
TripleIndex.java 97.19% 🍏
ValuesAstListener.java 96.08% 🍏
SparqlUpdateAstBuilder.java 95.68% 🍏
SelectQueryAstListener.java 95.29% 🍏
PredicateStatisticsEstimator.java 94.23% -5.77% 🍏
SolutionModifierAstListener.java 91.02% 🍏
SparqlAstBuilder.java 91.01% -3.17% 🍏
ConstructQueryAstListener.java 90.03% -3.93% 🍏
SnapshotTransaction.java 88.56% -11.44% 🍏
StatementCapture.java 87.13% -12.87% 🍏
CoreseRepositoryConnection.java 86.4% 🍏
QueryExpIndexer.java 85.97% 🍏
SparqlPrologueBuilder.java 85.9% -14.1% 🍏
HavingAstListener.java 82.5% 🍏
ExpPatternScope.java 81.78% 🍏
FilterAstListener.java 81.58% 🍏
Eval.java 81.05% 🍏
QueryPlanner.java 78.21% 🍏
MemoryDatabase.java 77.42% -22.58% 🍏
QueryPlan.java 74.14% 🍏
Exp.java 65.45% 🍏
TriplePathExpander.java 63.4% -36.6% 🍏
EvalFilter.java 62.3% 🍏
Memory.java 56.18% 🍏
BgpAstListener.java 46.75% -8.44% ❌
Edge.java 10.53% 🍏
BindingContext.java 0% 🍏

@github-actions

Copy link
Copy Markdown

Test Results

  435 files    435 suites   35s ⏱️
3 429 tests 3 429 ✅ 0 💤 0 ❌
3 463 runs  3 463 ✅ 0 💤 0 ❌

Results for commit 61e992e.

@remiceres
remiceres merged commit 5075851 into feature/corese-next Oct 27, 2026
2 checks passed
@remiceres
remiceres deleted the refactor/core-next-storage-memory-decomposition branch October 27, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant