Repository navigation
Fixes 34953: Remove the in-process RDF reasoner - #34963
Conversation
SPARQL inference built a Jena inference model inside the OpenMetadata JVM by
copying the whole Fuseki store into the heap with CONSTRUCT { ?s ?p ?o }. With
rdf.inferenceEnabled set, every internal caller of executeSparqlQuery did the
same. Past maxInMemoryInferenceTriples a request silently returned asserted-only
results, and OWL_LITE/OWL_DL defaults never applied inference at all.
Delete InferenceEngine with the in-memory model, its cache and the triple limit.
Requests for rdfs or owl now fail with 503 and say why; custom reads the rule
graphs materialized in Fuseki and needs materializedInferenceEnabled. Internal
queries, including the complete-lineage endpoint, run against the stored graph.
GET /v1/rdf/status advertises only the levels the server can answer, and the
SPARQL console offers only those. Mark inferenceEnabled, defaultInferenceLevel,
cacheInferredTriples and maxInMemoryInferenceTriples deprecated; the server
ignores them and warns at startup when inferenceEnabled is set.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
❌ UI Checkstyle Failed❌ Bundle Runtime CheckA route chunk loads but one of its chunks still exports 🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)Errors block the build. Warnings do not yet — they are rules whose backlog is still 0 error(s), 1 warning(s) across 1 changed file(s).
All findings
Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
…lable Saved queries and templates from before this change can store rdfs/owl, and custom on servers without materialized inference. Loading one left the inference select empty and Run sent the stale level, returning 503. Derive the effective level from the levels the RDF status reports, falling back to none, and use it for the select, Run, and Save.
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Removing in-process RDF reasoning makes rdfs/owl SPARQL requests return 503 and internal queries lose inferred facts, potentially changing catalog results. Removes the in-process RDF reasoner so SPARQL inference now comes only from materialized rule graphs in Fuseki; ✅ 1 closed✅ Edge Case: Saved queries with rdfs/owl select a hidden level, and Run returns 503
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Fixes #34953
OpenMetadata answered SPARQL inference requests by copying the whole Fuseki store into the server heap (
CONSTRUCT { ?s ?p ?o }) and running a Jena reasoner over it. Withrdf.inferenceEnabledset, every internal caller ofexecuteSparqlQuerydid the same. PastmaxInMemoryInferenceTriples(100,000) requests silently returned asserted-only results, and theOWL_LITE/OWL_DLdefaults never applied inference.This PR removes that reasoner. Inference now comes only from rule graphs materialized inside Fuseki;
rdfsandowlrequests fail with 503 and say why.Type of change:
High-level design:
rdf/reasoning/InferenceEngine, and inRdfRepositorythe in-memory inference model, its cache, the 100,000-triple limit,isInferenceEnabledByDefault,getDefaultInferenceLevel,executeSparqlQueryWithInferenceandexecuteSparqlQueryWithInferenceAsJson.executeSparqlQueryalways queries the stored graph, so lineage path finding, RDF insights, centrality and community computation, ontology loading, and the MCP find-by-tag and neighborhood tools no longer inherit inference.RdfGraphService.fullLineagedrops its hard-codedcustom; its query already uses property paths.executeSparqlQueryWithInferenceResultacceptsnone, andcustomwhenRdfRepository.supportsMaterializedInferenceholds (materialized inference on Fuseki). Any other level throwsServiceUnavailableException(503) naming the levels that work. The per-rule graphs are part of Fuseki's union default graph, socustomruns the query unchanged.InferenceMaterializerreuses the same availability check.GET /v1/rdf/statusreports default levelNONEandavailableLevelsNONE, plusCUSTOMwhen materialized inference is available. The SPARQL console offers only those levels, and onlynoneif the status request fails. The MCPsparql_querydescription saysrdfsandowlfail.inferenceEnabled,defaultInferenceLevel,cacheInferredTriplesandmaxInMemoryInferenceTriplesare marked deprecated inrdfConfiguration.json(generated TypeScript regenerated) and ignored. The server logs a warning at startup wheninferenceEnabledorcacheInferredTriplesis set. Operator docs updated (docs/rdf-production-setup.md,docs/rdf-local-development.md)./v1/glossaries/{id}/sparqlendpoint still applies RDFS/OWL Mini to its SQL-built, single-glossary model. Materialized rules (/v1/rdf/rules,RdfInferenceApp) work as before.inference: rdfsorowlget 503 instead of results that were usually not inferred.customwithout materialized inference also gets 503; previously it built nine hard-coded rules over an in-memory copy. The deprecated settings are still accepted, so no migration is needed.Tests:
Use cases covered
rdfsandowlrequests return 503 with a message naming the available levels, over REST and in the repository.customwith materialized inference answers from the stored graph, including rule graphs; without it, 503.noneand internal queries never issue a whole-storeCONSTRUCTor count triples./v1/rdf/statusadvertisesNONE, plusCUSTOMonly when materialized inference is available, whatever the configured OWL defaults.nonewhen the status request fails.Unit tests
RdfInferenceGuardrailTest(rewritten),RdfGraphServiceTest(+1),RdfResourceTest(+2),SparqlInference.utils.test.ts(new),SparqlPlayground.test.tsx(+2).RdfInferenceConfigurationTestis removed with the code it covered.RdfResource8/8,RdfGraphService1/1,InferenceMaterializer1/1,RdfRepository11/16; the 5 uncovered lines are the startup warning in the production constructor, which unit tests don't construct.SparqlInference.utils.ts8/8,SparqlQueryConsole.component.tsx15/15.UI checkstyle (organize-imports, ESLint, Prettier) is clean on the changed UI files, and the repository pre-commit hooks pass.
Backend integration tests
RdfResourceIT. The triple-term JSON-LD rejection now runs withCUSTOM, the inference level the server still answers, instead ofRDFS, and a new parameterized test assertsRDFSandOWLreturn 503.GlossaryTermRelationFixesITto the planned run: it reads/v1/rdf/status, whose inference fields this PR changes.McpServiceResourceIT, which onmainis a TODO stub with no test class and so never writes a report, the same planner limitation Fixes #34394: Allow draft conflict review #34956 reports. The rdf lane used an image built locally fromdocker/rdf-storethrough-DrdfContainerImage, with the Fuseki download pointed at the dlcdn.apache.org mirror; the Dockerfile still checks the tarball's sha512.Local Java test run: FAILED
32af095e8c66(baseorigin/main)Selected but produced no report:
McpServiceResourceIT (mysql-elasticsearch · parallel)Every test skipped, so these exercised nothing (check their assumptions — usually the engine):
RdfIndexAppScaleIT (mysql-elasticsearch · rdf)Tests run locally
ConversationSchemaMigrationIT(2 passed),GlossaryOntologyExportIT(16 passed),SystemResourceIT(49 passed),UserMetricsResourceIT(7 passed)AgentSparqlResourceIT(22 passed),LodResourceIT(9 passed),RdfBatchFieldsIT(4 passed),RdfBlueGreenRebuildIT(26 passed),RdfFusekiAuthorizationIT(9 passed),RdfGlossaryGraphIT(11 passed),RdfGraphExploreIT(8 passed),RdfIndexAppScaleIT(0 passed, 1 skipped),RdfIndexRunRecoveryIT(4 passed),RdfInferenceMaterializationIT(15 passed),RdfLiveProjectionIT(3 passed),RdfLiveWriteRecoveryIT(22 passed),RdfReindexFailuresIT(13 passed),RdfReindexInsertOnlyIT(1 passed),RdfReindexRunLockIT(5 passed),RdfRelationExclusionsIT(6 passed),RdfResourceIT(15 passed),RdfRoundTripFidelityIT(6 passed),RdfSemanticSearchIT(10 passed),RdfSqlResourceIT(7 passed),RdfStorageReadinessIT(10 passed),RdfTagsTierCertificationIT(12 passed)LiveSearchSettingsChangeIT(1 passed)Per-class counts come from failsafe's reports, which can credit a test to the wrong class when classes run concurrently; the step totals above are exact.
unit · openmetadata-mcp (8 classes), openmetadata-service (39 classes): 93 classes
AgentSparqlServiceTest(18 passed),AgentSparqlTransportTest(11 passed),CentralityComputationTest(0 passed),CentralityComputationTest$EndToEnd(6 passed),CentralityComputationTest$GraphParsing(6 passed),CentralityComputationTest$PredicateWeights(1 passed),CommunityComputationTest(0 passed),CommunityComputationTest$EndToEnd(6 passed),CommunityComputationTest$GraphParsing(6 passed),CommunityComputationTest$GraphTypeParsing(3 passed),CommunityComputationTest$WellFormed(4 passed),CreateEntityToolTest(24 passed),EntityNeighborhoodToolTest(9 passed),FindByTagToolTest(9 passed),InferenceMaterializerTest(12 passed),InferenceRuleServiceTest(5 passed),JenaFusekiDatasetAdminTest(13 passed),JenaFusekiStorageTest(0 passed),JenaFusekiStorageTest$ConfigurationDefaultTests(2 passed),JenaFusekiStorageTest$DatasetRedirectionTests(6 passed),JenaFusekiStorageTest$EncodePathSegmentTests(3 passed),JenaFusekiStorageTest$EntityUpsertQueryTests(5 passed),JenaFusekiStorageTest$ExtractTaskIdTests(6 passed),JenaFusekiStorageTest$GraphTripleCountQueryTests(2 passed),JenaFusekiStorageTest$IsTaskFinishedTests(5 passed),JenaFusekiStorageTest$MaskUserInfoTests(5 passed),JenaFusekiStorageTest$MetricsParsingTests(2 passed),JenaFusekiStorageTest$ParseDatasetEndpointTests(9 passed),JenaFusekiStorageTest$PayloadGuardTests(5 passed),JenaFusekiStorageTest$RelationshipReconciliationQueryTests(1 passed),JenaFusekiStorageTest$RequestTimeoutClassificationTests(2 passed),JenaFusekiStreamingAppendTest(4 passed),LineagePathFinderTest(0 passed),LineagePathFinderTest$EndToEnd(12 passed),LineagePathFinderTest$FrontierParsing(4 passed),LineagePathFinderTest$TypesParsing(2 passed),LodResourceTest(2 passed),McpSdkUpgradeTest(20 passed),OntologyAiAvailabilityTest(3 passed),OntologyDescribeToolTest(5 passed),RdfAutoTuneTest(7 passed),RdfBatchProcessorTest(23 passed),RdfBlueGreenDatasetTest(0 passed),RdfBlueGreenDatasetTest$AlternationTests(3 passed),RdfBlueGreenDatasetTest$RepositoryRoutingTests(5 passed),RdfBulkSinkTest(9 passed),RdfCustomPropertyProjectionTest(5 passed),RdfExtensionProjectionTest(2 passed),RdfGlossaryRelationCleanupQueryTest(1 passed),RdfGlossaryTermGraphFilterTest(6 passed),RdfGraphHelpersTest(17 passed),RdfGraphServiceTest(9 passed),RdfIndexAppTest(0 passed),RdfIndexAppTest$AdmissionTests(3 passed),RdfIndexAppTest$BlueGreenLifecycleTests(5 passed),RdfIndexAppTest$EntityRelationshipConversionTests(3 passed),RdfIndexAppTest$EntitySelectionTests(5 passed),RdfIndexAppTest$InitializationTests(2 passed),RdfIndexAppTest$PromotionRatioGateTests(4 passed),RdfIndexAppTest$RunLockTests(4 passed),RdfIndexAppTest$RunRecordUpdateTests(7 passed),RdfIndexAppTest$StopFunctionalityTests(2 passed),RdfIndexAppTest$ValidationTests(1 passed),RdfInferenceGuardrailTest(9 passed),RdfInsightsServiceTest(11 passed),RdfLineageBatchingTest(5 passed),RdfLineageOntologyTest(10 passed),RdfLiveWriteTest(11 passed),RdfMutationUpdateShapeTest(3 passed),RdfParserHelpersTest(6 passed),RdfPredicatePartitionTest(3 passed),RdfPropertyMapperTest(0 passed),RdfPropertyMapperTest$AddTypedPropertyBlankString(4 passed),RdfPropertyMapperTest$ChangeDescriptionTests(2 passed),RdfPropertyMapperTest$ColumnResourceTests(9 passed),RdfPropertyMapperTest$DedicatedMapperFieldTests(2 passed),RdfPropertyMapperTest$ExtensionTests(1 passed),RdfPropertyMapperTest$GeneralPropertyMappingTests(12 passed),RdfPropertyMapperTest$LifeCycleTests(1 passed),RdfPropertyMapperTest$LineageTests(3 passed),RdfPropertyMapperTest$TestCaseResultTests(1 passed),RdfPropertyMapperTest$TranslatorManagedPredicatesTests(2 passed),RdfPropertyMapperTest$VotesTests(1 passed),RdfRelationPredicateValidationTest(35 passed),RdfRepositoryBulkChunkingTest(11 passed),RdfRepositoryProjectionHealthTest(1 passed),RdfResourceLineageQueryTest(1 passed),RdfResourceTest(21 passed),RdfSparqlServiceTest(11 passed),RdfToolGatingTest(3 passed),RdfValidationServiceTest(6 passed),ShaclValidateToolTest(8 passed),SparqlQueryToolTest(12 passed)integration · mysql-elasticsearch · parallel: 63 classes
AIApplicationResourceIT(9 passed),AIContextMcpIT(14 passed, 1 skipped),AIContextRestIT(27 passed, 2 skipped),AIFrameworkControlResourceIT(17 passed, 2 skipped),AIGovernancePolicyResourceIT(14 passed, 3 skipped),AgentExecutionResourceIT(33 passed, 5 skipped),BaseEntityIT$ListEntityHistoryByTimestampPaginationTest(185 passed, 17 skipped),ConfigResourceIT(37 passed, 8 skipped),ContextFileIT(2 passed, 1 skipped),ContextMemoryAnchorIT(5 passed, 2 skipped),ContextMemoryIT(120 passed, 13 skipped),ContextMemoryLifecycleIT(16 passed, 1 skipped),ContextMemorySourceEntityTiebreakIT(24 passed, 3 skipped),ContextMemoryStatusMigrationIT(1 passed),ConversationResourceIT(45 passed, 3 skipped),DatabaseSmokeIT(48 passed, 4 skipped),DbTuneIT(7 passed),GlossaryRdfImportIT(128 passed, 4 skipped),GlossaryTermRelationFixesIT(115 passed, 10 skipped),GlossaryTermRelationSettingsIT(25 passed),GlossaryTermRelationSettingsPermissionsIT(10 passed),GlossaryTermResourceIT(232 passed, 9 skipped),IndexingLimitsIT(5 passed, 1 skipped),IngestionPipelineAgentTypeIT(53 passed, 9 skipped),LLMModelResourceIT(6 passed, 1 skipped),LLMServiceResourceIT(22 passed, 2 skipped),McpContextMemoryVisibilityIT(19 passed, 4 skipped),McpExecutionResourceIT(17 passed),McpIntegrationIT(15 passed, 2 skipped),McpOAuthIT(18 passed),McpPermissionIT(14 passed, 1 skipped),McpSearchIT(23 passed, 5 skipped),McpServerResourceIT(1 passed),McpToolsValidationIT(12 passed),McpUserContextIT(4 passed),MetricAssetsIT(79 passed, 7 skipped),OntologyAiResourceIT(6 passed),OntologyAxiomResourceIT(4 passed),OntologyBulkIT(25 passed, 2 skipped),OntologyChangeSetIT(17 passed),OntologyEditLockResourceIT(18 passed, 2 skipped),OntologyEffectiveAttributesIT(26 passed, 3 skipped),OntologyGovernanceIT(13 passed),OntologyImpactIT(16 passed),OntologyModelingIT(12 passed, 1 skipped),OntologyPackResourceIT(19 passed, 2 skipped),OntologyPatternIT(23 passed),OntologyResourceIT(21 passed, 2 skipped),OntologyStructureIT(36 passed, 4 skipped),OntologySubsetIT(6 passed, 1 skipped),PersonaAIContextIT(7 passed),PipelineResourceIT(30 passed),PipelineServiceResourceIT(1 passed),PipelineStatusAuthorizationIT(50 passed, 7 skipped),PrometheusResourceIT(43 passed, 2 skipped),PromptTemplateResourceIT(4 passed),RdfScaleResourcesTest(2 passed, 1 skipped),SavedSparqlQueryResourceIT(3 passed),SearchIndexFieldLimitIT(241 passed, 25 skipped),SeedDataPresenceIT(12 passed, 2 skipped),SystemAlertsIT(12 passed, 1 skipped),TableResourceIT(14 passed),UserResourceIT(141 passed, 14 skipped)Why these tests
added by author: calls /v1/rdf/status, whose inference fields this PR changes←GlossaryTermRelationFixesITarea ai-mcp-context←openmetadata-mcp/src/main/java/org/openmetadata/mcp/tools/SparqlQueryTool.java,openmetadata-mcp/src/main/resources/json/data/mcp/tools.jsonarea rdf←openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfGraphService.java,openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java,openmetadata-service/src/main/java/org/openmetadata/service/rdf/inference/InferenceMaterializer.java,openmetadata-service/src/main/java/org/openmetadata/service/rdf/reasoning/InferenceEngine.java,openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.javaarea system-config←openmetadata-spec/src/main/resources/json/schema/api/configuration/rdfConfiguration.jsoncalled from entity Pipeline←openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.javacalled from entity Rdf←openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfGraphService.java,openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java,openmetadata-service/src/main/java/org/openmetadata/service/rdf/inference/InferenceMaterializer.javachanged test←openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfResourceIT.java,openmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfGraphServiceTest.java,openmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfInferenceGuardrailTest.java,openmetadata-service/src/test/java/org/openmetadata/service/resources/rdf/RdfResourceTest.javaentity Rdf←openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java,openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/RdfResource.javasmoke←code other than a test class changedImpacted, not run locally (3)
RdfCatalogScaleIT→ only with -DrdfCatalogScale=true, which no CI lane setsOntologyScaleIT→ nightly: openmetadata-nightly k8s-java-it (scale-it)PipelineOwnerIndexUIIT→ nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)Commands
mvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AgentSparqlServiceTest,AgentSparqlTransportTest,CentralityComputationTest,CommunityComputationTest,CreateEntityToolTest,EntityNeighborhoodToolTest,FindByTagToolTest,InferenceMaterializerTest,InferenceRuleServiceTest,JenaFusekiDatasetAdminTest,JenaFusekiStorageTest,JenaFusekiStreamingAppendTest,LineagePathFinderTest,LodResourceTest,McpSdkUpgradeTest,OntologyAiAvailabilityTest,OntologyDescribeToolTest,RdfAutoTuneTest,RdfBatchProcessorTest,RdfBlueGreenDatasetTest,RdfBulkSinkTest,RdfCustomPropertyProjectionTest,RdfExtensionProjectionTest,RdfGlossaryRelationCleanupQueryTest,RdfGlossaryTermGraphFilterTest,RdfGraphHelpersTest,RdfGraphServiceTest,RdfIndexAppTest,RdfInferenceGuardrailTest,RdfInsightsServiceTest,RdfLineageBatchingTest,RdfLineageOntologyTest,RdfLiveWriteTest,RdfMutationUpdateShapeTest,RdfParserHelpersTest,RdfPredicatePartitionTest,RdfPropertyMapperTest,RdfRelationPredicateValidationTest,RdfRepositoryBulkChunkingTest,RdfRepositoryProjectionHealthTest,RdfResourceLineageQueryTest,RdfResourceTest,RdfSparqlServiceTest,RdfToolGatingTest,RdfValidationServiceTest,ShaclValidateToolTest,SparqlQueryToolTest -Dsurefire.failIfNoSpecifiedTests=false mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<63 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,GlossaryOntologyExportIT,SystemResourceIT,UserMetricsResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=AgentSparqlResourceIT,LodResourceIT,RdfBatchFieldsIT,RdfBlueGreenRebuildIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGraphExploreIT,RdfIndexAppScaleIT,RdfIndexRunRecoveryIT,RdfInferenceMaterializationIT,RdfLiveProjectionIT,RdfLiveWriteRecoveryIT,RdfReindexFailuresIT,RdfReindexInsertOnlyIT,RdfReindexRunLockIT,RdfRelationExclusionsIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT,RdfSqlResourceIT,RdfStorageReadinessIT,RdfTagsTierCertificationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=LiveSearchSettingsChangeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=falseIngestion integration tests
Playwright (UI) tests
make playwright_affectedselects 31 specs (Ontology Studio, canary and smoke). None opens the SPARQL console's inference selector, and the console files are an impact-map gap. The selector is covered by the Jest tests above.Manual testing performed
No manual server or UI testing yet. Steps for a deployment with RDF on Fuseki:
POST /api/v1/rdf/sparqlwith{"query":"SELECT * WHERE { ?s ?p ?o } LIMIT 1","inference":"rdfs"}returns 503 with a message namingnoneandcustom."inference":"custom"returns 503 whenRDF_MATERIALIZED_INFERENCE_ENABLED=false, and 200 when it istrue.GET /api/v1/rdf/statusreturnsinference.availableLevels["NONE"], or["NONE","CUSTOM"]with materialized inference.UI screen recording / screenshots:
TODO: attach a short recording of the SPARQL console's inference dropdown. The PR stays in draft until it is attached.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.rdfConfiguration.jsononly gains descriptions anddeprecatedflags, so stored configurations still validate.Backward-Incompatible-Change.