Skip to content

Fixes #37352: Skip and report what the native model cannot hold when importing real-world RDF - #37360

Merged
harshach merged 9 commits into
mainfrom
harshach/ontology-library/1-real-world-rdf-import
Nov 8, 2026
Merged

harshach merged 9 commits into
mainfrom
harshach/ontology-library/1-real-world-rdf-import

Conversation

@harshach

@harshach harshach commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #37352

The native RDF importer failed the whole import on the first statement it could not represent, which rejected every upstream OWL or RDFS ontology we tried. It now reads what the native model holds and returns a typed, deterministic report of what it left out, grouped by reason and predicate with a bounded sample of subjects. The import preview shows an "N statements skipped" disclosure.

Part 1 of 6 of the Ontology Library work: real-world RDF, a resumable install job, 50,000-member ontologies, property hierarchies, verbatim upstream packs, and serving large releases from Fuseki. Merge from the bottom; this PR targets main, and each PR above it targets the PR below it, so its diff shows only its own changes. PRs 5 and 6 both target PR 4 and do not depend on each other.

PR Issue
1 #37360 Skip and report what RDF import cannot hold #37352 ← this PR
2 #37361 Library packs install as a resumable job #37353
3 #37362 50,000-member ontologies #37354
4 #37363 Property hierarchies (superProperties) #37355
5 #37364 Verbatim pinned upstream library packs #37356 on 4, sibling of 6
6 #37368 Serve large ontology releases from Fuseki #37367 on 4, sibling of 5

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

High-level design:

  • NativeOntologyRdfReader is extracted from NativeOntologyRdfImporter. RdfSourceNormalizer picks one language per literal (untagged, then en, then the first tag) and one value for single-valued fields before reading. RdfSkipLedger builds the skipped-statement report.
  • rdfs:Class and rdf:Property are read. Common annotations, owl:imports, and individuals that are neither classes nor concepts are skipped and reported. A native export keeps its individuals, so re-importing it reports zero skipped.
  • schema:domainIncludes and rangeIncludes are skipped, because native domain and range lists are intersections and a union cannot be stored faithfully. Data assertions whose literal datatype OWL 2 cannot hold are skipped instead of failing on apply.
  • Blank nodes no other leftover reaches are skipped before the ones inside a structure, so the skipped total of a blank-node list is a property of the data, not of parse order. Multi-valued statements are read in a fixed order, so a property's domain list is the same whether a pack is read module by module or as one body.
  • The preview validates new and changed properties and axioms with the checks a save runs, against the target as the surviving plan would leave it, and repeats until nothing more is refused. A refusal cascades to whatever names the refused definition, and refused definitions are listed as skipped with the reason apply would give. This fixed applying the W3C ORG ontology, whose org:hasMember ranges over the undeclared foaf:Agent.
  • A library plan comparison drops empty owners lists from both sides, because storage adds one; installing SSN after SOSA failed with 412 before.
  • NativeOntologyImportSummary gains skippedStatements (additive, optional).

Decision record: ADR:2026-10-19-native-ontology-imports-use-working-drafts, amendment v9 (RDF import skips and reports what the native model cannot hold).

Tests:

CI follow-up (2026-11-08)

Fixed the inherited Test Report failure. Pipeline encryption already uses the pipeline UUID, but the DBT unit fixture omitted it and secret ownership inventory still used the name. The fixture now has a stable UUID, inventory uses the same UUID root as encryption, and the existing API tests check UUID paths, including delayed cleanup after deletion and recreation.

The original unit test reproduced the encryption error. With only the fixture corrected, it failed because cleanup retained the owned authorization token. The production fix then passed all focused checks on this PR's branch:

  • Unit tests: 68 passed, 0 failures/errors/skips across SecretMapEntriesExternalStoreTest, AWSSSMSecretsManagerTest, AWSSecretsManagerTest, and EntityRepositorySecretStorageTest.
  • API integration tests: 32 passed, 0 failures/errors/skips in SecretsManagerNullSecretIT, using the MySQL + Elasticsearch parallel lane. These cover header removal, direct/cascade deletion, user-owned references, and delayed cleanup preserving replacement credentials.
  • mvn spotless:apply spotless:check, impact-map validation, and commit hooks passed. Independent review of the three-file follow-up found no issues.
  • Ran the unit and integration selections together with mvn -nsu -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=SecretsManagerNullSecretIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=AWSSSMSecretsManagerTest,AWSSecretsManagerTest,EntityRepositorySecretStorageTest,SecretMapEntriesExternalStoreTest -Dsurefire.failIfNoSpecifiedTests=false.
  • Full-suite coverage and PostgreSQL/OpenSearch were not rerun for this follow-up.

Use cases covered

  • Each of nine upstream ontologies (DCAT 3, PROV-O, ORG, OWL-Time, SOSA, SSN, ODRL, FOAF, SKOS) previews and applies into a fresh ontology, and SSN applies after SOSA in one ontology.
  • The same bytes give the same skipped report when statements are shuffled or lists are skipped from any cell.
  • A refused property refuses the restriction axiom that names it.
  • The preview shows the skipped-statement disclosure.

