Skip to content

Fixes 37755: Correct stale RDF quality and constraint facts - #37756

Merged
pmbrull merged 5 commits into
mainfrom
fix/rdf-stale-facts
Nov 16, 2026
Merged

pmbrull merged 5 commits into
mainfrom
fix/rdf-stale-facts

Conversation

@pmbrull

@pmbrull pmbrull commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Describe your changes

Fixes #37755

RDF rewrites remove obsolete profile values, constraint members and column links. Composite PK/UNIQUE constraints retain group membership without claiming each column is individually unique. Constraint references use canonical FQNs so dotted and quoted names resolve to the table column node.

Type of change

  • Bug fix

High-level design

Extend the shared ownership scope and projection walk used by differential writes, replacements, bulk reindexing and deletion. Manage their direct links even when the new projection omits them. Shared referenced columns and lineage survive cleanup.

Rollout: run RdfIndexApp with recreateIndex: true after deployment to purge already disconnected resources.

Tests

Use cases covered

Canonical identities and constraint cleanup for dotted and quoted column names; corrected and removed table/nested-column profiles; changed timestamps; constraint edits/removal; composite and single-column keys; removed columns; bulk reconciliation/deletion; preserved references and lineage.

Unit tests

113 passed across six classes, including updated RdfOwnedResourcesTest, RdfPropertyMapperTest and RdfEntityWritePlannerTest. The quoted-name regressions reproduced six failures before the fix. Per-class line coverage was not measured; broader coverage remains pending.

Backend integration tests

Updated RdfEntityDiffWriteIT: ten passed against real HTTP/TDB2 storage using openmetadata/fuseki:6.2.0-318ff87. The test lane also started MySQL, Elasticsearch and OpenMetadata from the reactor build. RdfOntologyContractTest additionally passed all 10 checks against the updated ontology comment.

The initial live run exposed canonical-literal differences in the new oracle. The oracle now reads the expected projection from a cleared Fuseki dataset and still requires exact graph equality.

Local Java test run: PASSED

  • Commit: 442e0478e170 (base origin/main)
  • Finished: 2026-11-16 07:36 UTC · 5.9 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 4 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (6 classes) 6 113 0 0 1.3 passed
integration mysql-elasticsearch · rdf 1 10 0 0 4.6 passed
  • Impacted, not run locally: 2 classes (listed in the details)
  • Details

Ingestion integration tests / Playwright / UI recording

Not applicable — backend RDF projection fix.

Manual testing performed

Ran the focused affected-test planner with RdfEntityDiffWriteIT plus RdfPredicatePartitionTest, RdfEntityDeleteLineageTest and JenaFusekiStorageTest. Tests wrote successive projections over HTTP, queried the stored graph, and verified cleanup. Exact commands and class counts are in the validation comment.

Checklist

  • Linked issue and required PR title
  • Regression tests and Java formatting
  • Self-review against REVIEW.md at 442e0478e170846ac38c03b4916953fdbc61ab43: no remaining findings
  • Decision check: amended the live-write ownership ADR and added the column uniqueness ADR.
  • Schema migrations and UI recording: not applicable

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Fixes stale RDF constraint and profile facts when entities are rewritten or deleted.

  • RDF table writes remove stale profiles and constraints.
  • Composite table keys no longer mark every member as individually unique.

pmbrull explicitly deferred removal of already disconnected resources to a recreateIndex: true rebuild; this is documented in the PR and decision record. No new actionable issues were found. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Entity write or deletion] --> B[Shared ownership scope]
  B --> C[Table constraints]
  B --> D[Table measurements]
  B --> E[Columns and nested columns]
  E --> F[Column measurements]
  B --> G[Remove obsolete owned facts]
  H[Referenced columns and separate lineage resources] --> I[Outside expanded cleanup]
Loading

Reviews (1) · Last reviewed commit: "fix(rdf): quote constrained column names" · Reviewed by Greptile

@pmbrull
pmbrull requested a review from a team as a code owner November 13, 2026 10:21
@pmbrull
pmbrull requested review from IceS2 and a balanced review from Copilot November 13, 2026 10:21
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@pmbrull

