Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# RDF import preserves governed predicates and validates inverse components before registration

- **Status:** Accepted
- **Revisions:** v1 2026-11-18 (initial); v2 2026-11-18 (validate before wiring; re-read a partner after a lost version comparison)
- **Deciders:** OpenMetadata maintainers
- **Guard:** GlossaryRdfImporterTest#collectRelationTypesRegistersOnePredicateOnceAcrossEdgeAndInverseSlots; GlossaryRdfImportIT#importReusesTheGovernedNameOfAnAuthoredPredicate; GlossaryRdfImportIT#importSkipsInvalidInversePairWithoutSavingEitherHalf; GlossaryRdfImportIT#importDoesNotRejectAValidPairForAnUnwiredInvalidDeclaration; GlossaryRdfImportConcurrencyIT
- **Related:** #38042, #38069, #38147; ADR:2026-11-18-rdf-import-symmetric-inverse-partners-stay-unlinked

## Context

A predicate can already have a governed name different from its IRI local name, or appear in multiple slots of one import. Saving definitions individually before validating their partners can leave a half-saved pair. When a partner declares no inverse, it pairs with the first property, in IRI order, that declares it as an inverse, so an invalid property could claim it ahead of a valid one. Existing definitions may also change while the import is planned.

## Decision

Use RDF predicate identity for both authored edges and inverse targets. Reuse the governing registry type or an already planned type with that predicate; do not create an alias from another local name. Edges use the resolved governed name.

Validate every new definition before wiring inverse pairs, in real imports and dry runs alike. A definition that fails is skipped with a message naming it, and so is any new definition whose own `owl:inverseOf` declaration names a skipped one. A skipped definition's declaration does not claim a partner that declares nothing: that partner pairs with the next valid claimer, or with none. After wiring, the definitions are validated again; a failure there skips every new member wired to the failing one and cancels their pending existing-partner updates. Other valid definitions can import. The import returns HTTP 200 with skips and accurate counts rather than failing the whole import with HTTP 400.

Refresh existing partners before publishing new types, and again before completing a partner. Complete it with EntityRepository.updateIfCurrent on an unchanged original and a copy, so a stale update cannot overwrite a newer version. When the version comparison fails, re-read the partner once. If it now points at the new type, the pair is complete. If it is still unclaimed (only an unrelated edit happened), retry the conditional write once. If another type has claimed it, or it changes again, keep that edit and clear the new type's inverse before adding its edges. A partner-completion validation failure likewise clears the new inverse and reports the skipped update.

## Consequences

Governed identities and definitions survive import, and an invalid definition cannot take down a valid pair that it merely claims. Two imports that make the same claim at once both end with a consistent pair, and an unrelated concurrent edit does not drop it. This is not a transaction over all definitions. A same-user PATCH consolidated in-session can keep its version, so the version comparison does not detect that edit; such an edit can still be overwritten. Previously stored definitions are not deleted when an imported component is rejected. No migration or schema change is required.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Symmetric RDF inverse partners remain separate relationship types

- **Status:** Accepted
- **Revisions:** v1 2026-11-18 (initial)
- **Deciders:** OpenMetadata maintainers
- **Guard:** GlossaryRdfImportIT#importKeepsNamedPartnerEdgesWhenInverseIsSymmetric and GlossaryRdfImporterTest#symmetricPropertyKeepsSelfInverseEvenWhenNamedInverseIsDeclared
- **Related:** #38042, #38069, #38147; ADR:2026-10-21-native-relations-instantiate-registry-relationship-types

## Context

For symmetric A, `A owl:inverseOf B` implies that A and B have the same extension in OWL. OpenMetadata preserves the authored relationship type as a governed registry identity. Linking B to self-inverse A makes UUID canonicalization return A for some edges authored as B.

## Decision

Glossary RDF import keeps every explicitly symmetric type self-inverse. When only A is declared symmetric, B remains a separate registered type with no inverse; the importer neither marks B symmetric nor aliases its identity to A. Edges authored as B therefore read as B from both ends. This expected shape produces no conflict message. Previously imported relationship definitions are not rewritten.

## Consequences

Both authored predicate names remain stable across UUID orderings without inventing a new symmetry characteristic or replacing a governed type. This chooses identity preservation over materializing OWL equivalence as a registry alias. A future equivalence/alias model would need an explicit representation before this decision can change.
Loading
Loading