Skip to content

An ontology can be found on ohi.dev and previewed from the import panel - #1526

Open
Ostrzyciel wants to merge 1 commit into
deeplethe:devfrom
Ostrzyciel:feat/ohi-catalog-import
Open

Ostrzyciel wants to merge 1 commit into
deeplethe:devfrom
Ostrzyciel:feat/ohi-catalog-import

Conversation

@Ostrzyciel

Copy link
Copy Markdown

Closes #1524.

Why

Pack requests (#314, #923, #992) were answered with "bring the file and import it". Finding the file was then the person's job, including merging modular ontologies by hand (#923 for UCO; ADR 0008 set FIBO aside as hundreds of files). ohi.dev publishes ontology releases as fixed files, with modular ones already merged. This lets the import panel fetch one, without the server ever contacting the internet. Disclosure: I work on ohi.dev.

What changes

  • web/src/pages/OhiCatalogSearch.tsx: a search box under "Choose file".
    • Results are a table: title, namespace/name@version linking to the release page, publisher, license.
    • "Preview" downloads the release's OWL file and hands it to the panel's existing choose, so the preview and confirm steps are the ones a hand-picked file goes through.
    • The panel sends nothing until the person searches, and the hint says the search goes to ohi.dev.
    • A connection failure or timeout reads as "ohi.dev could not be reached from this browser. Choose a local file instead."
  • web/src/pages/ohiCatalog.ts: which file to take and what to call it.
    • It takes the publisher's own file first (UPSTREAM), following 0001's first criterion that the blob keeps the vocabulary author's text, then Turtle over RDF/XML.
    • It skips a file over the 8 MB MAX_ONTOLOGY_BYTES, and reports the size when none fits.
    • It names the file namespace-name@version.ttl|rdf, so the import history says which release came in. The suffix follows the format, which is what RdfFormat::detect reads.
  • web/src/pages/Ontology.tsx: renders the search in ImportPanel while no file is chosen.
  • web/src/i18n/en.ts, zh.ts: the new strings.
  • web/package.json, pnpm-lock.yaml: @neverblink/ohi ^0.18.7 (Apache-2.0, no runtime dependencies).

No backend change, no migration, no change to the public API.

How it was checked

On Linux aarch64, Node 24.21, Rust 1.100.0, branched from dev at 87a83b9:

  • pnpm build (style guard, tsc --noEmit, vite build) passes. pnpm test passes: 56 files, 360 tests, including the 4 new ones in ohiCatalog.test.ts.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass. Rust is untouched, and the database-backed tests skipped without UTOPIA_DATABASE_URL.
  • Against a local cargo run -p utopia-server with the compose database, I ran the panel's steps from Node: search, inspect, pick the file with pickArtifact, download, build the File and post it to the import endpoints.
    • FIBO production (merged): fibo-fibo-prod@2019Q4.ttl, 6,251,443 bytes, preview HTTP 200: Turtle, 71,346 triples, 1729 classes (1716 new), 503 relations, 155 attributes.
    • SOSA: w3c-sosa@2017.ttl preview HTTP 200, 14 classes, 21 relations, 2 attributes. Applied: 14 classes created, and the import history lists w3c-sosa@2017.ttl.
    • For FIBO, PROV-O and SOSA the downloaded bytes match the sha256 the catalog publishes.
  • In the UI, on an empty base, with pnpm dev: searching "fibo" and pressing Preview shows the plan below.

Before review

  • Every commit is signed off (git commit -s)
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass
  • For changes under web/: pnpm build and pnpm test pass
  • UI strings are in both web/src/i18n/en.ts and zh.ts

…el, so a domain vocabulary no longer has to be found and merged by hand

Signed-off-by: Ostrzyciel <piotr@neverblink.eu>
@Ostrzyciel

Copy link
Copy Markdown
Author

How it looks:
ohi-import-demo

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.

1 participant