Unit tests

  • Added or updated: UpstreamOntologyImportTest (new), NativeOntologyImportProfileCascadeTest (new), NativeOntologyRdfImporterTest, NativeOntologyImportItemsTest, NativeOntologyImportListRulesTest, OntologyPackInstallationsTest; Jest OntologyNativeImportPanel.test.tsx.
  • OntologyPropertyRules, NativeOntologyRdfReader, OntologyExpressionRdfReader, RdfSkipLedger and RdfSourceNormalizer have no class-named unit test; they are exercised through NativeOntologyRdfImporterTest and UpstreamOntologyImportTest, which read real upstream files through them.
  • Coverage %: not measured for this PR.

Backend integration tests

  • NativeOntologyUpstreamApplyIT (new), NativeOntologyImportPreviewIT, NativeOntologyImportReviewIT (updated).

This PR's focused checks (make java_affected ARGS="--scope focused"): unit NativeOntologyImportItemsTest, NativeOntologyImportListRulesTest, NativeOntologyImportProfileCascadeTest, NativeOntologyRdfImporterTest, OntologyPackInstallationsTest, OntologyStructureValidatorTest, UpstreamOntologyImportTest; ITs NativeOntologyImportPreviewIT, NativeOntologyImportReviewIT, NativeOntologyUpstreamApplyIT. All are in the runs below and passed.

