Skip to content

Fixes #37356: Ship verbatim pinned upstream ontologies as library packs - #37364

Merged
harshach merged 28 commits into
harshach/ontology-library/1-real-world-rdf-importfrom
harshach/ontology-library/5-upstream-packs
Nov 9, 2026
Merged

harshach merged 28 commits into
harshach/ontology-library/1-real-world-rdf-importfrom
harshach/ontology-library/5-upstream-packs

Conversation

@harshach

@harshach harshach commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #37356

The six hand-written library packs (FIBO, FHIR, GS1 and the other starters) were four- to ten-concept SKOS sketches under IRIs we invented. This PR replaces them with 16 packs: 14 verbatim, pinned upstream ontologies with their publishers' IRIs, and ISA-95 and HR Open kept as outlines that say they are OpenMetadata-authored. scripts/ontology-packs/generate.py is the only writer of the payloads, manifests, catalogue index, payload README and the generated block of NOTICE, and make ontology-packs-check verifies all of it offline. Every pack previews, samples and installs through the install job from PR 2, so the per-pack background install mode is gone.

Part 5 of 6 of the Ontology Library work. Merge from the bottom; this PR targets the PR below it, and its diff shows only its own changes.

PR Issue
1 #37360 Skip and report what RDF import cannot hold #37352
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 · ← this PR
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:

  • scripts/ontology-packs/sources.json holds one entry per pack: publisher, version, pinned URL, sourceSha256, license and license URL, attribution, industry, layer and modules. generate.py (Python standard library only) downloads a payload only when the checked-in file does not match its pinned hash, so a second run changes nothing, and --check verifies everything offline. A license outside allowedLicenses fails the run.
  • The catalogue reads the generated json/data/ontology/packs/index.json instead of a hard-coded list. A missing index, or a missing, malformed or misnamed manifest, stops the server at startup.
  • Manifests gain publisher, attribution and, for converted modules, sourceSha256; industries gain cross-industry and buildings-and-energy. The Library shows each pack's publisher and attribution.
  • installMode is removed from the manifest, the generator, the UI and the ADR: a pack of any size previews and samples with the trusted parser and the unbounded importer path, and installs through the job. The review lists at most 5,000 items. A library release counts the ontology root.
Pack Publisher Version License
DCAT 3 W3C 3 CC BY 4.0
PROV-O W3C 2013-04-30 W3C Software and Document License
W3C Organization Ontology W3C 0.8 Open Data Commons PDDL 1.0
OWL-Time W3C and OGC 2017-04-06 CC BY 4.0
SOSA and SSN W3C and OGC 2017-10-19 W3C Software and Document License or OGC Software License
ODRL 2.2 W3C 2.2 W3C Document License
FOAF Dan Brickley and Libby Miller 0.99 CC BY 1.0
Data Privacy Vocabulary W3C DPVCG 2.3 W3C Software and Document License
GS1 Web Vocabulary GS1 1.18 Apache License 2.0
FIBO EDM Council and OMG 2026Q2 MIT
HL7 FHIR R5 HL7 International 5.0.0 CC0 1.0
Brick Schema Brick Consortium 1.4.2 BSD-3-Clause
Industrial Ontologies Foundry (IOF) IOF Release_202603 MIT; BFO module CC BY 4.0
GS1 EPCIS 2.0 and CBV GS1 2.0.1 No license statement published by GS1; included pending confirmation
ISA-95 Starter (OpenMetadata-authored) OpenMetadata 2025Q1-om1 Apache License 2.0
HR Open Starter (OpenMetadata-authored) OpenMetadata 2025Q1-om1 Apache License 2.0
  • GS1 EPCIS and CBV carry no license statement. GS1 publishes both files openly at ref.gs1.org with no license statement and no terms that grant or refuse redistribution. They are included pending GS1 confirmation; the ADR records how to remove the pack in a release if GS1 asks.
  • IOF modules are converted to Turtle at build time. BFO, the IOF annotation vocabulary and every Released IOF module open with an XML DOCTYPE that declares entities, which the XXE guard in SafeRdfModelParser refuses on every path, parseTrusted included. The guard is unchanged. Instead, a module that declares "convert": "turtle" is downloaded, checked against its pinned source hash, converted with rdflib, proved isomorphic to the source graph (same triple count and rdflib graph isomorphism), and written as sorted Turtle with module-unique blank-node labels, so a rerun is byte-identical. sources.json records both the source and the payload hash. rdflib is needed only when a conversion runs; --check stays standard-library only. The IOF pack is pinned to commit 0c5af080dba16489db1b5c7a432a34222524c6e9 (tag Release_202603) and holds 19 modules: BFO, the annotation vocabulary, Core, Supply Chain, Maintenance, Certification and the 13 biopharma modules of IOF's production release.
  • Not bundled, with the reason recorded in sources.json: schema.org (CC BY-SA 3.0), DCMI Terms (license unconfirmed), ETSI SAREF (license text unavailable), QUDT (not evaluated), and official ISA-95 and HR Open ontologies (none openly available).
  • Size: the bundled RDF under openmetadata-spec/src/main/resources/rdf/ontology-packs/ is 24.3 MB uncompressed (measured), of which IOF is 5.4 MB, FIBO 8.3 MB and FHIR 6.0 MB. The ADR's "about 18 MB" predates the IOF modules.
  • The last two commits fix tests this branch had left failing: two library Jest cases referenced a fixture the install-job PR removed, and IOF joins the packs too large for one interactive import in OntologyPackInstallationsTest.