pmbrull commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Local Java test run: PASSED — details

  • Commit: 442e0478e170 (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (6 classes): JenaFusekiStorageTest (0 passed), JenaFusekiStorageTest$ConfigurationDefaultTests (2 passed), JenaFusekiStorageTest$DatasetRedirectionTests (6 passed), JenaFusekiStorageTest$EncodePathSegmentTests (3 passed), JenaFusekiStorageTest$EntityUpsertQueryTests (5 passed), JenaFusekiStorageTest$GraphTripleCountQueryTests (2 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), RdfEntityDeleteLineageTest (1 passed), RdfEntityWritePlannerTest (18 passed), RdfOwnedResourcesTest (3 passed), RdfPredicatePartitionTest (3 passed), RdfPropertyMapperTest (0 passed), RdfPropertyMapperTest$AddTypedPropertyBlankString (4 passed), RdfPropertyMapperTest$ChangeDescriptionTests (2 passed), RdfPropertyMapperTest$ColumnResourceTests (16 passed), RdfPropertyMapperTest$DedicatedMapperFieldTests (2 passed), RdfPropertyMapperTest$ExtensionTests (1 passed), RdfPropertyMapperTest$GeneralPropertyMappingTests (13 passed), RdfPropertyMapperTest$LifeCycleTests (1 passed), RdfPropertyMapperTest$LineageTests (3 passed), RdfPropertyMapperTest$TestCaseResultTests (1 passed), RdfPropertyMapperTest$TranslatorManagedPredicatesTests (2 passed), RdfPropertyMapperTest$VotesTests (1 passed)
  • integration · mysql-elasticsearch · rdf: RdfEntityDiffWriteIT (10 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Broader coverage not executed by this focused run

  • mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=JenaFusekiStorageTest,RdfEntityDeleteLineageTest,RdfEntityWritePlannerTest,RdfIndexingFieldsTest,RdfJenaBootstrapTest,RdfOwnedResourcesTest,RdfPredicatePartitionTest,RdfPropertyMapperTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<77 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=GlossaryOntologyExportIT,OntologyConcurrentHardDeleteIT -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=<37 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Why these tests
  • added by author: Verify canonical constraint column identities and cleanup over real Fuseki for dotted and quoted names ← JenaFusekiStorageTest, RdfEntityDeleteLineageTest, RdfEntityDiffWriteIT, RdfPredicatePartitionTest
Impacted, not run locally (2)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • OntologyScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=JenaFusekiStorageTest,RdfEntityDeleteLineageTest,RdfEntityWritePlannerTest,RdfOwnedResourcesTest,RdfPredicatePartitionTest,RdfPropertyMapperTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=RdfEntityDiffWriteIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

Copilot AI balanced review requested due to automatic review settings November 13, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 13, 2026 19:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@manerow manerow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The ownership change is consistent across the diff, replace, bulk and delete paths, and the Java walk and the SPARQL pattern are pinned together by assertWalkMatchesStoreScope.

A few notes, none blocking:

  • The Compatibility check failed on 11-13 (Collate build). Collate doesn't reference any of the changed classes, other open PRs pass it, and the branch is 62 commits behind main, so it looks like base skew. It needs a re-run after a rebase before merge.
  • In a live catalog, tables reach the RDF writer without profile. TableRepository.setFields has no fetcher for it, both RdfProjectionLoaders.loadEntity and the reindexer go through setFields, and addTableProfileData doesn't trigger an RDF update. So the next write of each table removes any existing measurements and writes none, and the "corrected profile at the same timestamp" case can only happen with the hand-built Table objects in the tests. This was already the case before this PR, but it means the graph will carry no profile measurements after this change.
  • om:isUnique has a new meaning, but ontology/CHANGELOG.md (line 39) still describes the old one and owl:versionInfo is unchanged. External SPARQL users would only learn about it from the ADR.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findings

Expanding RDF cleanup to constraint, profile, and column facts could remove shared catalog data if ownership boundaries are misclassified.

Corrects stale RDF quality and constraint facts by removing obsolete profile values, constraint members and column links during rewrites, and by keeping composite PK/UNIQUE group membership without marking each column as individually unique. Two review findings were resolved: the ownership change now matches the live-write ADR's stated scope, and the composite-key om:isUnique semantics change is recorded as a graph contract. No open issues remain.

✅ 2 closed
✅ Quality: Ownership change contradicts the Accepted live-write ADR's stated scope

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfOwnedResources.java:53-65 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfOwnedResources.java:108-115 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java:174-176
ADR:2026-11-03-live-rdf-entity-writes-send-only-the-changed-triples is Accepted. Its Consequences section says table constraints and profile measurements are "resources a projection emits but its entity does not own" and that they "keep their stale triples", with cleanup left as a follow-up. This PR does that follow-up. ownedTriplesPattern() and ownedSubjects() now treat om:hasConstraint targets and dqv:hasQualityMeasurement targets (on the entity and on every nested column) as owned. hasColumn, hasConstraint and hasQualityMeasurement also join TRANSLATOR_MANAGED_DIRECT_PREDICATES. As written, the record now describes a write scope that no longer exists, and its guard tests (RdfOwnedResourcesTest, RdfEntityWritePlannerTest, RdfEntityDiffWriteIT) check behavior the record says is out of scope.

Fix: revise that record (add a revision line), or add a record that supersedes it and update the old record's Status. The rule to record: "An entity write owns the entity's table constraints and the quality measurements of the entity and of each of its columns, nested ones included. It deletes them along with their om:hasColumn / om:hasConstraint / dqv:hasQualityMeasurement links, even when the new projection omits them. Referred columns in other tables are not owned." This comes from the description's "Direct links are managed even when the new projection omits them" and "Shared referenced columns and lineage survive cleanup".

✅ Quality: Composite-key om:isUnique semantics change is a graph contract, unrecorded

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java:1382-1385
emitTableConstraints now writes om:isUnique true only for single-column PRIMARY_KEY/UNIQUE constraints. Before, every member of a composite PRIMARY_KEY got it. This changes what om:isUnique means in the graph, which any SPARQL consumer has to agree with: a query for ?c om:isUnique true stops returning composite-PK members after the next write or reindex. The rule appears only in the PR description ("Composite PK/UNIQUE constraints keep group membership without claiming each column is individually unique"), and the repository squash-merges, so it will not reach the tree. No record in docs/decisions/ states it, and the ontology entry for om:isUnique has only a label.

Fix: record the rule "om:isUnique true on a column means the column alone is unique: a column-level PRIMARY_KEY/UNIQUE or a single-column table constraint. Composite-key membership is expressed only through om:hasConstrainedColumn on the constraint resource." It is also worth adding that as the rdfs:comment on om:isUnique.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@pmbrull
pmbrull merged commit 52289c0 into main Nov 16, 2026
61 of 62 checks passed
@pmbrull
pmbrull deleted the fix/rdf-stale-facts branch November 16, 2026 11:25
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.

RDF rewrites retain obsolete profile and constraint facts

3 participants