Run by hand on the top of the stack (PR 5 at 78c3b7308a6, rebased on main at 3aaedcaaf87), which contains this PR's changes; Java 21, MySQL + Elasticsearch, clean build of the reactor (mvn clean install -DskipTests -pl openmetadata-integration-tests -am, BUILD SUCCESS). Not generated by make java_affected_run.

  • Unit (openmetadata-service, every test under ontology/, rdf/, resources/ontology/, jdbi3/Ontology*, jdbi3/JobDAOTest, jobs/): Tests run: 2483, Failures: 0, Errors: 0, Skipped: 0.
  • ITs, parallel lane (-Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test='Independent*Ontology*IT,NativeOntology*IT,OntologyPackResourceIT'): Tests run: 535, Failures: 1, Errors: 0, Skipped: 38. The one failure is NativeOntologyPartialImportIT.droppingTheRelationshipWithItsConceptOrKeepingEverythingApplies, a test this stack does not touch: it filters ontologyAxioms by ontology, which the endpoint ignores (it takes ontologyId), so it reads the first 50 axioms of the whole database and misses its own when parallel tests have written more. Rerun alone with IndependentOntologyReleaseIT: Tests run: 19, Failures: 0, Errors: 0, Skipped: 0. MySQL logged 36 EntityRelationshipDAO.batchDeleteTo deadlocks during cleanup in that run; none failed a test (MySQL deadlocks between concurrent writes to different native ontologies (incomingInverses FOR UPDATE, batchDeleteTo) #37357).
  • ITs, rdf lane (-DintegrationTests.lane=rdf -DrdfContainerImage=openmetadata/fuseki:6.2.0-318ff87, RdfRoundTripFidelityIT,RdfOntologyActivationIT,RdfBlueGreenRebuildIT,RdfLibraryPackActivationIT,RdfOntologyPropertyHierarchyIT): Tests run: 48, Failures: 0, Errors: 0, Skipped: 0.
  • python3 .github/scripts/plan_local_java_tests.py --check-branch: the map is complete on this branch. mvn spotless:check: BUILD SUCCESS.
  • Not run: PostgreSQL + OpenSearch, and the rest of the full plan (make java_affected selects the full IT suite for this stack); those run in the merge queue.
  • UI (top of stack): Jest src/components/governance/ontology src/components/OntologyExplorer src/hooks/governance/ontology: Test Suites: 141 passed, 141 total; Tests: 1596 passed, 1596 total. tsc --noEmit: no errors except the existing CustomPropertiesDetailPage.tsx(135,14) error on main. yarn ui-checkstyle:changed and yarn ui-checkstyle:playwright:changed on every UI file the stack changes: exit 0, no diff.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • No spec changes in this PR. The ontology specs changed later in the stack were not run locally (PR CI does not run Playwright; the merge queue does).

Manual testing performed

None beyond the automated tests above.

UI screen recording:

Not done. This PR changes Ontology Studio UI (the native import preview's skipped-statements disclosure), so the pr-checklist recording item applies. No Docker build with sample data was run and no recording is attached; the matching checklist box below is left unchecked. The UI evidence is the Jest, type-check and UI checkstyle runs listed under Tests.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. nativeOntologyImportSummary gains an optional skippedStatements; it is a response type, so no migration.
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). Not done, see "UI screen recording" above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    Reviewed 70bdf0622e6 against REVIEW.md as a pass over this PR's production diff (authorization on new or changed endpoints, transactions and retries, caches, job types, schema compatibility, and the test map). It was run by the agent that prepared the stack; no independent reviewer was available for this run. No 🔴 findings.
  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This description is gone from git log after the squash-merge. Amends ADR:2026-10-19-native-ontology-imports-use-working-drafts (v9).

Summary by Gitar

  • Secrets:
    • Pipeline secret inventory now keyed by pipeline UUID instead of name in SecretsManager

This will update automatically on new commits.

…-world RDF

The native RDF importer failed the whole import on the first statement it could not
represent, which rejected every upstream OWL/RDFS ontology we tried. It now reads what the
native model holds and returns a typed, deterministic report of everything it left out,
grouped by reason and predicate with a bounded sample of subjects.

- NativeOntologyRdfReader is extracted from the importer; RdfSourceNormalizer picks one
  language (untagged, then en, then the first tag) and one value for single-valued fields
  before reading; RdfSkipLedger builds the report.
- rdfs:Class and rdf:Property are read; common annotations, owl:imports, and individuals
  that are neither classes nor concepts are skipped and reported. Native exports keep their
  individuals, so a re-import reports zero skipped.
- schema:domainIncludes and rangeIncludes are skipped: native domain and range lists are
  intersections, so a union cannot be stored faithfully.
- NativeOntologyImportSummary gains skippedStatements; the preview shows an
  N statements skipped disclosure.
- Nine upstream ontologies are bundled as test resources with expected counts.
- ADR 2026-10-19 replaces strict parsing with the skip-and-report contract.
…depend on parse order

The skipped-statement count for a blank-node list or restriction depended on which cell
of the list was skipped first, so reading the same bytes reported different totals. Blank
nodes no other leftover reaches are now skipped before the ones inside a structure, which
makes the count a property of the data. Only nodes inside a blank-node cycle still follow
statement order.

Tests read a list-heavy source repeatedly and read three upstream ontologies with their
statements shuffled, expecting identical documents and skip reports.
…he stored one

Storage adds an empty owners list to a stored property, so the plan rebuilt at install
time differed from the stored plan and installing ssn after sosa failed with 412. The
comparison now drops empty owners lists from both sides.
Previewing the W3C ORG ontology listed 51 operations and applying them failed with
"Declare or import the referenced property: org#hasMember". The property's range is
foaf:Agent, which ORG never declares, so the preview refused the property; the restriction
axiom that names it was checked before that and stayed in the plan.

The preview now validates the new and changed properties and axioms with the checks a save
runs, against the target as the surviving plan would leave it, and repeats until nothing
more is refused, so a refusal cascades to whatever names the refused definition. Refused
definitions are listed as skipped with the reason apply would give.

NativeOntologyUpstreamApplyIT previews and applies each of the nine upstream fixtures into a
fresh ontology, and SOSA then SSN into one ontology. The v9 amendment records the rule.
…nge shapes the importer skips

Statements read back in the graph's hash order, so a property's domain list
differed between a pack read module by module and the same pack read as one
body. An install job re-derives its plan on resume, so the order must not
depend on how the model was built.

FHIR R5 date and gYear unions and FIBO custom datatypes are refused by a save.
The preview cascade already skips the restrictions over them; the test keeps it so.
@harshach
harshach requested review from a team as code owners November 8, 2026 04:55
@harshach harshach added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs backend labels Nov 8, 2026
@harshach
harshach requested review from harsh-vador and a balanced review from Copilot November 8, 2026 04:55
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

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.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

❌ UI Checkstyle Failed

❌ Bundle Runtime Check

A route chunk loads but one of its chunks still exports undefined: a chunking change broke module initialisation. Run yarn build && yarn bundle:runtime locally.

🔍 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
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 openmetadata-imports/review-sequential-api-calls
All findings
Location Rule Message
🟡 src/components/governance/ontology/OntologyReleaseExportModal/OntologyNativeImportPanel.utils.ts:534:21 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.72% (142145/173923) 69.22% (52109/75272) 72.18% (29159/40394)

Copilot AI balanced review requested due to automatic review settings November 8, 2026 18:11

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 8, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Changing RDF imports to accept partial ontologies while skipping unsupported statements could leave important definitions absent despite a successful import.

Imports of real-world OWL/RDFS ontologies now skip and report the statements the native model cannot hold, instead of failing the whole import, and the import preview shows a skipped-statements disclosure. No issues found.

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 8, 2026

Copy link
Copy Markdown

@harshach
harshach added this pull request to stack #37370 November 8, 2026 19:09
@harshach
harshach removed this pull request from stack #37370 November 8, 2026 19:34
@harshach
harshach merged commit 6cb5db4 into main Nov 8, 2026
73 of 76 checks passed
anuj-kumary added a commit that referenced this pull request Nov 9, 2026
…review spec (#37390)

* test(playwright): expect a skipped xsd:date range in the ontology import preview

#37360 changed the native RDF importer to skip and report statements the
model cannot hold instead of failing the preview. The import review spec
still expected the old error alert, so it failed on every nightly AUT run.
Assert the skipped-statements disclosure and that the rest applies.

* chore(playwright): auto-refresh impact-map.generated.json

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native RDF import rejects real-world ontologies on the first statement it cannot hold

2 participants