Decision record: ADR:2026-11-06-ontology-library-packs-are-verbatim-pinned-upstream-releases (new, v1 to v4).

Tests:

Use cases covered

  • make ontology-packs-check verifies all 16 packs, the index and NOTICE against sources.json.
  • Every bundled pack previews (BundledOntologyPackImportTest) and installs through the job into a fresh ontology, and installing it again changes nothing (NativeOntologyEveryPackInstallIT).
  • FIBO and FHIR capture as a release and activate in Fuseki (RdfLibraryPackActivationIT).
  • The catalogue fails fast on a missing or inconsistent manifest.
  • The Library lists cross-industry packs under their own filter, shows the attribution, and offers Install for a pack of any size.

Unit tests

  • Added or updated: BundledOntologyPackImportTest (new), OntologyPackCatalogTest, OntologyPackContentLoaderTest, OntologyPackInstallationsTest, OntologyPackInstallerTest, OntologyPackModelsTest, OntologyPackSamplerTest, OntologyPackVerifierTest, NativeOntologyRdfImporterTest; Jest OntologyLibrary.native.test.tsx, OntologyLibrary.test.tsx.
  • OntologyResource has no class-named unit test; its library endpoints are covered by OntologyPackResourceIT and NativeOntologyLibraryPreviewIT.
  • Coverage %: not measured for this PR.

Backend integration tests

  • NativeOntologyEveryPackInstallIT (new), RdfLibraryPackActivationIT (new, rdf lane), NativeOntologyCapacityPerfIT, NativeOntologyImportReviewIT, NativeOntologyLibraryPreviewIT, NativeOntologyPackInstallJobIT, NativeOntologyPackInstallStateIT, OntologyPackResourceIT (updated).

This PR's focused checks: unit BundledOntologyPackImportTest, NativeOntologyRdfImporterTest, OntologyPackCatalogTest, OntologyPackContentLoaderTest, OntologyPackInstallationsTest, OntologyPackInstallerTest, OntologyPackModelsTest, OntologyPackSamplerTest, OntologyPackVerifierTest; ITs NativeOntologyCapacityPerfIT, NativeOntologyEveryPackInstallIT, NativeOntologyImportReviewIT, NativeOntologyLibraryPreviewIT, NativeOntologyPackInstallJobIT, NativeOntologyPackInstallStateIT, OntologyPackResourceIT, RdfLibraryPackActivationIT (rdf lane). All passed in the runs below. make ontology-packs-check: ontology packs: 16 packs match sources.json.

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

  • Updated for the new packs: OntologyFirstRun.spec.ts, OntologyLibraryRdf.spec.ts, OntologyNativeImportReview.spec.ts, OntologyNativeLibrary.spec.ts, OntologyNativeOperations.spec.ts, OntologyRbacRdf.spec.ts. Not run locally (PR CI does not run Playwright; the merge queue does); yarn ui-checkstyle:playwright:changed passes on them.

Manual testing performed

None beyond the automated tests above.

UI screen recording:

Not done. This PR changes Ontology Studio UI (the Ontology Library catalogue, filters and pack attribution), 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. Manifest and module schemas gain optional fields and lose installMode; manifests are bundled resources, not stored rows, 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 78c3b7308a6 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. 🔴 fixed: two Jest cases referenced a fixture PR 2 removed (type check failed), and OntologyPackInstallationsTest failed once IOF was added (last two commits).
  • 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. Adds ADR:2026-11-06-ontology-library-packs-are-verbatim-pinned-upstream-releases.

Adds the ONTOLOGY_PACK_INSTALL job: it parses the verified bundled modules once, reconciles once, orders concepts, properties then axioms, and applies change sets of at most 1,000 members through the regular change-set path. Each slice carries a plan digest that replaces the per-apply full re-parse. Adds install, status and cancel endpoints, parseTrusted for checksum-verified bundled content, and named write-closure limits.
The native library detail starts the install job, polls it every second, shows slices and definitions applied, offers cancel, and resumes by starting a new job on retry. Adds generated types and translated strings for all locales.
…nd install the real GS1 vocabulary in an IT

A slice is validated alone, so a replacement, inverse, property chain or disjoint property
that names a definition in a later slice failed the install. Slicing now orders concepts and
properties so each follows what it names, keeps mutually referencing definitions in one slice,
and breaks ties by IRI.

Starting an install checks for an active job and inserts under a lock on the ontology row, so
concurrent starts queue one job. A slice the database rolled back as a deadlock victim is
applied again.

The importer skips an asserted literal whose datatype OWL 2 does not support instead of
emitting an axiom that applying refuses.
The reference digests were recorded from an incremental build, where
jsonschema2pojo regenerated OntologyConcept and OntologyChangeOperation
without the defaults their referenced enum schemas declare (conceptType
BOTH, provider user, state ACTIVE). A clean build, which CI runs,
serializes those defaults, so the test failed there.
…ed release reads and unlocked draft reads

