refactor(query): decouple kgram execution engine from next query ast (#568) - #577
Merged
remiceres merged 3 commits intoSep 8, 2026
Merged
Conversation
…568) - Replace legacy IDatatype with DatatypeValue across next.query.impl.kgram - Introduce native expression evaluators in next.query.impl.sparql.bridge - Remove legacy bridging adapters (BindingAdapter, DatatypeAdapter, KgramNodeConverter, SparqlAstToExpression, StorageManagerKgramValues) - Add DatatypeValue and RdfValueOrder contracts to next.data - Enforce clean module boundaries with NextModuleBoundaryTest
… warnings (#568) - Add package-info.java documentation across all next.query.impl.kgram subpackages - Comply with SonarLint rule S1228 across the module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decouple
fr.inria.corese.core.next.queryand its internal KGRAM execution engine from legacy Corese v4 packages (fr.inria.corese.core.kgram.*andfr.inria.corese.core.sparql.*), eliminate temporary bridge adapters, and resolve all SonarLint code smells and cognitive complexity issues across the module.Resolves #568
Architecture and Implementation Highlights
1. Complete Decoupling from Legacy IDatatype and Packages
• Replaced
fr.inria.corese.core.sparql.api.IDatatypewithfr.inria.corese.core.next.data.api.model.DatatypeValueacross the internal KGRAM execution engine (next.query.impl.kgram).• Introduced
DatatypeValueandRdfValueOrderpublic contracts incore.next.data.• Standardized total ordering rules conforming to SPARQL total order specifications.
• Validated by
NextModuleBoundaryTestwith 0 legacy imports innext.query.2. Elimination of Compatibility Bridges and Native AST Evaluation
• Removed obsolete bridge classes:
BindingAdapter,DatatypeAdapter,KgramNodeConverter,NextDatatypeValueAdapter,SparqlAstToExpression,SparqlBuiltinFunctionNameResolver,StorageManagerKgramValues.• Introduced specialized native expression evaluators in
next.query.impl.sparql.bridge:NativeNumericExpressionEvaluator: arithmetic and numeric comparisonsNativeStringExpressionEvaluator: string operations and regex matchingNativeBooleanExpressionEvaluator: boolean logic and effective boolean value evaluationNativeTemporalExpressionEvaluator: date/time extraction and calculationsNativeIriExpressionEvaluator: IRI validations and conversionsSparqlTermResolver: resolution and conversion between AST terms and Next data model• Simplified
WhereCompiler,AstBackedExpr, andCoreseAstQueryBuilder.3. Code Quality and SonarLint Remediation
• Resolved all 309 SonarLint code smells and bugs across all 86 files in
corese-core.• Reduced cognitive complexity under the threshold (< 15) in critical engine methods (
PathFinder,Mappings,Eval,Query,Exp,BasicPatternGenerator,HeuristicsBasedEstimation).• Documented all internal KGRAM subpackages with
package-info.java.Quality and Conformance Verification
• Internal unit tests (
corese-core): 100% passing (./gradlew test).• W3C Conformance suite (
corese-w3c): 2,859 test cases evaluated againstfeature/corese-nextbaseline with exactly 0 regressions.• Architectural boundary rules (
NextModuleBoundaryTest): 100% compliant.