The FHIR R5 vocabulary plans 16,407 members and the FIBO quickstart 10,115, so the 10,000
member cap kept both out of one ontology. A release now holds up to 50,000 members and 256 MiB
of payload; a member stays at 1 MiB.

Capture inserts members in JDBI batches of 500 through the same sealedAt guard, so a release
sealed meanwhile still fails the capture with 412. Working and release reads page 1,000 per
query. OntologyReleaseReader keeps verified member lists of sealed releases in a Caffeine cache
bounded to 128 MiB of payload and 10 minutes idle, keyed by release id and digest, and still
authorizes every member on a hit. Read-only draft callers (working diff, validation, import
preview, draft export, draft SPARQL, the install job's reconcile) read without the
ontology_state FOR UPDATE lock, re-check the working and activation revisions by value at the
end, start over on a torn read and fail with 412 after three. On MySQL the unlocked path skips
the INSERT ... ON DUPLICATE KEY initializer for an existing row, which held an exclusive lock
until the transaction ended.

A whole-graph journal entry is bounded by GraphReplace.MAX_GRAPH_BYTES, 64 MiB, the Fuseki
extension's default upload limit, while per-entity writes keep 16 MiB. An import preview lists
at most 5,000 items, ALREADY_EXISTS ones first to go, and reports omittedItems.

NativeOntologyCapacityPerfIT measures every whole-ontology path at a configurable size and
shape, and installs the upstream FHIR and FIBO files when their paths are given. On MySQL at
10,000 FHIR-shaped members: install 76 s to 60 s, working diff 5.6 s to 0.7 s, concept create
during a diff 7.2 s to 17 ms, import preview 6.1 s to 1.0 s, capture 10.3 s to 2.4 s, release
diff 982 ms to 118 ms, draft SPARQL 1.1 s to 0.26 s. At 35,000: install 223 s in 35 slices,
capture 11.9 s, projection 58.4 MB of RDF-Thrift.
…preview leaves items unlisted

useOntologyStudioModel allowed ten pages of 1,000 per kind, the server's old release cap, and
threw past that. It now mirrors the 50,000 member cap. The native import panel shows how many
already-existing definitions the server left out of a preview listing.
Amends the release, Fuseki, Studio and import records with the limits this change sets and the
numbers that justify them, notes the Fuseki upload bound in the production setup guide, fixes
the stale copy in the design plan, and registers the new tests in the Java impact map.
… pass it through the pack review

A preview whose every definition already exists lists no items, so the
import panel and the pack review dropped the server's omittedItems count
along with the empty list. Render the review whenever items are listed or
some were omitted, and hide the 'found' line when there is nothing to
count.
OntologyProperty gains superProperties, the set of rdfs:subPropertyOf
links to named properties. The reference index gets a SUPER_PROPERTY
role, profile validation a SUBPROPERTY_CYCLE code, and the import
report an UNDECLARED_REFERENCE skip reason for links the importer drops.
The om:superProperties predicate is declared in the RDF vocabulary, and
the TypeScript types are regenerated from the schemas.
A property names its superproperties in superProperties
(ADR:2026-11-07-ontology-property-hierarchies-are-superproperty-fields).
Each must be a declared property of the same kind or a vocabulary
property of that kind, never the property itself, and the links cannot
form a cycle. Profile validation applies the OWL 2 DL simplicity rule
through the hierarchy, so a composite property makes every property
above it non-simple, and checks chain regularity against it. The write
closure loads ancestors and subproperties, the reference index and
release diff read the field, the RDF export writes rdfs:subPropertyOf,
the CSV format gains a 28th column, and a library install orders a
subproperty after its superproperties.

RDF import keeps rdfs:subPropertyOf between declared properties of the
same kind. Each refusal pass drops links to undeclared properties
(UNDECLARED_REFERENCE), to properties of another kind and the links on
a cycle (UNSUPPORTED_STRUCTURE), and keeps the property. Measured as links in
the planned import, FIBO keeps 787 of 799, schema.org 210 of 212 and
FHIR R5 none of 274, which all name the external W5 vocabulary. GS1
keeps 1 of 92, because import already refuses its 61 link-type
properties for their xsd:anyURI range and 30 links name schema.org.
The property editor offers a superproperty picker that lists the
ontology's properties of the same kind, never the property itself, and
sends the picked IRIs as superProperties. The import report names the
new UNDECLARED_REFERENCE skip reason, every locale translates the two
new labels, and the Playwright CSV fixtures use the 28-column header.
Replace the hand-written FIBO, FHIR and GS1 sketches, which used invented IRIs,
with the publishers' own releases: DCAT 3, PROV-O, ORG, OWL-Time, SOSA/SSN, ODRL
2.2, FOAF, DPV 2.3, GS1 1.18, FIBO 2026Q2, FHIR R5 and Brick 1.4. ISA-95, HR Open
and EPCIS stay as OpenMetadata-authored starters and say so.

scripts/ontology-packs/generate.py (stdlib only) is the sole writer of payloads,
manifests, index.json, the payload README and the NOTICE block, driven by
sources.json with a pinned SHA-256 per file, a license allowlist and a --check
mode. The catalogue reads the generated index and fails fast on a missing or
inconsistent manifest. Packs too large for one native import are marked
installMode background and refused by preview and sample until the background
install job lands.

The importer's skipped-statement count for blank-node lists now depends on the
data, not on parse order. A library plan comparison ignores an empty owners list
that storage adds. Industries cross-industry and buildings-and-energy are added.
Present the new packs by their publisher names, add the cross-industry and
buildings-and-energy industries, show each pack's attribution, and explain that
large packs install in the background. Drop the removed starters from the
component tests and Playwright specs, and translate the new labels in every
locale.
…kground install mode

A pack of any size now previews, samples and installs through the job: the preview and
sample read the pack with the trusted parser and the unbounded importer path, and the
UI starts the job as it does for any install. installMode is gone from the manifest,
the generator, the UI and the ADR. NativeOntologyEveryPackInstallIT installs every
bundled pack through the job and installs it again, and RdfLibraryPackActivationIT
captures and activates FIBO and FHIR.
…CIS starter

GS1 publishes both files openly at ref.gs1.org with no license statement and no
terms granting or refusing redistribution. They are included pending GS1
confirmation and removed in a release if GS1 asks; the ADR records the removal
procedure.
…by the pack generator

BFO and the IOF annotation vocabulary open with an XML DOCTYPE that declares
entities, which the XXE guard refuses on every path. The generator now converts a
module that declares convert: turtle: it verifies the pinned source hash, writes
sorted Turtle with module-unique blank-node labels, proves it isomorphic to the
source, and records sourceSha256 and payloadSha256. The parser guard is unchanged.
…on and the thirteen Biopharma modules

The iof pack now mirrors IOF's AboutIOFProd manifests at Release_202603. Each added
module is marked iof-av:maturity Released and imports only Core, Supply Chain,
Certification or another Released biopharma module, so no Provisional or cache/ source
is pulled in. All opened with an entity-declaring DOCTYPE and are converted to Turtle
by the generator with the triples unchanged. Modules are listed dependencies first.
The pack attribution now covers the Open Applications Group copyright carried by the
IOF modules and the ChEBI terms adapted by Molecular Entity.
Reading a pack no longer skips rdfs:subPropertyOf links between declared
properties, so the read-time skipped total drops for ten packs. The
preview then drops links that name an undeclared property as
UNDECLARED_REFERENCE, so its total can differ from the read total. The
table now records both.
The install-job change removed the draft change-set fixture, so the two
library tests added for upstream packs referenced an undefined name and
failed the type check.
A module of the IOF pack plans more than 1,000 changed definitions with
its dependencies, so the test that applies every other pack's modules as
one interactive import refused it. IOF installs through the job, as the
other large packs do.
@harshach
harshach requested review from a team as code owners November 8, 2026 04:56
@harshach
harshach requested review from manerow and removed request for a team November 8, 2026 04:56
@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 removed the request for review from a team November 8, 2026 04:56
@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:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

@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.73% (142205/173989) 69.23% (52134/75300) 72.2% (29177/40411)

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

Base automatically changed from harshach/ontology-library/4-property-hierarchy to harshach/ontology-library/1-real-world-rdf-import November 9, 2026 05:00
@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Removing installMode from ontology-pack manifest responses could break API clients that rely on the field to select installation behavior.

Replaces the six hand-written library packs with 16 verbatim, pinned upstream ontologies (14 upstream, plus ISA-95 and HR Open starters marked as OpenMetadata-authored), generated by a single script that verifies payloads against pinned hashes. Resolved the issue where sample and review re-parsed and fully reconciled multi-MB packs on every request. No issues found.

✅ 1 closed
✅ Performance: Sample/review re-parse and fully reconcile multi-MB packs per request

📄 openmetadata-service/src/main/java/org/openmetadata/service/ontology/OntologyPackSampler.java:55-57 📄 openmetadata-service/src/main/java/org/openmetadata/service/ontology/OntologyPackSampler.java:96-103 📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/ontology/OntologyResource.java:376-390 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/NativeOntologyRdfImporter.java:139-142
OntologyPackSampler.sample now loads every selected module through OntologyPackModels and runs reconcileUnbounded on the whole pack just to return 60 concepts. reviewLibraryPack (and /preview, which delegates to it) does the same parse and then previewUnbounded. Neither result is cached. A FIBO sample or review therefore re-parses the 9.7 MB quickstart (about 222k Turtle lines), checks its SHA-256, and builds a plan of roughly 10k members on every call. The review/preview response also returns the full unbounded changeSet; only summary.items is capped at MAX_LISTED_ITEMS. Before this PR these paths covered packs of a few dozen triples, or were capped at MAX_CHANGED_DEFINITIONS. Now any user browsing the Library can tie up a request thread and several hundred MB of heap per click on FIBO, FHIR or Brick.

The bundled content is immutable and checksum-pinned, so the sample is a pure function of (packId, sorted moduleIds). It can be memoised in a bounded cache, and the parsed NativeOntologyDocument per module selection can be cached too. Consider leaving the full change set out of the review response, or paging it, since the install job rebuilds it from the bytes anyway.

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

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@harshach
harshach merged commit b095fd8 into harshach/ontology-library/1-real-world-rdf-import Nov 9, 2026
55 of 63 checks passed
@harshach
harshach deleted the harshach/ontology-library/5-upstream-packs branch November 9, 2026 06:29
harshach added a commit that referenced this pull request Nov 10, 2026
…, #37368) (#37489)

* Fixes #37353: Install ontology library packs as a resumable background job (#37361)

* Install ontology library packs as a resumable background job

Adds the ONTOLOGY_PACK_INSTALL job: it parses the verified bundled modules once, reconciles once, orders concepts, properties then axioms, and applies change sets of at most 1,000 members through the regular change-set path. Each slice carries a plan digest that replaces the per-apply full re-parse. Adds install, status and cancel endpoints, parseTrusted for checksum-verified bundled content, and named write-closure limits.

* Start the library install as a job in the ontology library UI

The native library detail starts the install job, polls it every second, shows slices and definitions applied, offers cancel, and resumes by starting a new job on retry. Adds generated types and translated strings for all locales.

* Guard the importer tests in the library install amendment

* Order library install slices by their references, serialize starts, and install the real GS1 vocabulary in an IT

A slice is validated alone, so a replacement, inverse, property chain or disjoint property
that names a definition in a later slice failed the install. Slicing now orders concepts and
properties so each follows what it names, keeps mutually referencing definitions in one slice,
and breaks ties by IRI.

Starting an install checks for an active job and inserts under a lock on the ontology row, so
concurrent starts queue one job. A slice the database rolled back as a deadlock victim is
applied again.

The importer skips an asserted literal whose datatype OWL 2 does not support instead of
emitting an axiom that applying refuses.

* Pin the slice digest reference values to a clean build of the models

The reference digests were recorded from an incremental build, where
jsonschema2pojo regenerated OntologyConcept and OntologyChangeOperation
without the defaults their referenced enum schemas declare (conceptType
BOTH, provider user, state ACTIVE). A clean build, which CI runs,
serializes those defaults, so the test failed there.

* Update generated TypeScript types and dereferenced schemas

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 7a65fae)

* Fixes #37354: Let a native ontology hold 50,000 members and open them in Studio (#37362)

(cherry picked from commit b65de72)

* Fixes #37355: Let native ontology properties specialize other properties with rdfs:subPropertyOf (#37363)

* Install ontology library packs as a resumable background job

Adds the ONTOLOGY_PACK_INSTALL job: it parses the verified bundled modules once, reconciles once, orders concepts, properties then axioms, and applies change sets of at most 1,000 members through the regular change-set path. Each slice carries a plan digest that replaces the per-apply full re-parse. Adds install, status and cancel endpoints, parseTrusted for checksum-verified bundled content, and named write-closure limits.

* Start the library install as a job in the ontology library UI

The native library detail starts the install job, polls it every second, shows slices and definitions applied, offers cancel, and resumes by starting a new job on retry. Adds generated types and translated strings for all locales.

* Guard the importer tests in the library install amendment

* Order library install slices by their references, serialize starts, and install the real GS1 vocabulary in an IT

A slice is validated alone, so a replacement, inverse, property chain or disjoint property
that names a definition in a later slice failed the install. Slicing now orders concepts and
properties so each follows what it names, keeps mutually referencing definitions in one slice,
and breaks ties by IRI.

Starting an install checks for an active job and inserts under a lock on the ontology row, so
concurrent starts queue one job. A slice the database rolled back as a deadlock victim is
applied again.

The importer skips an asserted literal whose datatype OWL 2 does not support instead of
emitting an axiom that applying refuses.

* Pin the slice digest reference values to a clean build of the models

The reference digests were recorded from an incremental build, where
jsonschema2pojo regenerated OntologyConcept and OntologyChangeOperation
without the defaults their referenced enum schemas declare (conceptType
BOTH, provider user, state ACTIVE). A clean build, which CI runs,
serializes those defaults, so the test failed there.

* Let a native ontology hold 50,000 members, with batched capture, cached release reads and unlocked draft reads

The FHIR R5 vocabulary plans 16,407 members and the FIBO quickstart 10,115, so the 10,000
member cap kept both out of one ontology. A release now holds up to 50,000 members and 256 MiB
of payload; a member stays at 1 MiB.

Capture inserts members in JDBI batches of 500 through the same sealedAt guard, so a release
sealed meanwhile still fails the capture with 412. Working and release reads page 1,000 per
query. OntologyReleaseReader keeps verified member lists of sealed releases in a Caffeine cache
bounded to 128 MiB of payload and 10 minutes idle, keyed by release id and digest, and still
authorizes every member on a hit. Read-only draft callers (working diff, validation, import
preview, draft export, draft SPARQL, the install job's reconcile) read without the
ontology_state FOR UPDATE lock, re-check the working and activation revisions by value at the
end, start over on a torn read and fail with 412 after three. On MySQL the unlocked path skips
the INSERT ... ON DUPLICATE KEY initializer for an existing row, which held an exclusive lock
until the transaction ended.

A whole-graph journal entry is bounded by GraphReplace.MAX_GRAPH_BYTES, 64 MiB, the Fuseki
extension's default upload limit, while per-entity writes keep 16 MiB. An import preview lists
at most 5,000 items, ALREADY_EXISTS ones first to go, and reports omittedItems.

NativeOntologyCapacityPerfIT measures every whole-ontology path at a configurable size and
shape, and installs the upstream FHIR and FIBO files when their paths are given. On MySQL at
10,000 FHIR-shaped members: install 76 s to 60 s, working diff 5.6 s to 0.7 s, concept create
during a diff 7.2 s to 17 ms, import preview 6.1 s to 1.0 s, capture 10.3 s to 2.4 s, release
diff 982 ms to 118 ms, draft SPARQL 1.1 s to 0.26 s. At 35,000: install 223 s in 35 slices,
capture 11.9 s, projection 58.4 MB of RDF-Thrift.

* Open ontologies of up to 50,000 definitions in Studio and say when a preview leaves items unlisted

useOntologyStudioModel allowed ten pages of 1,000 per kind, the server's old release cap, and
threw past that. It now mirrors the 50,000 member cap. The native import panel shows how many
already-existing definitions the server left out of a preview listing.

* Record the measured capacity limits in the ontology decision records

Amends the release, Fuseki, Studio and import records with the limits this change sets and the
numbers that justify them, notes the Fuseki upload bound in the production setup guide, fixes
the stale copy in the design plan, and registers the new tests in the Java impact map.

* Show the unlisted-definitions note when a preview lists no items, and pass it through the pack review

A preview whose every definition already exists lists no items, so the
import panel and the pack review dropped the server's omittedItems count
along with the empty list. Render the review whenever items are listed or
some were omitted, and hide the 'found' line when there is nothing to
count.

* Add superProperties to native ontology properties

OntologyProperty gains superProperties, the set of rdfs:subPropertyOf
links to named properties. The reference index gets a SUPER_PROPERTY
role, profile validation a SUBPROPERTY_CYCLE code, and the import
report an UNDECLARED_REFERENCE skip reason for links the importer drops.
The om:superProperties predicate is declared in the RDF vocabulary, and
the TypeScript types are regenerated from the schemas.

* Let native ontology properties specialize other properties

A property names its superproperties in superProperties
(ADR:2026-11-07-ontology-property-hierarchies-are-superproperty-fields).
Each must be a declared property of the same kind or a vocabulary
property of that kind, never the property itself, and the links cannot
form a cycle. Profile validation applies the OWL 2 DL simplicity rule
through the hierarchy, so a composite property makes every property
above it non-simple, and checks chain regularity against it. The write
closure loads ancestors and subproperties, the reference index and
release diff read the field, the RDF export writes rdfs:subPropertyOf,
the CSV format gains a 28th column, and a library install orders a
subproperty after its superproperties.

RDF import keeps rdfs:subPropertyOf between declared properties of the
same kind. Each refusal pass drops links to undeclared properties
(UNDECLARED_REFERENCE), to properties of another kind and the links on
a cycle (UNSUPPORTED_STRUCTURE), and keeps the property. Measured as links in
the planned import, FIBO keeps 787 of 799, schema.org 210 of 212 and
FHIR R5 none of 274, which all name the external W5 vocabulary. GS1
keeps 1 of 92, because import already refuses its 61 link-type
properties for their xsd:anyURI range and 30 links name schema.org.

* Pick superproperties in the Studio property editor

The property editor offers a superproperty picker that lists the
ontology's properties of the same kind, never the property itself, and
sends the picked IRIs as superProperties. The import report names the
new UNDECLARED_REFERENCE skip reason, every locale translates the two
new labels, and the Playwright CSV fixtures use the 28-column header.

* test: stabilize dashboard usage fixtures across midnight

(cherry picked from commit 019e606)

* Fixes #37356: Ship verbatim pinned upstream ontologies as library packs (#37364)

* Install ontology library packs as a resumable background job

Adds the ONTOLOGY_PACK_INSTALL job: it parses the verified bundled modules once, reconciles once, orders concepts, properties then axioms, and applies change sets of at most 1,000 members through the regular change-set path. Each slice carries a plan digest that replaces the per-apply full re-parse. Adds install, status and cancel endpoints, parseTrusted for checksum-verified bundled content, and named write-closure limits.

* Start the library install as a job in the ontology library UI

The native library detail starts the install job, polls it every second, shows slices and definitions applied, offers cancel, and resumes by starting a new job on retry. Adds generated types and translated strings for all locales.

* Guard the importer tests in the library install amendment

(cherry picked from commit b095fd8)

* Fixes #37367: Serve large ontology releases from Fuseki in staged chunks, journaled by release (#37368)

* Install ontology library packs as a resumable background job

Adds the ONTOLOGY_PACK_INSTALL job: it parses the verified bundled modules once, reconciles once, orders concepts, properties then axioms, and applies change sets of at most 1,000 members through the regular change-set path. Each slice carries a plan digest that replaces the per-apply full re-parse. Adds install, status and cancel endpoints, parseTrusted for checksum-verified bundled content, and named write-closure limits.

* Start the library install as a job in the ontology library UI

The native library detail starts the install job, polls it every second, shows slices and definitions applied, offers cancel, and resumes by starting a new job on retry. Adds generated types and translated strings for all locales.

* Guard the importer tests in the library install amendment

* Order library install slices by their references, serialize starts, and install the real GS1 vocabulary in an IT

A slice is validated alone, so a replacement, inverse, property chain or disjoint property
that names a definition in a later slice failed the install. Slicing now orders concepts and
properties so each follows what it names, keeps mutually referencing definitions in one slice,
and breaks ties by IRI.

Starting an install checks for an active job and inserts under a lock on the ontology row, so
concurrent starts queue one job. A slice the database rolled back as a deadlock victim is
applied again.

The importer skips an asserted literal whose datatype OWL 2 does not support instead of
emitting an axiom that applying refuses.

* Pin the slice digest reference values to a clean build of the models

The reference digests were recorded from an incremental build, where
jsonschema2pojo regenerated OntologyConcept and OntologyChangeOperation
without the defaults their referenced enum schemas declare (conceptType
BOTH, provider user, state ACTIVE). A clean build, which CI runs,
serializes those defaults, so the test failed there.

* Let a native ontology hold 50,000 members, with batched capture, cached release reads and unlocked draft reads

The FHIR R5 vocabulary plans 16,407 members and the FIBO quickstart 10,115, so the 10,000
member cap kept both out of one ontology. A release now holds up to 50,000 members and 256 MiB
of payload; a member stays at 1 MiB.

Capture inserts members in JDBI batches of 500 through the same sealedAt guard, so a release
sealed meanwhile still fails the capture with 412. Working and release reads page 1,000 per
query. OntologyReleaseReader keeps verified member lists of sealed releases in a Caffeine cache
bounded to 128 MiB of payload and 10 minutes idle, keyed by release id and digest, and still
authorizes every member on a hit. Read-only draft callers (working diff, validation, import
preview, draft export, draft SPARQL, the install job's reconcile) read without the
ontology_state FOR UPDATE lock, re-check the working and activation revisions by value at the
end, start over on a torn read and fail with 412 after three. On MySQL the unlocked path skips
the INSERT ... ON DUPLICATE KEY initializer for an existing row, which held an exclusive lock
until the transaction ended.

A whole-graph journal entry is bounded by GraphReplace.MAX_GRAPH_BYTES, 64 MiB, the Fuseki
extension's default upload limit, while per-entity writes keep 16 MiB. An import preview lists
at most 5,000 items, ALREADY_EXISTS ones first to go, and reports omittedItems.

NativeOntologyCapacityPerfIT measures every whole-ontology path at a configurable size and
shape, and installs the upstream FHIR and FIBO files when their paths are given. On MySQL at
10,000 FHIR-shaped members: install 76 s to 60 s, working diff 5.6 s to 0.7 s, concept create
during a diff 7.2 s to 17 ms, import preview 6.1 s to 1.0 s, capture 10.3 s to 2.4 s, release
diff 982 ms to 118 ms, draft SPARQL 1.1 s to 0.26 s. At 35,000: install 223 s in 35 slices,
capture 11.9 s, projection 58.4 MB of RDF-Thrift.

* Open ontologies of up to 50,000 definitions in Studio and say when a preview leaves items unlisted

useOntologyStudioModel allowed ten pages of 1,000 per kind, the server's old release cap, and
threw past that. It now mirrors the 50,000 member cap. The native import panel shows how many
already-existing definitions the server left out of a preview listing.

* Record the measured capacity limits in the ontology decision records

Amends the release, Fuseki, Studio and import records with the limits this change sets and the
numbers that justify them, notes the Fuseki upload bound in the production setup guide, fixes
the stale copy in the design plan, and registers the new tests in the Java impact map.

* Show the unlisted-definitions note when a preview lists no items, and pass it through the pack review

A preview whose every definition already exists lists no items, so the
import panel and the pack review dropped the server's omittedItems count
along with the empty list. Render the review whenever items are listed or
some were omitted, and hide the 'found' line when there is nothing to
count.

* Add superProperties to native ontology properties

OntologyProperty gains superProperties, the set of rdfs:subPropertyOf
links to named properties. The reference index gets a SUPER_PROPERTY
role, profile validation a SUBPROPERTY_CYCLE code, and the import
report an UNDECLARED_REFERENCE skip reason for links the importer drops.
The om:superProperties predicate is declared in the RDF vocabulary, and
the TypeScript types are regenerated from the schemas.

* Let native ontology properties specialize other properties

A property names its superproperties in superProperties
(ADR:2026-11-07-ontology-property-hierarchies-are-superproperty-fields).
Each must be a declared property of the same kind or a vocabulary
property of that kind, never the property itself, and the links cannot
form a cycle. Profile validation applies the OWL 2 DL simplicity rule
through the hierarchy, so a composite property makes every property
above it non-simple, and checks chain regularity against it. The write
closure loads ancestors and subproperties, the reference index and
release diff read the field, the RDF export writes rdfs:subPropertyOf,
the CSV format gains a 28th column, and a library install orders a
subproperty after its superproperties.

RDF import keeps rdfs:subPropertyOf between declared properties of the
same kind. Each refusal pass drops links to undeclared properties
(UNDECLARED_REFERENCE), to properties of another kind and the links on
a cycle (UNSUPPORTED_STRUCTURE), and keeps the property. Measured as links in
the planned import, FIBO keeps 787 of 799, schema.org 210 of 212 and
FHIR R5 none of 274, which all name the external W5 vocabulary. GS1
keeps 1 of 92, because import already refuses its 61 link-type
properties for their xsd:anyURI range and 30 links name schema.org.

* Pick superproperties in the Studio property editor

The property editor offers a superproperty picker that lists the
ontology's properties of the same kind, never the property itself, and
sends the picked IRIs as superProperties. The import report names the
new UNDECLARED_REFERENCE skip reason, every locale translates the two
new labels, and the Playwright CSV fixtures use the 28-column header.

* Leave statement sources out of the served ontology graph

The release projection added an owl:Axiom node per asserted statement,
naming the release member that states it. Nothing reads those nodes from
Fuseki; only the importer reads them, from export files. They were 81% of
the FIBO quickstart projection and 76% of FHIR R5, and 87% of English
ESCO with its links.

The active graph now projects with StatementSources.OMITTED. Exports,
release and draft queries and validation keep the sources, so a native
export still re-imports without changes. FIBO projects to 5.0 MB of
RDF-Thrift instead of 21.7 MB, FHIR R5 to 6.2 MB instead of 27.9 MB.

Records the change as v4 of the Fuseki active-release decision.

* Replace the active ontology graph in staged chunks and journal it by release

An activated release no longer reaches Fuseki as one Graph Store PUT capped
at the 64 MiB upload limit. ChunkedGraphReplace cuts the graph into chunks
of at most rdfConfiguration.graphReplaceChunkBytes (16 MiB by default),
keeping each blank-node structure in one request. It stages them in
per-graph staging graphs and moves them into place with one SPARQL update,
so readers see the old release or the new one. A crash before the update
leaves the live graph unchanged. The next attempt drops the stale staging
graphs, and resending a committed update changes nothing. A graph that fits
one chunk is still a single PUT.

The rebuild journal records the graph and the release id instead of base64
RDF-Thrift, and replay projects the sealed release again from SQL. Activation
checks a 256 MiB active-graph bound.

ADR:2026-10-15-fuseki-holds-only-the-active-ontology-release v5 records the
design and the timings on FIBO, FHIR and ESCO.

* Skip descriptions that are resources or markup instead of failing the import

A skos:definition or rdfs:comment whose value is an IRI, a blank node, or an
rdf:HTML or rdf:XMLLiteral literal stopped the whole preview with "Expected
a plain RDF literal". RdfSourceNormalizer now skips such a value as
UNSUPPORTED_STRUCTURE, together with the blank-node structure under it. The
concept still imports with its other description. English ESCO's 13
esco:NodeLiteral definitions now import this way instead of aborting the
import.

ADR:2026-10-19-native-ontology-imports-use-working-drafts v13.

* Copy staged chunks into the served graph with INSERT WHERE

A chunked replace could serve fewer triples than it staged. FIBO with
statement sources, replaced in 1 MiB chunks over its previous release,
served 157,898 of 157,928 triples: six owl:Axiom nodes of the last chunk
were missing from the served graph and, after the swap dropped their
staging graph, from the dataset.

Jena 6.2 runs MOVE and ADD as GraphOps.addAll(dest, src.find()), which
iterates the source while inserting into the same TDB2 quad indexes in
one write transaction. Depending on the index layout that iteration
skips triples. Reordering the DROPs does not help; an embedded TDB2
replay of the swap lost triples in 20 of 21 trials, and with the DROPs
last in 17 of 21. INSERT WHERE collects its solutions before it writes
and lost none in 32 trials.

The swap now adds each staging graph to itself, which fails when that
graph is missing and so aborts the request, drops the served graph,
copies every staged triple with one INSERT WHERE and drops the staging
graphs. Fuseki accepts one WHERE-bearing operation per request under
arq:updateTimeout, so the copy is a single operation over a VALUES list.

Each attempt stages into graphs under a fresh id, so a newer attempt
that drops a stale attempt's chunks makes that attempt's swap fail
instead of copying a mix. Resending a committed swap is refused the same
way and leaves the served graph as committed.

ChunkedGraphReplaceTest now runs on TDB2, the store Fuseki serves, and
reproduces the loss with fixed blank node labels: 4,435 of 5,000 triples
before this change.

* Record the INSERT WHERE swap and the union reads of staging graphs in ADR v5

Amendment v5 now describes per-attempt staging names, the swap that
asserts each chunk exists before it drops the served graph and copies
the chunks with one INSERT WHERE, and why MOVE and ADD were dropped,
with the FIBO loss and the embedded TDB2 replay counts.

It corrects two claims. Fuseki keeps RDF-Thrift blank node labels
across requests, so chunks keep blank-node structures whole to stay
well-formed, not for identity. Resending a committed swap is refused
rather than changing nothing.

It adds the Fuseki heap the copy needs, measured on the pinned image,
and lists the reads of the union default graph that can see staged
triples, when, and why inference conclusions drawn from them do not
outlive a successful replacement. The production setup guide carries
the heap requirement and the new update time.

* test: align library activation check with active graph limits

* test: synchronize metrics thread startup under coverage

(cherry picked from commit 6199b6b)

* Record the install slice deadlock retry in the native ontology import ADR (v14)

---------

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.

1 participant