This is the full developer documentation for ohi.dev
# Welcome to ohi
> Find, download and manage ontologies with ohi.
ohi is an ontology package manager for people, applications and AI agents. It helps you find ontologies, download their files and keep track of the versions and dependencies used by your project.
[Download your first ontology](/docs/getting-started/first-ontology/)
## Basic concepts
[Section titled “Basic concepts”](#basic-concepts)
### Ontology
[Section titled “Ontology”](#ontology)
An ontology defines concepts and relationships in a domain. For example, the [Organization ontology](https://ohi.dev/o/w3c/org@2014) describes organizations and the people who belong to them. Both are kinds of `foaf:Agent`, a concept it shares with [FOAF](https://ohi.dev/o/foaf/foaf@2014-01-14).
**Organization**
`org:hasMember`
**Person**
is a subclass of
**Agent**
### Publication
[Section titled “Publication”](#publication)
A publication is an **immutable** release of an ontology on ohi.dev. It includes the ontology’s files, metadata and dependencies. Once published, its contents stay unchanged.
Several publications can share the original publisher’s version tag. This can happen when the publisher changes a source file without updating the tag, or when ohi updates a generated file. ohi adds timestamps to distinguish these publications. For example, FOAF could keep its version tag through these changes:
**FOAF**Publisher’s version `2014-01-14`
Publication**1 Oct 2026**09:00 UTCOriginal files
Publication**2 Oct 2026**11:00 UTCPublisher corrects a class description
Publication**3 Oct 2026**14:00 UTCohi updates a generated file
Referencing a specific publication ensures you receive identical files each time, even if a newer publication becomes available.
A reference without a version, such as `foaf/foaf`, selects the latest version. If that version has several publications, it selects the newest one.
### Artifact
[Section titled “Artifact”](#artifact)
An artifact is one downloadable ontology file. Its **format** combines a modeling language with a file syntax.
Take “a person is a subclass of an agent.” In **OWL + Turtle** (`owl-turtle`), it looks like this:
```turtle
foaf:Person a owl:Class ;
rdfs:subClassOf foaf:Agent .
```
The same statement in **OWL + RDF/XML** (`owl-rdfxml`):
```xml
```
The language is still OWL. Only the syntax changed. In **LinkML + YAML** (`linkml-yaml`), you’d write:
```yaml
classes:
Person:
is_a: Agent
```
ohi.dev supports OWL in Turtle or RDF/XML, RDFS and SHACL in Turtle, and LinkML or Apache Ossie in YAML. Choose an available artifact in a format your tools can read.
### Dependency
[Section titled “Dependency”](#dependency)
A dependency is another ontology that your chosen ontology builds on. [DCAT](https://ohi.dev/o/w3c/dcat@3), for example, describes datasets such as a city’s bus timetables. It uses Dublin Core’s `title` property to name them.
**DCAT**Datasets
depends on
**Dublin Core Terms**Titles, creators and dates
You need both ontologies to use those definitions. ohi records the exact publication of each dependency so your project can use the same definitions again later.
## Choose how you work
[Section titled “Choose how you work”](#choose-how-you-work)
[Browse ohi.dev](https://ohi.dev)Explore ontologies and their available files.
[Use the CLI](/docs/getting-started/install/)Install ohi and work from your terminal.
[Use an SDK](/docs/reference/sdks/)Use ohi from Python, TypeScript or Scala.
[Read the FAQ](/docs/faq/)Short answers to common questions about ohi.
# Frequently asked questions
> Answers to common questions about ohi, the open-source ontology package manager: downloading ontologies, pinning versions, file formats and AI agents.
Short answers to common questions about ohi. Each answer links to the page with the details. If your question is not answered here, ask on [Discord](https://discord.gg/HGksVAJ6ss).
## About ohi
[Section titled “About ohi”](#about-ohi)
### What is ohi?
[Section titled “What is ohi?”](#what-is-ohi)
ohi is a free, open-source ontology package manager. It finds ontologies on [ohi.dev](https://ohi.dev), downloads their files in the format you need, and records the exact versions your project uses, so you and your team can download the same files again later. You can use ohi from the command line, from code through the [SDKs](/docs/reference/sdks/) or through an [AI agent](#how-can-an-ai-agent-use-ohi).
### What is ohi.dev?
[Section titled “What is ohi.dev?”](#what-is-ohidev)
ohi.dev is the website and catalog behind ohi. It lists more than 800 ontologies. You can [search](https://ohi.dev/search) them by name, prefix or IRI, or [browse](https://ohi.dev/browse) them online without installing anything. The ohi CLI and SDKs download their files from ohi.dev.
### What is an ontology, and why would I use one?
[Section titled “What is an ontology, and why would I use one?”](#what-is-an-ontology-and-why-would-i-use-one)
An ontology is a shared list of terms for a topic and how they relate. For example, the [Organization ontology](https://ohi.dev/o/w3c/org@2014) has terms for organizations, their members and roles. Using one means your data speaks the same language as other people’s data and tools, so it is easier to combine and share. ohi helps you find the right ontology and get it in the format your tools read. See [Basic concepts](/docs/#basic-concepts) for more.
### Is ohi free and open source?
[Section titled “Is ohi free and open source?”](#is-ohi-free-and-open-source)
Yes. The ohi CLI and SDKs are open source under the Apache 2.0 license, and the code is on [GitHub](https://github.com/NeverBlink-OSS/ohi). Each ontology on ohi.dev has its own license, which is shown on its page. If ohi is useful to you, [give it a star on GitHub](https://github.com/NeverBlink-OSS/ohi) so others can find it too.
### Who makes ohi?
[Section titled “Who makes ohi?”](#who-makes-ohi)
ohi and ohi.dev are built and maintained by [NeverBlink](https://neverblink.eu). The list of ontologies lives in the public [ohi index](https://github.com/NeverBlink-OSS/ohi-index) repository, where anyone can [request](/docs/guides/requesting-ontologies/) or [contribute](/docs/guides/contributing-ontologies/) an ontology.
### How is ohi different from other ontology catalogs?
[Section titled “How is ohi different from other ontology catalogs?”](#how-is-ohi-different-from-other-ontology-catalogs)
Most ontology catalogs help you browse ontologies and look up their terms. ohi is also a package manager for your project. It has each ontology in several formats: OWL in Turtle or RDF/XML, RDFS and SHACL in Turtle, as well as LinkML and Apache Ossie in YAML. ohi downloads an ontology together with its dependencies, lets you pick the file format, and saves the exact files and their checksums in `ohi.lock.json`, so everyone on your team, and your CI, uses the same files.
### How is ohi related to ohi LinkML?
[Section titled “How is ohi related to ohi LinkML?”](#how-is-ohi-related-to-ohi-linkml)
They are packaged into one command-line tool. ohi helps you find, download and manage ontologies, and ohi LinkML, under `ohi linkml`, helps you write, check and convert [LinkML](https://linkml.io/) schemas. ohi LinkML was formerly called LinkML-Scala and has its own docs at [linkml.ohi.dev](https://linkml.ohi.dev/docs/).
## Getting started
[Section titled “Getting started”](#getting-started)
### How do I install ohi?
[Section titled “How do I install ohi?”](#how-do-i-install-ohi)
On macOS, Linux, or Windows with Git Bash or WSL, run `. <(curl -sSfL https://ohi.dev/install.sh)`. In PowerShell, run `irm https://ohi.dev/install.ps1 | iex`. Then run `ohi version` to check that it worked. [Install ohi](/docs/getting-started/install/) covers other ways to install, such as mise, a manual download or the Java JAR.
### How do I update ohi?
[Section titled “How do I update ohi?”](#how-do-i-update-ohi)
If you installed ohi with the install command, run it again. It downloads the latest release, checks its checksum and replaces your current `ohi`. If your scripts or code depend on ohi’s commands, read the [release notes](https://github.com/NeverBlink-OSS/ohi/releases) before you update.
### How do I download an ontology?
[Section titled “How do I download an ontology?”](#how-do-i-download-an-ontology)
Find it with `ohi search` or on [ohi.dev](https://ohi.dev/search), then download it in the format you want with `ohi get --format `. To also get its dependencies and record the version for your project, use `ohi add` instead. [Download your first ontology](/docs/getting-started/first-ontology/) walks you through it.
### Are the generated formats the same as the original ontology?
[Section titled “Are the generated formats the same as the original ontology?”](#are-the-generated-formats-the-same-as-the-original-ontology)
Not always. ohi.dev keeps the publisher’s own file and marks it as the original, and ohi generates the other formats from it. A conversion can’t always express everything in the original, so each ontology’s page lists what was left out. If you need exactly what the publisher wrote, download the original.
### How do I convert an ontology to LinkML or SHACL?
[Section titled “How do I convert an ontology to LinkML or SHACL?”](#how-do-i-convert-an-ontology-to-linkml-or-shacl)
For an ontology on ohi.dev, you usually don’t need to convert anything: download the format you want, such as `ohi get w3c/dcat@3 --format linkml-yaml`. To convert your own OWL ontology or RDFS vocabulary, in Turtle or N-Triples, run `ohi linkml from owl --to schema.yaml ontology.ttl`. Add `--list-not-imported` to see what couldn’t be converted. Then run `ohi linkml to shacl schema.yaml` or another generator. See the [OWL importer](https://linkml.ohi.dev/docs/importers/owl/).
### Can I use ohi without the command line?
[Section titled “Can I use ohi without the command line?”](#can-i-use-ohi-without-the-command-line)
Yes. You can search, browse and download files on [ohi.dev](https://ohi.dev) in a browser. To use ohi from code, the [SDKs](/docs/reference/sdks/) let Python, TypeScript, Java and Rust applications search ohi.dev, inspect an ontology’s metadata and download its files. The Scala modules are built into the ohi CLI.
## Projects and versions
[Section titled “Projects and versions”](#projects-and-versions)
### How do I pin the ontology versions my project uses?
[Section titled “How do I pin the ontology versions my project uses?”](#how-do-i-pin-the-ontology-versions-my-project-uses)
Run `ohi init` to create a project, then `ohi add` for each ontology, such as `ohi add w3c/dcat@3`. ohi downloads each ontology with its dependencies, records your choices in `ohi.yaml`, and records the exact files and their checksums in `ohi.lock.json`. See [Manage ontology projects](/docs/guides/projects/).
### How do I get the same files on another machine or in CI?
[Section titled “How do I get the same files on another machine or in CI?”](#how-do-i-get-the-same-files-on-another-machine-or-in-ci)
Keep `ohi.yaml` and `ohi.lock.json` in version control, then run `ohi sync` after cloning. ohi downloads the files listed in the lock, and checks files that are already there against their saved checksums. In CI, use `ohi sync --locked` so the build fails if `ohi.yaml` and the lock don’t match, or `ohi lock --check` to check the lock without downloading anything.
### Where does ohi save downloaded files, and should I commit them?
[Section titled “Where does ohi save downloaded files, and should I commit them?”](#where-does-ohi-save-downloaded-files-and-should-i-commit-them)
ohi saves downloads in `.ohi/`, grouped by namespace, ontology and version, such as `.ohi/w3c/dcat/3/dcat.owl.ttl`. You can choose another folder with `ohi init --to`. ohi creates a `.gitignore` in that folder to keep downloads out of Git, since `ohi sync` can download them again. Edit it if you want to commit the downloads too, and keep files you write yourself outside that folder. See [Project files](/docs/reference/project-files/#downloaded-files).
### Can a downloaded ontology change later?
[Section titled “Can a downloaded ontology change later?”](#can-a-downloaded-ontology-change-later)
No. A file on ohi.dev never changes after it is published, so a project with a committed `ohi.lock.json` gets the same files every time. If an ontology needs a fix, ohi.dev publishes a new revision instead. Run `ohi lock --upgrade` and then `ohi sync` to move your project to it. See [API stability and compatibility](/docs/reference/compatibility/).
### What is the difference between a version, a publication and a revision?
[Section titled “What is the difference between a version, a publication and a revision?”](#what-is-the-difference-between-a-version-a-publication-and-a-revision)
A version is the release name the ontology’s publisher uses, such as `2014-01-14` for FOAF. A publication is a fixed release of that version on ohi.dev, with its files, metadata and dependencies. If the publisher changes a file without changing the version, or ohi updates a generated file, the same version gets a new publication, called a revision, such as `w3c/prov-o@2013-revision-2026-12-01`. ohi picks the newest revision unless you ask for an exact one, or add `-no-revision` to skip revisions. The [welcome page](/docs/#publication) shows an example.
### Will a new ohi release break my scripts or code?
[Section titled “Will a new ohi release break my scripts or code?”](#will-a-new-ohi-release-break-my-scripts-or-code)
From version 0.18.7 onward, you can pin your ohi SDK or CLI release. We maintain compatibility with those releases for a long time, so changes to [ohi.dev](https://ohi.dev) do not require an SDK upgrade. If ohi.dev adds a new format, oolder clients ignore additional metadata fields and skip files in formats they do not recognize. A newer ohi release can change its commands and SDK functions, so read the [release notes](https://github.com/NeverBlink-OSS/ohi/releases) before you upgrade. See [API stability and compatibility](/docs/reference/compatibility/).
## The catalog
[Section titled “The catalog”](#the-catalog)
### How do I request or add an ontology to ohi.dev?
[Section titled “How do I request or add an ontology to ohi.dev?”](#how-do-i-request-or-add-an-ontology-to-ohidev)
Fill in the [ontology request form](https://github.com/NeverBlink-OSS/ohi-index/issues/new?template=ontology-request.yml) with the ontology’s name, a link to its official website or source repository, the version you need, if any, and what you want to use it for. You don’t need to prepare any files, and you can use the same form to ask for a new release. To get it added faster, [package it yourself](/docs/guides/contributing-ontologies/) and open a pull request in the ohi index.
### What do the Gold, Silver and Bronze seals on ohi.dev mean?
[Section titled “What do the Gold, Silver and Bronze seals on ohi.dev mean?”](#what-do-the-gold-silver-and-bronze-seals-on-ohidev-mean)
The seals mark well-written and well-maintained ontologies, to help you choose when several match your needs. The score looks at how many terms have descriptions, whether the ontology has a title, description, license and version, and how much other ontologies depend on it. Scoring is still experimental, and an ontology without a seal may simply not have been scored yet. See [Seal of Quality](/docs/reference/quality-seal/).
### Can I use ontologies from ohi.dev in my own project?
[Section titled “Can I use ontologies from ohi.dev in my own project?”](#can-i-use-ontologies-from-ohidev-in-my-own-project)
Usually yes, but check each ontology’s license first. ohi.dev only lists ontologies whose license allows them to be shared, and each ontology’s page shows its license and how to credit its authors. On [Browse](https://ohi.dev/browse) you can filter ontologies by license.
## AI agents
[Section titled “AI agents”](#ai-agents)
### How can an AI agent use ohi?
[Section titled “How can an AI agent use ohi?”](#how-can-an-ai-agent-use-ohi)
Install the [ohi plugin](https://github.com/NeverBlink-OSS/ohi/tree/main/.agents), which teaches coding agents such as Claude Code and Codex to use the ohi CLI, including `ohi linkml` for LinkML schemas. In Claude Code, run `claude plugin marketplace add NeverBlink-OSS/ohi` and then `claude plugin install ohi@ohi`. In Codex, run `codex plugin marketplace add NeverBlink-OSS/ohi` and then `codex plugin add ohi@ohi`. The plugin only contains instructions, so you need `ohi` 0.18.7 or newer insalled. Then ask the agent in plain words, for example to find a provenance ontology and download it as `owl-turtle`, or to add DCAT to your project.
### How can I give an AI assistant up-to-date information about ohi?
[Section titled “How can I give an AI assistant up-to-date information about ohi?”](#how-can-i-give-an-ai-assistant-up-to-date-information-about-ohi)
Point it at [ohi.dev/llms.txt](https://ohi.dev/llms.txt) for the site and at [ohi.dev/docs/llms-full.txt](https://ohi.dev/docs/llms-full.txt) for the full docs as plain text. The ohi.dev pages, including Search and Browse, also answer in Markdown to requests that ask for `text/markdown`, and each ontology page links to its metadata as JSON.
### Can I use ohi with knowledge graph and AI tools?
[Section titled “Can I use ohi with knowledge graph and AI tools?”](#can-i-use-ohi-with-knowledge-graph-and-ai-tools)
Yes. Any tool that reads OWL, RDFS, SHACL or LinkML files can use the ontologies ohi downloads. Giving these tools an ontology means they use existing terms instead of making up their own, and ohi makes sure everyone on your team loads the same files. The Integrations section of the docs has step-by-step guides for specific tools, such as [Cognee](/docs/integrations/cognee/).
## Help
[Section titled “Help”](#help)
### Where can I get help or report a problem?
[Section titled “Where can I get help or report a problem?”](#where-can-i-get-help-or-report-a-problem)
Ask questions on [Discord](https://discord.gg/HGksVAJ6ss). To report a bug or ask for a feature, use the [issue templates on GitHub](https://github.com/NeverBlink-OSS/ohi/issues/new/choose). For other questions, email .
### How can I support ohi?
[Section titled “How can I support ohi?”](#how-can-i-support-ohi)
The easiest way is to [star ohi on GitHub](https://github.com/NeverBlink-OSS/ohi). You can also [request](/docs/guides/requesting-ontologies/) or [contribute](/docs/guides/contributing-ontologies/) ontologies, report bugs, or send code changes as described in [CONTRIBUTING.md](https://github.com/NeverBlink-OSS/ohi/blob/main/CONTRIBUTING.md). And [join our Discord](https://discord.gg/HGksVAJ6ss) to share feedback and become part of our community.
# Adding ontologies to the index
> Contribute an ontology package or request an ontology for the ohi index.
Did we miss your favorite ontology or one you created yourself and wish to share with the world?
[Contribute an Ontology](/docs/guides/contributing-ontologies/)Submit an ontology package through a pull request.
[Request an ontology](/docs/guides/requesting-ontologies/)Open an issue to request an ontology or a new release.
# Download your first ontology
> Find FOAF and download its OWL file in Turtle syntax.
We’ll download [FOAF](https://ohi.dev/o/foaf/foaf@2014-01-14), an ontology for people and their relationships. You’ll need [ohi installed](/docs/getting-started/install/).
## Find the ontology
[Section titled “Find the ontology”](#find-the-ontology)
```sh
ohi search foaf
```
Look for `foaf/foaf` at version `2014-01-14`. The result lists its available formats.
## Download it
[Section titled “Download it”](#download-it)
```sh
ohi get foaf/foaf@2014-01-14 --format owl-turtle
```
Without a project in the current directory, this saves `.ohi/foaf/foaf/2014-01-14/foaf.owl.ttl`. If `ohi.yaml` is present there, it uses that project’s `download_dir` instead of `.ohi`. `owl-turtle` selects OWL in Turtle syntax. Open the file in a text editor to see its definitions. Use `--to ontologies` for a separate destination, such as `ontologies/foaf/foaf/2014-01-14/foaf.owl.ttl`.
To record ontology choices in a project and download their dependencies, continue with [Manage ontology projects](/docs/guides/projects/).
# Install ohi
> Install the ohi command-line tool on macOS, Linux or Windows.
Install the ohi command-line tool to search and download ontologies from your terminal. The same tool also runs the [LinkML commands](https://linkml.ohi.dev/docs/), under `ohi linkml`. For Python or TypeScript applications, see [SDK installation](/docs/reference/sdks/#installation).
## Install
[Section titled “Install”](#install)
Supports Intel and Apple silicon Macs running macOS 13 or later, Linux on x86_64 or arm64, and Windows on x86_64.
* Bash / Zsh
Run this in Zsh on macOS, Bash on Linux, or Git Bash, MSYS2, Cygwin or WSL on Windows:
```sh
. <(curl -sSfL https://ohi.dev/install.sh)
```
The [installer](https://github.com/NeverBlink-OSS/ohi/blob/main/cli/install.sh) downloads the latest release, verifies its checksum and puts `ohi` in `~/.local/bin`. Accept its offer to add that directory to your shell profile so `ohi` works in new terminals too.
Run the same command again to update.
* PowerShell
Run this in Windows PowerShell 5.1 or PowerShell 7:
```powershell
irm https://ohi.dev/install.ps1 | iex
```
The [installer](https://github.com/NeverBlink-OSS/ohi/blob/main/cli/install.ps1) downloads the latest release, verifies its checksum and puts `ohi.exe` in `$HOME\.local\bin`. Accept its offer to add that directory to your PowerShell profile so `ohi` works in new terminals too.
Run the same command again to update.
## Check the installation
[Section titled “Check the installation”](#check-the-installation)
```sh
ohi version
```
You should see the installed version. Then [download your first ontology](/docs/getting-started/first-ontology/).
## Installer settings
[Section titled “Installer settings”](#installer-settings)
Both installers take the same environment variables:
| Variable | Effect |
| --------------------------------- | ---------------------------------------------------------------------------------------------- |
| `LINKML_SCALA_VERSION` | Install this release tag instead of the latest one. |
| `LINKML_SCALA_INSTALL_DIR` | Install into this directory instead of `~/.local/bin`. |
| `LINKML_SCALA_REQUIRE_CHECKSUM=1` | Refuse releases that publish no checksum file. Releases up to and including v0.12.0 have none. |
## Other ways to install
[Section titled “Other ways to install”](#other-ways-to-install)
### mise
[Section titled “mise”](#mise)
If you use the [mise](https://mise.jdx.dev/getting-started.html) tool manager, on any platform:
```sh
mise use 'ubi:NeverBlink-OSS/ohi[matching=ohi,exe=ohi]'
```
### Manual download
[Section titled “Manual download”](#manual-download)
Download the `ohi` binary for your system and architecture from [the latest release](https://github.com/NeverBlink-OSS/ohi/releases/latest).
On macOS and Linux, rename it, make it executable and run it:
```sh
mv ohi-- ohi
chmod +x ohi
./ohi version
```
On Windows, rename it and run it:
```powershell
ren ohi-windows-x86_64.exe ohi.exe
.\ohi.exe version
```
### Java
[Section titled “Java”](#java)
On other systems, download `ohi.jar` from the same release and run it with Java 17 or later:
```sh
java -jar ohi.jar version
```
## Verify a download
[Section titled “Verify a download”](#verify-a-download)
Each release publishes a `SHA256SUMS` file and a signed build provenance attestation, so you can check that a download came from our release workflow. The installers check the checksum for you. To check a manual download, see [Verifying downloads](https://linkml.ohi.dev/docs/verifying-downloads/).
# Contribute an ontology
> Prepare an ontology release and submit it to the ohi index.
Add an ontology release through a pull request in the [ohi index](https://github.com/NeverBlink-OSS/ohi-index).
## Choose a release
[Section titled “Choose a release”](#choose-a-release)
Use the version given on the ontology’s official website or in its source repository. If no version is given, ask in an issue.
Check the [index](https://github.com/NeverBlink-OSS/ohi-index/tree/main/ontologies) for that ontology and version. If it is already listed, report corrections in an issue and link to its folder.
Check that the license permits redistribution. Include the license text and required copyright notices. If no license is given, ask the publisher for permission.
## Prepare the files
[Section titled “Prepare the files”](#prepare-the-files)
Fork the index repository and create a branch. Put each release in its own folder at `ontologies////`.
The example uses [Obographs 0.0.1](https://github.com/biodatamodels/obograph), a LinkML schema already in the index:
```text
ontologies/biodatamodels/obograph/0.0.1/
├── ohi-package.yaml
├── obograph.yaml
├── LICENSE
└── README.md
```
The folder path has three parts:
* `namespace` groups entries in the index, here `biodatamodels`.
* `name` identifies the ontology within that group, here `obograph`.
* `version` is the publisher’s version, here `0.0.1`.
For another version of an indexed ontology, reuse its namespace and name. Ask in an issue if you are unsure which namespace to use for a new ontology.
Download [obograph.yaml](https://raw.githubusercontent.com/biodatamodels/obograph/5e37965de4affe91dec05928cf5abacb77a05a12/model/schema/obograph.yaml) and save the [CC0 license text](https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt) as `LICENSE`.
In `README.md`, link to the source release or commit and describe any changes to the upstream files. ohi publishes every file in the folder except `ohi-package.yaml`. Keep working notes and temporary files elsewhere.
## Write the manifest
[Section titled “Write the manifest”](#write-the-manifest)
Create `ohi-package.yaml` in the release folder:
```yaml
namespace: biodatamodels
name: obograph
version: "0.0.1"
language: linkml
syntax: yaml
roots: [obograph.yaml]
licenses: ["CC0-1.0"]
licenseFiles: [LICENSE]
dependencies: []
title: "Obographs LinkML model"
description: "A schema for ontology graphs with nodes, edges and metadata."
keywords: ["ontology graphs", "linkml"]
domains: [knowledge-representation]
authors:
- name: "Chris Mungall"
link: "https://mungall.dev"
- name: "Sierra Taylor Moxon"
link: "https://github.com/sierra-moxon"
publishers:
- name: "BioDataModels"
link: "https://github.com/biodatamodels"
originalSources: ["https://github.com/biodatamodels/obograph"]
```
Match `namespace`, `name` and `version` to the folder path. Quote `version` to keep it as text. `roots` must name exactly one ontology file.
Set `language` and `syntax` for the source file:
| | `language` | `syntax` |
| ------------ | ---------- | -------------------- |
| LinkML | `linkml` | `yaml` |
| Apache Ossie | `ossie` | `yaml` |
| OWL | `owl` | `turtle` or `rdfxml` |
| RDF Schema | `rdfs` | `turtle` |
Use [SPDX identifiers](https://spdx.org/licenses/) in `licenses` where available. List full license texts in `licenseFiles` and separate copyright notices in `copyrightFiles`, using paths relative to the release folder.
Pick the ontology’s thematic areas in `domains` from the [domain list](https://api.ohi.dev/files/domains_v1.json), by their ids. Unlike `keywords`, which can be anything, a domain must be in the list. Unknown, deprecated or repeated ids are refused. `domains` is optional.
List imported ontologies in `dependencies` as `namespace/name@version`. Each must already be published on ohi. Use `[]` when none are needed. The built-in `linkml:types` import does not need an entry.
Credit the creators in `authors` and the publisher in `publishers`. If you are neither an author nor a publisher, you must add yourself or your organization under `maintainers`. Include contact details and a GitHub profile URL containing your username:
```yaml
maintainers:
- name: "Your name or organization"
contact: "you@example.org"
link: "https://github.com/your-username"
```
## Use remote files
[Section titled “Use remote files”](#use-remote-files)
Use `sources` to reference ontology or license files by URL instead of committing them. For `obograph.yaml`, add this entry to `ohi-package.yaml`:
```yaml
sources:
- name: obograph.yaml
url: https://github.com/biodatamodels/obograph/blob/5e37965de4affe91dec05928cf5abacb77a05a12/model/schema/obograph.yaml
sha256: "97fc065721c761fb7f36fd800c00fda0cdff1b6a3734304ef5883cd6c19c5b5a"
size: 3389
```
With the above entry, commit `ohi-package.yaml`, `LICENSE` and `README.md` from the example. ohi downloads `obograph.yaml` from the URL, so leave that file out of the pull request. Keep `roots: [obograph.yaml]` to match the source’s `name`.
Pin the URL to a release or commit. GitHub file links are supported. Other URLs must use HTTPS and return the file without redirects. Each source filename must be unique across `sources` and files in the release folder. It may contain letters, digits, `.`, `_` or `-` and must start with a letter or digit.
Download the file and calculate its `sha256` hash and `size` in bytes:
```sh
shasum -a 256 obograph.yaml
wc -c < obograph.yaml
```
ohi checks both values when it fetches the file.
## Open a pull request
[Section titled “Open a pull request”](#open-a-pull-request)
Open a pull request against the index repository’s `main` branch with the ontology name, version and source link. Update the same branch to address review comments or failed checks.
After merging, check that the release and its downloads are available on [ohi.dev](https://ohi.dev/). Report missing releases or failed downloads in the pull request.
# Manage ontology projects
> Record your ontology choices and download the same files and dependencies again.
Use `ohi add` to keep track of the ontologies your project uses. Here we’ll add [DCAT 3](https://ohi.dev/o/w3c/dcat@3), which describes data catalogs, and download its dependencies.
## Create a project
[Section titled “Create a project”](#create-a-project)
```sh
ohi init city-catalog --default_format owl-turtle
cd city-catalog
```
This creates a `city-catalog` folder with your project settings in `ohi.yaml`. The `--default_format owl-turtle` option makes OWL in Turtle your preferred format. Leave out that option to use LinkML YAML instead.
## Add an ontology
[Section titled “Add an ontology”](#add-an-ontology)
```sh
ohi add w3c/dcat@3
```
You’ll find DCAT at `.ohi/w3c/dcat/3/dcat.owl.ttl`. Its dependencies, Dublin Core Terms, SKOS and PROV-O, are downloaded into their own folders under `.ohi/`. ohi records your choice in `ohi.yaml` and the exact files and checksums in `ohi.lock.json`.
Run `ohi add` again to add more ontologies. Leave out `@3` to choose the latest version. ohi saves that version in `ohi.yaml`.
Use `--format linkml-yaml` to choose LinkML YAML for an addition. The [CLI reference](/docs/reference/cli/#ontology-references-and-formats) lists the available formats and defaults.
## Revisions
[Section titled “Revisions”](#revisions)
`ohi.lock.json` keeps the [revision](/docs/reference/cli/#ontology-references-and-formats) it locked for each version. `ohi sync`, `ohi lock` and adding other ontologies never move it to a newer revision. To take the latest revisions, run:
```sh
ohi lock --upgrade
ohi sync
```
## Restore a project on another machine
[Section titled “Restore a project on another machine”](#restore-a-project-on-another-machine)
Keep `ohi.yaml` and `ohi.lock.json` in version control. After cloning the project on another machine, run this from the folder containing those files:
```sh
ohi sync
```
ohi downloads the files recorded in `ohi.lock.json` into the project’s download folder, `.ohi/` by default. Files already present are checked against the saved checksums and reused.
If `ohi.yaml` has changed since the lock was made, `ohi sync` updates the lock first. In CI, use `ohi sync --locked` to fail instead, or `ohi lock --check` to check the lock without downloading. `ohi sync --frozen` installs the lock as it is, without comparing it to `ohi.yaml`.
If someone shares only `ohi.lock.json`, the same command downloads its files into `.ohi/`. To also create an editable `ohi.yaml` from that lock, run:
```sh
ohi sync --init
```
ohi creates `.ohi/.gitignore` to keep downloads out of Git. Edit that file if you want to commit the downloads too. Keep schemas you write yourself outside `.ohi/`.
## Change an ontology’s format
[Section titled “Change an ontology’s format”](#change-an-ontologys-format)
To switch DCAT from Turtle to LinkML YAML, first check which formats DCAT 3 provides:
```sh
ohi inspect w3c/dcat@3
```
Under **Files**, look for the **Format** entries. The output includes `linkml-yaml`, so you can use that value in your project. Open `ohi.yaml` and change DCAT’s `format` from `owl-turtle` to `linkml-yaml`:
```yaml
format_version: 1
default_format: owl-turtle
download_dir: .ohi
dependencies:
- ontology: w3c/dcat@3
format: linkml-yaml
```
The `format` under DCAT applies to that dependency. `default_format` remains the preference for future `add` and `get` commands. You can edit it too if you want future downloads to prefer LinkML.
Apply your change:
```sh
ohi sync
```
This updates `ohi.lock.json` and downloads DCAT and its dependencies in LinkML YAML. The earlier Turtle files stay in place.
To change versions, follow the same steps with the release you want. For example, run `ohi inspect w3c/dcat@2`, check its formats, then replace `ontology: w3c/dcat@3` with `ontology: w3c/dcat@2` in `ohi.yaml` and run `ohi sync`. Each version has its own download folder.
## Choose another download directory
[Section titled “Choose another download directory”](#choose-another-download-directory)
You can choose a custom download folder when you create a project:
```sh
ohi init another-catalog --to ontologies
```
This saves `download_dir: ontologies` in `ohi.yaml`, so downloads go into `another-catalog/ontologies/`.
## Import a downloaded LinkML schema
[Section titled “Import a downloaded LinkML schema”](#import-a-downloaded-linkml-schema)
After downloading the LinkML format, you can import it from a schema next to `ohi.yaml`. With the default `.ohi/` download folder, use:
```yaml
imports:
- .ohi/w3c/dcat/3/dcat.linkml
```
If you chose `ontologies/` as your download folder, use `ontologies/w3c/dcat/3/dcat.linkml` instead. Import paths start from the schema containing them. A schema in `models/` would therefore use `../.ohi/w3c/dcat/3/dcat.linkml` for the default download folder.
A downloaded schema may import dependencies using other paths or URLs. If ohi LinkML cannot find one, use an [import map](https://linkml.ohi.dev/docs/import-maps/) to point that import to the downloaded file.
# Request an ontology
> Ask for an ontology or a new release to be added to ohi.
Use the [ontology request form](https://github.com/NeverBlink-OSS/ohi-index/issues/new?template=ontology-request.yml) to ask for an ontology or a new release to be added to ohi. Include:
* The ontology’s name.
* A link to its official website or source repository.
* A version, if you need a particular release.
* What you want to use it for.
You do not need to prepare any files. Keep follow-up information and questions in the same issue.
You may speed up the process of having the ontology added to the index [by packaging it yourself](/docs/guides/contributing-ontologies/).
# Find and inspect ontologies
> Search ohi.dev, check a publication's files and download the format you need.
Use `ohi search` to find an ontology, then `ohi inspect` to see its files and dependencies.
## Search by name or topic
[Section titled “Search by name or topic”](#search-by-name-or-topic)
```sh
ohi search dcat
```
This finds DCAT, an ontology for data catalogs. Search shows each ontology once, at its latest version. Each result shows its name, version, description and a link to its page on ohi.dev. Add `--all-releases` to search every release. Put multiword queries in quotes, such as `"data catalog"`.
To browse a particular namespace, use a filter:
```sh
ohi search '*' --filter-by 'namespace:=w3c'
```
To browse a thematic area, filter by its domain. `ohi domains` lists the domains and their ids:
```sh
ohi domains
ohi search '*' --filter-by 'domains:=health-and-medicine'
```
Search shows five results per page. For more results, request another page, or more results per page. This browses the second page of the catalog, with 20 results per page:
```sh
ohi search '*' --per-page 20 --page 2
```
## Inspect a publication
[Section titled “Inspect a publication”](#inspect-a-publication)
Use the ontology name and version from a search result:
```sh
ohi inspect w3c/dcat@3
```
Omit `@3` to inspect the latest version. You can also pass the publication URL shown by `search`.
Under **Versions**, `w3c/dcat@3 (latest)` comes first, followed by `w3c/dcat@2` and `w3c/dcat@1`. Under **Files**, you’ll find each artifact’s filename, format and download URL. For example, `dcat3.owl.ttl` contains OWL in Turtle (`owl-turtle`). Under **Dependencies**, you’ll see Dublin Core Terms, SKOS and PROV-O.
## Download a file
[Section titled “Download a file”](#download-a-file)
Use the ontology name and version from the result, with your chosen format:
```sh
ohi get w3c/dcat@3 --format owl-turtle
```
Without a project in the current directory, this saves `.ohi/w3c/dcat/3/dcat.owl.ttl`. If `ohi.yaml` is present there, `get` uses its `download_dir`. Add `--to ./ontologies` to save `ontologies/w3c/dcat/3/dcat.owl.ttl` instead. Omit `@3` to select the latest version.
To record this choice in a project and download its dependencies, follow [Manage ontology projects](/docs/guides/projects/).
# Use ohi with NVIDIA Auto Ontology
> Match the glossary terms NVIDIA Auto Ontology generates from your databases to standard ontologies such as schema.org, downloaded with ohi.
Use ohi to give the terms in [NVIDIA Auto Ontology](https://github.com/NVIDIA/auto-ontology) standard names and definitions. Auto Ontology reads your databases and builds an ontology that AI agents use to answer questions with SQL. On its own, it lets a language model name each term, so the names follow your table names and can differ between databases and teams. A standard ontology gives you agreed names and definitions to use instead.
ohi finds these ontologies, downloads them with their dependencies and pins their versions in a lock file. Everyone on your team then matches terms against the same files. This guide uses [schema.org](https://ohi.dev/o/schemaorg/schemaorg@30.1) and the Wide World Importers sample database from Auto Ontology’s quickstart.
To use other ontologies, search on [ohi.dev](/docs/guides/search/) or use `ohi search`.
## How ohi and Auto Ontology work together
[Section titled “How ohi and Auto Ontology work together”](#how-ohi-and-auto-ontology-work-together)
Auto Ontology can’t load an ontology directly: its [Apache Ossie](https://ossie.apache.org/) import expects tables, not concepts. So you match the terms yourself:
1. ohi downloads the ontologies as Apache Ossie YAML files. It writes down which ones you chose in `ohi.yaml`, and the exact files in `ohi.lock.json`.
2. You look up a standard concept for each Auto Ontology term in those files.
3. In Auto Ontology’s Glossary, you add the concept, its IRI and its definition to the term’s description, rename the term if you want to, and certify it.
## Before you begin
[Section titled “Before you begin”](#before-you-begin)
* [ohi installed](/docs/getting-started/install/).
* Auto Ontology running, with semantic compilation finished. Follow the [quickstart](https://github.com/NVIDIA/auto-ontology#quickstart), which loads the Wide World Importers database.
## Download the ontologies with ohi
[Section titled “Download the ontologies with ohi”](#download-the-ontologies-with-ohi)
1. Create a project that saves ontologies as Apache Ossie files in an `ontologies` folder:
```sh
ohi init ao-ontologies --default_format ossie-yaml --to ontologies
cd ao-ontologies
```
Ossie files are plain YAML with a name, an IRI and a description for each concept, so they’re easy to search.
2. Add your ontologies:
```sh
ohi add schemaorg/schemaorg@30.1
```
schema.org covers orders, invoices, products, people and places, which fits a sales database like Wide World Importers. Each ontology lands in its own folder, along with any ontologies it depends on.
3. Check that the files are there:
```sh
find ontologies -name '*.ossie.yaml'
```
In PowerShell, run `Get-ChildItem ontologies -Recurse -Filter *.ossie.yaml`. You should see one file, `schemaorg.ossie.yaml`.
4. Commit `ohi.yaml` and `ohi.lock.json` to git. Your teammates can then run `ohi sync` to get the exact same files, so everyone matches terms against the same concepts. Learn more in [Manage ontology projects](/docs/guides/projects/).
## Find a standard concept for each term
[Section titled “Find a standard concept for each term”](#find-a-standard-concept-for-each-term)
1. In Auto Ontology, open the **Glossary** to see the terms it generated, such as **Invoice**, **Invoice Line** and **Customer**.

2. Search the downloaded files for a word from the term’s name:
```sh
grep -ri -A3 -- '- concept: .*invoice' ontologies
```
In PowerShell, run `Get-ChildItem ontologies -Recurse -Filter *.ossie.yaml | Select-String '- concept: .*invoice' -Context 0,3`.
A concept’s entry looks like this:
```yaml
- concept: Invoice
type: EntityType
iri: schema:Invoice
description: A statement of the money due for goods or services; a bill.
```
Skip results without a `type` line, which only mention the concept, and data types such as `Text`, `Number` and `DateTime`, which describe column values.
3. Pick the concept that means the same thing as the term. Watch out for these cases:
* The names match, such as the term **Invoice** and schema.org `Invoice`. Check the definition anyway.
* A concept is named after one word of the term, such as `Invoice` for **Invoice Line**. These are often wrong: an invoice line isn’t an invoice. A better match for **Invoice Line** is `OrderItem`.
* Nothing matches. schema.org has no `Customer` or `Supplier` concept, for example. Try the term’s synonyms, or leave the term as it is.
4. Write out the concept’s full IRI. The `prefixes` list at the top of the file says what each short prefix stands for. In schema.org, `schema:Invoice` is `https://schema.org/Invoice`.
## Update the terms in Auto Ontology
[Section titled “Update the terms in Auto Ontology”](#update-the-terms-in-auto-ontology)
1. Keep a copy of the model as it is now. In Auto Ontology, go to **Settings > Import / Export**. Under **Export Model**, choose **Native Auto Ontology** and select **Export**.
2. In the **Glossary**, select a term you matched, such as **Invoice Line**, and select **Edit**.
3. To rename the term, change its name.
4. At the end of the description, add a paragraph with the concept, its full IRI, the ontology it comes from and the first sentence of its definition:
```text
Standard term: OrderItem (https://schema.org/OrderItem) from schemaorg/schemaorg@30.1 on ohi.dev. An order item is a line of an order.
```
Starting each paragraph with `Standard term:` makes them easy to find and update later.
5. Save your changes, then do the same for the other terms you matched.
Auto Ontology updates its search index for each term you change, so the agent finds the new names and descriptions straight away. If you can’t edit a term, ask an Auto Ontology admin to check your role. If you have many terms to update, ask on [Discord](https://discord.gg/DNZXS35cd2) for help.
## Check that Auto Ontology uses the new terms
[Section titled “Check that Auto Ontology uses the new terms”](#check-that-auto-ontology-uses-the-new-terms)
1. In the **Glossary**, select a term you updated and select **Edit** to see its whole description. The Glossary list shows only the first three lines, so the `Standard term` paragraph is often cut off.

2. Certify the term’s name and description once you’re happy with them, using the certification control next to each one.
3. Ask a question in **Chat**, such as the one from the quickstart:
> What was revenue for the USB food flash drive - sushi roll in Pennsylvania in June 2015?
The answer shows its SQL and the steps the agent took. Check that it still finds the right tables, especially for terms you renamed.
## Update the ontologies
[Section titled “Update the ontologies”](#update-the-ontologies)
1. Find the latest version with `ohi inspect `, for example `ohi inspect schemaorg/schemaorg`.
2. Change the version in `ohi.yaml` and run `ohi sync`.
3. The new version goes into a new folder, named after its version. Delete the old version’s folder, so your searches don’t find both.
4. For each term with a `Standard term` paragraph, look up the concept in the new files and update the paragraph’s version, IRI and definition.
## Clean up
[Section titled “Clean up”](#clean-up)
* To undo a change, edit the term again: put back its old name and remove the `Standard term` paragraph. Your exported copy shows what the term looked like before.
* To remove the ontologies, delete the `ontologies` folder. `ohi sync` brings them back.
## Get help
[Section titled “Get help”](#get-help)
NeverBlink, the team behind ohi, maintains this guide, not NVIDIA. If something does not work, open an [ohi issue](https://github.com/NeverBlink-OSS/ohi/issues) or ask on [Discord](https://discord.gg/DNZXS35cd2). For problems with Auto Ontology itself, use the [Auto Ontology issue tracker](https://github.com/NVIDIA/auto-ontology/issues).
Found this guide useful?
[Star ohi on GitHub](https://github.com/NeverBlink-OSS/ohi) so other teams can find it too.
## Resources
[Section titled “Resources”](#resources)
* [ohi.dev ontology catalog](https://ohi.dev/)
* [ohi on GitHub](https://github.com/NeverBlink-OSS/ohi)
* [schema.org on ohi.dev](https://ohi.dev/o/schemaorg/schemaorg@30.1)
* [NVIDIA Auto Ontology on GitHub](https://github.com/NVIDIA/auto-ontology)
# Use ohi with Cognee
> Download standard OWL ontologies such as FOAF and W3C Organization with ohi and load them into Cognee.
Use ohi to give [Cognee](https://github.com/topoteretes/cognee) standard ontologies in OWL format. Cognee turns documents, chats or code into knowledge graphs used by AI agents. On its own, Cognee makes up labels for the people, companies and other things it finds, so the same thing can end up with different labels. An ontology gives it a fixed set of terms to use instead.
ohi finds these ontologies, downloads them with their dependencies and pins their versions in a lock file. Everyone on your team then loads the same files, so everyone’s graph uses the same terms. This guide uses [W3C Organization](https://ohi.dev/o/w3c/org@2014) and [FOAF](https://ohi.dev/o/foaf/foaf@2014-01-14).
To use other ontologies, search on [ohi.dev](/docs/guides/search/) or use `ohi search`.
## How ohi and Cognee work together
[Section titled “How ohi and Cognee work together”](#how-ohi-and-cognee-work-together)
1. ohi downloads the ontologies as `.owl` files. It writes down which ones you chose in `ohi.yaml`, and the exact files in `ohi.lock.json`.
2. Your script gives Cognee the paths to those files.
3. When Cognee reads your data, it checks each thing it finds against the ontologies.
## Before you begin
[Section titled “Before you begin”](#before-you-begin)
* Python 3.10 to 3.14.
* [ohi installed](/docs/getting-started/install/).
* [Cognee installed](https://docs.cognee.ai/getting-started/installation).
## Download the ontologies with ohi
[Section titled “Download the ontologies with ohi”](#download-the-ontologies-with-ohi)
1. Create a project that saves ontologies as `.owl` files in an `ontologies` folder:
```sh
ohi init cognee-ontologies --default_format owl-turtle --to ontologies
cd cognee-ontologies
```
Cognee’s documentation uses `owl-rdfxml`, but `owl-turtle` works just as well and it is much easier to read and review.
2. Add your ontologies:
```sh
ohi add w3c/org@2014
ohi add foaf/foaf@2014-01-14
```
Each one lands in its own folder, such as `ontologies/w3c/org/2014/`, along with any ontologies it depends on.
3. Check that the files are there:
```sh
find ontologies -name '*.owl*'
```
In PowerShell, run `Get-ChildItem ontologies -Recurse -Filter *.owl*`. You should see two files, `org.owl.ttl` and `foaf.owl.ttl`.
4. Commit `ohi.yaml` and `ohi.lock.json` to git. Your teammates can then run `ohi sync` to get the exact same files, so everyone’s graph uses the same ontology terms. Learn more in [Manage ontology projects](/docs/guides/projects/).
## Load your data into Cognee with the ontologies
[Section titled “Load your data into Cognee with the ontologies”](#load-your-data-into-cognee-with-the-ontologies)
This is the script from [Cognee’s Ontology Quickstart](https://docs.cognee.ai/guides/ontology-support), with `ontology_path` pointed at the files you just downloaded and the `forget` line commented out.
1. Save this script as `ontology_quickstart.py` in the project folder.
**Careful:** `cognee.forget(everything=True)` deletes everything Cognee has stored on your computer.
```python
import asyncio
from pathlib import Path
import cognee
from cognee.modules.ontology.ontology_config import Config
from cognee.modules.ontology.rdf_xml.RDFLibOntologyResolver import RDFLibOntologyResolver
async def main():
# Uncomment to start from a clean state. This deletes all Cognee data.
# await cognee.forget(everything=True)
texts = ["Winnie the Pooh works at Tesla as head of eco-honey program."]
# Changed ontology_path: every .owl file ohi downloaded.
ontology_path = [
str(p) for p in Path(__file__).parent.glob("ontologies/**/*.owl*")
]
# Create full config structure manually
config: Config = {
"ontology_config": {
"ontology_resolver": RDFLibOntologyResolver(ontology_file=ontology_path)
}
}
# self_improvement=False skips Cognee's extra enrichment pass, which makes more LLM calls.
# The graph is built either way.
await cognee.remember(texts, config=config, self_improvement=False)
if __name__ == "__main__":
asyncio.run(main())
```
2. Run it:
```sh
python ontology_quickstart.py
```
To try it on your own data, replace `texts` with your own text. You can also pass a file path, or a list of paths.
The script loads every ontology file under `ontologies/`, so ontologies you add later are picked up automatically.
## Check that Cognee used your ontologies
[Section titled “Check that Cognee used your ontologies”](#check-that-cognee-used-your-ontologies)
The easiest way to check is to look at the graph. Save this as `show_graph.py` in the project folder, run it with `python show_graph.py`, and open `graph.html` in your browser:
```python
import asyncio
import cognee
asyncio.run(cognee.visualize_graph("graph.html"))
```

Pink nodes with a green ring come from your ontologies. Here, Winnie the Pooh is linked to `person` and the eco-honey program to `project`, both from FOAF. Tesla is linked to `formalorganization` from W3C Organization. That term comes from `ontologies/w3c/org/2014/org.owl`, the file ohi downloaded.
Click a node with a green ring to see where it came from. Here, `person` groups Winnie the Pooh and is marked **ontology valid**, so Cognee took it from FOAF.

If no node has a green ring, check the start of Cognee’s log. If there are no `Ontology loaded successfully` lines, Cognee didn’t find the files: check that the script is next to `ohi.yaml` and that the `ontologies` folder has `.owl` or `.owl.ttl` files in it.
## Update the ontologies
[Section titled “Update the ontologies”](#update-the-ontologies)
1. Find the latest version with `ohi inspect `, for example `ohi inspect w3c/org`.
2. Change the version in `ohi.yaml` and run `ohi sync`.
3. The new version goes into a new folder, named after its version. Delete the old version’s folder, so the script doesn’t load both.
4. Delete the old graph and build it again with the new terms: add `await cognee.forget(dataset="main_dataset")` at the start of `main()` and run the script. If you use Cognee inside an app that keeps running, restart it.
## Clean up
[Section titled “Clean up”](#clean-up)
* To delete everything Cognee stored, uncomment the `cognee.forget(everything=True)` line in the script and run it again.
* To remove the ontologies, delete the `ontologies` folder. `ohi sync` brings them back.
## Get help
[Section titled “Get help”](#get-help)
NeverBlink, the team behind ohi, maintains this guide, not the Cognee team. If something does not work, open an [ohi issue](https://github.com/NeverBlink-OSS/ohi/issues) or ask on [Discord](https://discord.gg/DNZXS35cd2). For problems with Cognee itself, use the [Cognee issue tracker](https://github.com/topoteretes/cognee/issues).
Found this guide useful?
[Star ohi on GitHub](https://github.com/NeverBlink-OSS/ohi) so other teams can find it too.
## Resources
[Section titled “Resources”](#resources)
* [ohi.dev ontology catalog](https://ohi.dev/)
* [ohi on GitHub](https://github.com/NeverBlink-OSS/ohi)
* [Cognee on GitHub](https://github.com/topoteretes/cognee)
* [Cognee Ontology Quickstart](https://docs.cognee.ai/guides/ontology-support)
# Use ohi with AWS Context Ontology Accelerator
> Load ontologies into AWS Context Ontology Accelerator (COA) as reference ontologies with ohi.
Use ohi to load standard ontologies into AWS [Context Ontology Accelerator](https://github.com/aws/context-ontology-accelerator) (COA). It builds an ontology from your data, and based on loaded reference ontologies reuses existing terms instead of making up new ones.
ohi finds these ontologies, downloads them with their dependencies and pins their versions in a lock file. Everyone on your team then loads the same files. This guide uses [W3C Organization](https://ohi.dev/o/w3c/org@2014) and [PROV-O](https://ohi.dev/o/w3c/prov-o@2013).
To use other ontologies, search on [ohi.dev](/docs/guides/search/) or use `ohi search`.
## How ohi and COA work together
[Section titled “How ohi and COA work together”](#how-ohi-and-coa-work-together)
1. `ohi add` downloads the ontologies you choose as OWL Turtle (`.ttl`) files. It records them in `ohi.yaml` and pins the exact files in `ohi.lock.json`.
2. You upload the files to COA, which calls them *reference ontologies*.
3. COA builds its ontology from your data in a step called *induction*. During induction, it links your classes to matching terms in the reference ontologies with `rdfs:subClassOf` or SKOS match links. COA calls this *grounding*. A `staff` table can then point to an existing class instead of becoming a new `Staff` class.
4. Because the lock file pins the exact files, anyone can run `ohi sync` to get the same ones and load them into another COA namespace or account.
## Before you begin
[Section titled “Before you begin”](#before-you-begin)
* [ohi installed](/docs/getting-started/install/).
* [COA deployment](https://github.com/aws/context-ontology-accelerator/blob/main/external-docs/content/deploying.md).
* A COA user with the `platform-admin` role, or `namespace-owner` on an existing namespace.
* At least one data source registered in that namespace.
## Download the ontologies with ohi
[Section titled “Download the ontologies with ohi”](#download-the-ontologies-with-ohi)
1. Create a project that downloads OWL Turtle files into an `ontologies` folder:
```sh
ohi init coa-ontologies --default_format owl-turtle --to ontologies
cd coa-ontologies
```
2. Add your ontologies:
```sh
ohi add w3c/org@2014
ohi add w3c/prov-o@2013
```
Each one lands in its own folder, such as `ontologies/w3c/org/2014/`, along with any ontologies it depends on.
3. Check that the files are there:
```sh
find ontologies -name '*.ttl'
```
In PowerShell, use `Get-ChildItem ontologies -Recurse -Filter *.ttl`. You should see one file per ontology, plus one per dependency.
4. Commit `ohi.yaml` and `ohi.lock.json`. Anyone who runs `ohi sync` in this folder then gets the same files, checked against the same checksums. See [Manage ontology projects](/docs/guides/projects/) for more.
## Create a namespace in COA
[Section titled “Create a namespace in COA”](#create-a-namespace-in-coa)
Skip this if you already have one.
1. Log in to the COA console as a `platform-admin` user.
2. Go to **Administration** > **Namespaces** > **Create namespace**.
3. Enter required data and choose a language.
4. Click **Create namespace**, **Confirm namespace language**, then click **Confirm and create**.
## Upload the reference ontologies to COA
[Section titled “Upload the reference ontologies to COA”](#upload-the-reference-ontologies-to-coa)
1. In the COA console, open your namespace and go to **Ontology** > **Induction**.
2. In the ontology upload area, upload each `.ttl` file from `ontologies/`.
3. Check that they all appear on the **Reference ontologies** tab.
## Start induction with your ontologies
[Section titled “Start induction with your ontologies”](#start-induction-with-your-ontologies)
1. On the **Induction** page, click **Start induction**.
2. Leave **Strategy** as **Table to Ontology**.
3. Under **Data sources**, select your data sources.
4. Under **Grounding ontologies (optional)**, select the reference ontologies you uploaded. If you have accepted an induction result in this namespace before, the console selects that one too. Leave it like that.
5. Click **Start induction**.

## Check that COA used your ontologies
[Section titled “Check that COA used your ontologies”](#check-that-coa-used-your-ontologies)
COA shows the ontology it suggests as a *proposal*. When induction finishes, open it. Classes that match your reference ontologies now link to their terms. In the example, those links point to IRIs starting with `http://www.w3.org/ns/org#` or `http://www.w3.org/ns/prov#`.
If nothing links:
* Check that you selected the reference ontologies before starting induction.
* Your tables may not match them. Try ontologies closer to your data.
## Keep the ontologies up to date
[Section titled “Keep the ontologies up to date”](#keep-the-ontologies-up-to-date)
1. Find the latest version with `ohi inspect `, for example `ohi inspect w3c/org`.
2. Change the version in `ohi.yaml` and run `ohi sync`.
3. Upload the new files, delete the old ones on **Explorer** > **Ontologies**, and run induction again.
## Clean up
[Section titled “Clean up”](#clean-up)
* To remove just the ontologies, delete them in **Explorer** > **Ontologies**.
* To remove a test deployment, run `make destroy-dev` in your COA clone. It may take some time to delete.
## Get help
[Section titled “Get help”](#get-help)
NeverBlink, the team behind ohi, maintains this guide, not AWS. If something does not work, open an [ohi issue](https://github.com/NeverBlink-OSS/ohi/issues) or ask on [Discord](https://discord.gg/DNZXS35cd2). For problems with COA itself, use the [COA issue tracker](https://github.com/aws/context-ontology-accelerator/issues).
Found this guide useful?
[Star ohi on GitHub](https://github.com/NeverBlink-OSS/ohi) so other teams can find it too.
## Resources
[Section titled “Resources”](#resources)
* [ohi.dev ontology catalog](https://ohi.dev/)
* [ohi on GitHub](https://github.com/NeverBlink-OSS/ohi)
* [COA on GitHub](https://github.com/aws/context-ontology-accelerator)
# CLI commands
> Arguments, options and defaults for the ohi CLI.
Run `ohi --help` for the command overview, or `ohi --help` for a command’s options.
| Command | Purpose |
| --------------------- | -------------------------------------------------------------- |
| [`search`](#search) | Find ontologies by name or topic. |
| [`inspect`](#inspect) | Show a release’s files and dependencies. |
| [`domains`](#domains) | List the domains, the thematic areas that ontologies can have. |
| [`get`](#get) | Download one ontology file. |
| [`init`](#init) | Create `ohi.yaml`. |
| [`add`](#add) | Add an ontology to a project and download its dependencies. |
| [`sync`](#sync) | Download and verify project ontologies. |
| [`lock`](#lock) | Rebuild `ohi.lock.json` from `ohi.yaml`. |
| [`linkml`](#linkml) | Work with local schemas. |
| [`version`](#version) | Print the installed version. |
## Shared options
[Section titled “Shared options”](#shared-options)
| Option | Available on | Effect |
| ----------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------- |
| `-h`, `--help` | All commands | Show help. |
| `--json` | `search`, `inspect`, `domains`, `get`, `init`, `add`, `sync`, `lock` | Write JSON output. |
| `--timeout-ms ` | `search`, `inspect`, `domains`, `get`, `sync` | Positive request timeout in milliseconds. Default `30000`. |
## Ontology references and formats
[Section titled “Ontology references and formats”](#ontology-references-and-formats)
`inspect`, `get` and `add` accept `namespace/name[@version]` from ohi.dev, such as `w3c/prov-o@2013`. Without `@version`, they select the latest version.
`get` and `add` use `default_format` from `ohi.yaml`, or `linkml-yaml` if there is no project. If the preferred format is unavailable, they try `linkml-yaml`. Use `--format` to require a specific format:
| Value | Language | Syntax | Filename suffix |
| -------------- | ------------ | ------- | --------------- |
| `owl-turtle` | OWL | Turtle | `.owl.ttl` |
| `owl-rdfxml` | OWL | RDF/XML | `.owl` |
| `rdfs-turtle` | RDFS | Turtle | `.rdfs.ttl` |
| `linkml-yaml` | LinkML | YAML | `.linkml.yaml` |
| `ossie-yaml` | Apache Ossie | YAML | `.ossie.yaml` |
| `shacl-turtle` | SHACL | Turtle | `.shacl.ttl` |
The release must provide exactly one file in the requested format. ohi does not search older releases when a format is unavailable.
Published versions may be corrected with a revision, such as `w3c/prov-o@2013-revision-2026-12-01`. By default, the latest revision is selected, unless an exact revision is requested. To opt out of revisions completely, add `-no-revision`, for example `w3c/prov-o@2013-no-revision`.
## search
[Section titled “search”](#search)
`ohi search [options]`
Returns one page of matches from ohi.dev, one per ontology at its latest version. Quote multiword queries. Use `'*'` to browse.
```sh
ohi search 'energy' --filter-by 'namespace:=saref' --per-page 5
```
| Option | Effect |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `--page ` | Page to return, starting at `1`. Default `1`. |
| `--per-page ` | Matches per page, from `1` to `250`. Default `5`. |
| `--filter-by ` | Filter matches, for example `namespace:=saref`. |
| `--sort-by ` | Order matches, for example `published_at:desc`. |
| `--facet-by ` | Count values for comma-separated fields, such as `namespace`. |
| `--max-facet-values ` | Maximum values per facet, at least `1`. Omit to use the search service’s default. |
| `--all-releases` | Search every release instead of each ontology’s latest version. |
| `--search-url ` | Complete search endpoint for another catalog, ending in `/search/collections/packages/documents/search`. Requires `--query-by`. |
| `--query-by ` | Comma-separated search fields for that catalog. Requires `--search-url`. |
| `--color ` | Color terminal output. Default `auto`. |
Use `--page 2` with the same query and options to request the next page. A cutoff warning means the results or counts may be incomplete.
## inspect
[Section titled “inspect”](#inspect)
```text
ohi inspect [options]
ohi inspect [options]
```
Shows a release’s metadata, all files, formats and dependencies. Releases on ohi.dev link to their pages there. For a reference, terminal output also lists the ontology’s versions, latest first.
```sh
ohi inspect w3c/prov-o@2013
ohi inspect https://api.ohi.dev/files/packages/w3c/prov-o/2013/
```
## domains
[Section titled “domains”](#domains)
`ohi domains [options]`
Lists the domains, the thematic areas that ontologies can have, by group, each with its id and title, marked if it is deprecated. `--verbose` shows all domains information, like their descriptions and why a deprecated domain is retired.
Releases hold the ids of their domains. Find the releases with a domain by its id:
```sh
ohi search '*' --filter-by 'domains:=health-and-medicine'
```
`--json` writes the domain list as the hub serves it.
| Option | Effect |
| -------------------- | -------------------------------------------------------------------------------------------------------- |
| `-v`, `--verbose` | Show all domains information, like their descriptions. |
| `--search-url ` | Complete search endpoint of another catalog, as for `search`. The domain list is read from the same hub. |
## get
[Section titled “get”](#get)
```text
ohi get [--format ] [options]
ohi get [options]
```
Downloads one ontology file from a reference or Hub file URL.
```sh
ohi get w3c/prov-o@2013 --format owl-turtle
```
| Option | Effect |
| ------------------- | ----------------------------------------------------------------------------------------- |
| `--format ` | Require a format for an ontology reference. Omit with a file URL. |
| `--to ` | Choose a download folder for this command. Relative paths start at the current directory. |
Downloads go into `download_dir` from the current directory’s `ohi.yaml`, or `.ohi/` if there is no project. With the default folder, this example saves `.ohi/w3c/prov-o/2013/prov-o.owl.ttl`. See [Downloaded files](/docs/reference/project-files/#downloaded-files) for naming and Git settings.
Files are verified using SHA-256 checksums. Matching local files are reused. If a local file has changed, ohi stops and reports its path. Move or delete that file, then retry.
## init
[Section titled “init”](#init)
`ohi init [directory] [--default_format ] [--to ] [--json]`
Creates [`ohi.yaml`](/docs/reference/project-files/#ohiyaml) with an empty dependency list. The project directory defaults to the current directory.
```sh
ohi init my-project --to ontologies
```
| Option | Effect |
| --------------------------- | ------------------------------------------------ |
| `--default_format ` | Set the preferred format. Default `linkml-yaml`. |
| `--to ` | Set the download subfolder. Default `.ohi`. |
The example sets the download folder to `my-project/ontologies/`. You can edit both settings later in `ohi.yaml`.
## add
[Section titled “add”](#add)
```text
ohi add [--format ] [options]
ohi add --artifact [options]
```
Adds the ontology’s version and format to `ohi.yaml`, updates `ohi.lock.json`, and downloads the project’s ontologies and dependencies. `ohi.yaml` gets the version, and `ohi.lock.json` its latest revision. Adding an ontology doesn’t change the revisions locked for the others.
```sh
ohi add w3c/prov-o@2013 --format owl-turtle
```
| Option | Effect |
| ----------------------- | -------------------------------------------------------------------- |
| `--format ` | Require a format for an ontology reference. Omit with a release URL. |
| `--artifact ` | Required with a release URL. Select a file listed by `inspect`. |
| `--project ` | Existing project directory. Default is the current directory. |
Downloads use the project’s `download_dir`. If needed, `add` creates `ohi.yaml` with `default_format: linkml-yaml` and `download_dir: .ohi`.
For the URL form, use the release and file URLs shown by `ohi inspect `. `ohi.yaml` then gets exactly that release: a revision such as `2013-revision-2026-12-01`, or a version such as `2013-no-revision`.
See [Manage ontology projects](/docs/guides/projects/) for the complete workflow.
## sync
[Section titled “sync”](#sync)
`ohi sync [--project ] [--init] [--locked | --frozen] [options]`
Downloads missing files and verifies existing files using `ohi.lock.json`. If you changed the dependencies in `ohi.yaml`, or there is no lock yet, sync updates the lock before downloading. If a local file has changed, move or delete the reported file, then rerun `ohi sync`.
```sh
ohi sync --project ./my-project
```
| Option | Effect |
| ----------------------- | ------------------------------------------------------------------------------------------------------- |
| `--project ` | Directory containing `ohi.yaml`, `ohi.lock.json`, or both. Default is the current directory. |
| `--init` | Create `ohi.yaml` from a shared lock if it is missing. |
| `--locked` | Fail instead of updating `ohi.lock.json` when it is missing or doesn’t match `ohi.yaml`. |
| `--frozen` | Install `ohi.lock.json` as it is, without checking it against `ohi.yaml`. Fails if the lock is missing. |
| `--color ` | Color terminal output. Default `auto`. |
Downloads use `download_dir` from `ohi.yaml`. With only a lockfile, they go into `.ohi/`. A new `ohi.yaml` keeps the selected versions and formats, with `default_format: linkml-yaml` and `download_dir: .ohi`. If neither project file exists, start with `ohi init` or `ohi add`. Use `--locked` in CI to make sure the committed lock matches `ohi.yaml`.
## lock
[Section titled “lock”](#lock)
`ohi lock [--project ] [--check] [--upgrade] [--json]`
Rebuilds `ohi.lock.json` using the versions and formats in `ohi.yaml`, without downloading files. A version that is already locked keeps its locked revision. Use `--upgrade` to move every version to its latest revision.
```sh
ohi lock --project ./my-project
```
| Option | Effect |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `--project ` | Directory containing `ohi.yaml`. Default is the current directory. |
| `--check` | Only check that `ohi.lock.json` matches the dependencies in `ohi.yaml`. Fails if it doesn’t or if it is missing. Does not change any files. |
| `--upgrade` | Resolve every dependency again, to the latest revision of its version. Can’t be used with `--check`. |
## linkml
[Section titled “linkml”](#linkml)
Runs LinkML schema validation, conversion and generation commands. Use the complete command’s help for its arguments and options:
```sh
ohi linkml --help
ohi linkml validate --help
ohi linkml to json-schema --help
```
## version
[Section titled “version”](#version)
```sh
ohi version
```
Prints the installed ohi and component versions. `--format ` selects the output format. Default is `terminal`.
# API Stability and Compatibility
> Long-term API stability and compatibility for ohi SDKs and the CLI.
## API stability
[Section titled “API stability”](#api-stability)
From version 0.18.7 onward, you can pin your ohi SDK or CLI release. We maintain compatibility with those releases for a long time, so changes to [ohi.dev](https://ohi.dev) do not require an SDK upgrade.
If we need to make a breaking API change, we will introduce a new API version alongside the one your installed release uses.
## Published files
[Section titled “Published files”](#published-files)
A file on ohi.dev does not change after it is published. So a project with a committed [`ohi.lock.json`](/docs/reference/project-files/#ohilockjson) gets the same files every time.
## New formats and details
[Section titled “New formats and details”](#new-formats-and-details)
Non-breaking API changes preserve compatibility with existing clients. They include adding new [file formats](/docs/reference/cli/#ontology-references-and-formats) or optional metadata fields while keeping existing formats and fields available.
When reading responses from ohi.dev, older clients ignore additional metadata fields and skip files in formats they do not recognize. For example, if ohi.dev adds a new format, ohi 0.18.7 does not list those files, and `ohi get w3c/dcat@3 --format owl-turtle` still downloads the OWL Turtle file.
## Upgrading ohi
[Section titled “Upgrading ohi”](#upgrading-ohi)
A newer version of ohi can change its commands, options and SDK functions. If your scripts or code depend on them, stay on one version of ohi and read the [release notes](https://github.com/NeverBlink-OSS/ohi/releases) before you upgrade.
# Project files
> The fields and behavior of ohi.yaml and ohi.lock.json.
Keep both project files in version control:
| File | Contents |
| --------------- | ------------------------------------------------------------------------ |
| `ohi.yaml` | Your ontologies, their versions and formats, and project settings. |
| `ohi.lock.json` | Download URLs and checksums for those ontologies and their dependencies. |
For a walkthrough, see [Manage ontology projects](/docs/guides/projects/).
## ohi.yaml
[Section titled “ohi.yaml”](#ohiyaml)
This project uses PROV-O in Turtle format:
```yaml
format_version: 1
default_format: linkml-yaml
download_dir: .ohi
dependencies:
- ontology: w3c/prov-o@2013
format: owl-turtle
```
| Field | Meaning |
| ------------------------- | ---------------------------------------------------------------------------------------------------- |
| `format_version` | Project file version. Must be `1`. |
| `default_format` | Preferred format for `get` and `add` when you omit `--format`. |
| `download_dir` | Subfolder of the project directory where ontologies are downloaded. |
| `dependencies` | Ontologies added to the project. Use `[]` for an empty project. |
| `dependencies[].ontology` | Complete `namespace/name@version` [reference](/docs/reference/cli/#ontology-references-and-formats). |
| `dependencies[].format` | The dependency’s [file format](/docs/reference/cli/#ontology-references-and-formats). |
All fields are required. You can include several versions or formats of an ontology, but each reference and format pair must be unique.
After editing a dependency, run `ohi sync` to update the lock and downloads. Changing `default_format` affects future `get` and `add` commands, leaving the listed formats unchanged.
Adding a new entry with `ohi add` removes custom comments and resets formatting.
## ohi.lock.json
[Section titled “ohi.lock.json”](#ohilockjson)
`ohi add` updates the lock automatically. `ohi sync` uses it to restore downloads and updates it when the dependencies in `ohi.yaml` change.
| Field | Meaning |
| ---------------- | ------------------------------------------------------------ |
| `format_version` | Lock format. Must be `2`. |
| `selections` | Release and file URLs for the ontologies you added directly. |
| `files` | All files to download, including dependencies. |
Each file entry records its release URL (`base_url`), download URL (`url`), `format` and SHA-256 checksum (`sha256`).
Dependencies use the same format as the ontology you selected. For example, DCAT 3 in Turtle also requires Turtle files for Dublin Core Terms, SKOS and PROV-O.
Use [`ohi sync`](/docs/reference/cli/#sync) after cloning a project or receiving a shared lockfile.
## Downloaded files
[Section titled “Downloaded files”](#downloaded-files)
Downloads are grouped by namespace, ontology and version. For example, DCAT 3 in two formats:
```text
.ohi/w3c/dcat/3/dcat.linkml.yaml
.ohi/w3c/dcat/3/dcat.owl.ttl
```
The [format table](/docs/reference/cli/#ontology-references-and-formats) lists filename suffixes. A locked file in a format that your version of ohi does not know keeps the file name from its URL.
ohi creates a `.gitignore` inside the download folder to keep downloads out of Git, unless that file already exists. Edit it if you want to commit the downloads too. Keep files you write yourself outside this folder. `get --to` leaves ignore files unchanged.
# Seal of Quality
> What the Gold, Silver and Bronze seals on ohi.dev mean and where to find an ontology's quality details.
We award well written and maintained ontologies with quality seals to help you choose when several ontologies match your needs.
* **Gold** An excellent example for others.
* **Silver** A strong and thoughtful contribution.
* **Bronze** Promising work worth exploring.
On [ohi.dev](https://ohi.dev), the seal appears beside the ontology’s title and as a small badge in Search and Browse.
## What we consider
[Section titled “What we consider”](#what-we-consider)
We use quality measures to encourage and reward ontology maintainers who follow best practices to improve quality and usability.
Quality scoring is still experimental and heavily subject to change. We currently consider:
* **Term descriptions.** The share of terms with a description.
* **Metadata.** Whether it includes a title, description, license and version.
* **Reuse.** How other ontologies in the catalog depend on it.
We will continue gathering feedback on scoring and which signals to include. We also plan to offer additional, context-dependent measures for advanced users.
An ontology may have no seal because it has not been scored or has not met the current criteria.
## Quality details
[Section titled “Quality details”](#quality-details)
When available, open **Quality details** on the ontology’s page to see its assessment.
OMG Commons Annotation Vocabulary
# SDKs
> Search ohi.dev, inspect publications and download their files from Java, Scala, Python, TypeScript and Rust.
The ohi SDKs let Java, Scala, Python, TypeScript and Rust applications search publications on [ohi.dev](https://ohi.dev), inspect their metadata, download selected files and save file selections.
## Installation
[Section titled “Installation”](#installation)
* TypeScript
Node 20 or later, or a browser with Fetch. Browsers need CORS access to the catalog, publication and artifact endpoints.
* npm
```sh
npm i @neverblink/ohi
```
* pnpm
```sh
pnpm add @neverblink/ohi
```
* yarn
```sh
yarn add @neverblink/ohi
```
* Python
```sh
npm i @neverblink/ohi
```
* Java
```sh
pnpm add @neverblink/ohi
```
* Rust
```sh
yarn add @neverblink/ohi
```
* Scala
Python 3.10 or later:
```sh
python -m pip install ohi-sdk
```
* npm
Java 17 or later. The only dependency is Jackson 2, version 2.12 or later. It works with Jackson 3 as well.
```xml
eu.neverblink.ohi
ohi-sdk
VERSION
```
Or with Gradle: `implementation("eu.neverblink.ohi:ohi-sdk:VERSION")`. Replace `VERSION` with the release version.
* pnpm
Rust 1.85 or later. The crate is `ohi-sdk`; import it as `ohi`.
```sh
# blocking, with ureq
cargo add ohi-sdk
# async, with reqwest
cargo add ohi-sdk --no-default-features --features serde,reqwest
```
For another HTTP library, turn off both features, implement `ohi::HttpClient` or `ohi::AsyncHttpClient`, and pass it to `with_http`.
* yarn
The Scala modules are built from source and included in the [ohi CLI](https://github.com/NeverBlink-OSS/ohi/blob/main/cli/ohi/README.md). They are not published separately to Maven Central.
The CLI and the Java, Python, TypeScript and Rust packages all use the ohi LinkML release version.
## Quick start
[Section titled “Quick start”](#quick-start)
* Python
```python
from ohi import CatalogClient, SearchRequest
client = CatalogClient()
page = client.search(
SearchRequest(q="sensors", page=1, per_page=10)
)
if page.hits:
publication = client.inspect(page.hits[0].base_url)
artifact = publication.artifacts[0]
content = client.get(artifact.url)
```
* TypeScript
```typescript
import { CatalogClient } from "@neverblink/ohi";
const client = new CatalogClient();
const page = await client.search({
q: "sensors",
page: 1,
per_page: 10,
});
if (page.hits.length > 0) {
const publication = await client.inspect(page.hits[0].base_url);
const artifact = publication.artifacts[0];
const content = await client.get(artifact.url);
}
```
* Java
```java
import eu.neverblink.ohi.sdk.*;
CatalogClient client = new CatalogClient();
SearchRequest request = new SearchRequest();
request.setQ("sensors");
request.setPerPage(10L);
SearchResult page = client.search(request);
if (!page.getHits().isEmpty()) {
Publication publication = client.inspect(page.getHits().get(0).getBaseUrl());
Artifact artifact = publication.getArtifacts().get(0);
byte[] content = client.get(artifact.getUrl());
}
```
* Rust
```rust
use ohi::{CatalogClient, SearchRequest};
let client = CatalogClient::new();
let page = client.search(&SearchRequest {
page: Some(1),
per_page: Some(10),
..SearchRequest::new("sensors".into())
})?;
if let Some(hit) = page.hits.first() {
let publication = client.inspect(&hit.base_url)?;
let artifact = &publication.artifacts[0];
let content = client.get(&artifact.url)?;
}
```
`AsyncCatalogClient` has the same methods, but async: `client.search(&request).await?`.
## Language bindings
[Section titled “Language bindings”](#language-bindings)
* Python
`ohi.CatalogClient` is synchronous. `search`, `inspect`, `latest`, `get` and `domains` return `SearchResult`, `Publication`, `SearchHit | None`, `bytes` and `DomainList`, respectively.
* TypeScript
Import `CatalogClient` from `@neverblink/ohi`. `search`, `inspect`, `latest`, `get` and `domains` return promises of `SearchResult`, `Publication`, `SearchHit | undefined`, `Uint8Array` and `DomainList`, respectively.
* Java
`eu.neverblink.ohi.sdk.CatalogClient` is synchronous, and one client can be shared between threads. `search`, `inspect`, `latest`, `get` and `domains` return `SearchResult`, `Publication`, `Optional`, `byte[]` and `DomainList`, respectively. The classes of the data have a getter and a setter for each field, named after its JSON key in camel case, such as `getBaseUrl()`.
* Rust
`ohi::CatalogClient` is blocking, and `ohi::AsyncCatalogClient` is async. Both are thread-safe. `search`, `inspect`, `latest`, `get` and `domains` return a `Result` of `SearchResult`, `Publication`, `Option`, `Vec` and `DomainList`. Data types are structs with a public field per JSON key, and `Option` for optional fields. `published_at` is a string, such as `2026-10-13T10:30:00Z`.
* Scala
Use `eu.neverblink.ohi.catalog.CatalogClient` in `ohi.catalog.jvm`. `search`, `inspect`, `latest`, `get` and `domains` synchronously return `SearchResult`, `Publication`, `Option[SearchHit]`, `Array[Byte]` and `DomainList`, respectively.
## Search
[Section titled “Search”](#search)
Search uses ohi.dev by default and returns one hit per ontology, at its latest version. Set `all_releases` to true to search every release. Each call returns one page. Use `page` to request the next page, `per_page` to request up to 250 results, and `q="*"` to browse. See the [search options](https://github.com/NeverBlink-OSS/ohi/blob/main/model/ohi/search-request.yaml) for filtering, sorting and facets.
When a search reports `search_cutoff: true`, its results or counts may be incomplete.
`latest("w3c/dcat")` returns the search hit for the ontology’s latest version, or no hit if the catalog has no such ontology. `latest` and `inspect` read references, with or without a version, as the [CLI](/docs/reference/cli/#ontology-references-and-formats) does.
## Inspect and get
[Section titled “Inspect and get”](#inspect-and-get)
Pass a hit’s `base_url` or a reference such as `w3c/dcat@3` to `inspect`, choose an artifact in the format you need, then pass its `url` to `get`. Without a version, such as `w3c/dcat`, `inspect` returns the latest version. `get` returns the file’s bytes for your application to save or load. Dependency files must be selected and retrieved separately.
A known publication or artifact URL can be passed directly to `inspect` or `get`, without searching first.
## Domains
[Section titled “Domains”](#domains)
Publications and search hits hold their domains, the thematic areas of the ontology, as ids such as `health-and-medicine`. `domains` fetches the Hub’s [domain list](https://github.com/NeverBlink-OSS/ohi/blob/main/model/ohi/v2/domains.yaml) with the metadata of every domain and group. Each has an id and a title. A domain may also have a description and belong to one group. Ids are never removed or edited, so fetch the list again when you find an unknown one. A `deprecated` domain stays on old publications, but new ones can’t use it.
To find publications with a domain, filter the search by it, such as `domains:=health-and-medicine`. Facet on `domains` to count them per domain.
## Link to ohi.dev
[Section titled “Link to ohi.dev”](#link-to-ohidev)
To link a search hit or a publication to its release page on ohi.dev, such as `https://ohi.dev/o/w3c/sosa@2017`, pass it to the release page helper.
* Python
```python
from ohi import ohi_release_page
page_url = ohi_release_page(page.hits[0])
```
* TypeScript
```typescript
import { ohiReleasePage } from "@neverblink/ohi";
const pageUrl = ohiReleasePage(page.hits[0]);
```
* Java
```java
String pageUrl = Pages.ohiReleasePage(page.getHits().get(0));
```
It also takes a `Publication`, or a namespace, name and version.
* Rust
```rust
use ohi::ohi_release_page;
let page_url = ohi_release_page(&page.hits[0]);
```
It also takes a `Publication` or a `(namespace, name, version)` tuple.
* Scala
Use `OhiPages.releasePage` in `eu.neverblink.ohi.catalog`. It takes a `SearchHit`, a `Publication`, or a namespace, name and version.
## Configuration
[Section titled “Configuration”](#configuration)
Set `timeout_ms` to change the default 30000 ms timeout.
* Python
```python
from ohi import CatalogClient, CatalogConfig
client = CatalogClient(CatalogConfig(timeout_ms=60000))
```
* TypeScript
```typescript
import { CatalogClient } from "@neverblink/ohi";
const client = new CatalogClient({ timeout_ms: 60000 });
```
* Java
```java
CatalogConfig config = new CatalogConfig();
config.setTimeoutMs(60000L);
CatalogClient client = new CatalogClient(config);
```
* Rust
```rust
use ohi::{CatalogClient, CatalogConfig};
let client = CatalogClient::with_config(&CatalogConfig {
timeout_ms: Some(60000),
..CatalogConfig::default()
})?;
```
To override search settings, supply `search_url` and `query_by` together. Omitting both selects ohi.dev. Supplying only one is an error. A supplied `search_url` must end with `/search/collections/packages/documents/search`.
## Save and reload file selections
[Section titled “Save and reload file selections”](#save-and-reload-file-selections)
Supply all selected and dependency files with their hashes from publication metadata. The URLs and hash below are illustrative.
* Python
```python
from ohi import ArtifactSelection, Lock, LockedFile, read_lock, write_lock
selected = LockedFile(
base_url="https://hub.example/releases/energy/2/",
url="https://files.example/energy.ttl",
format="owl-turtle",
sha256="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
)
lock = Lock(
format_version=2,
selections=[ArtifactSelection(base_url=selected.base_url, url=selected.url)],
files=[selected],
)
write_lock("ohi.lock.json", lock)
saved = read_lock("ohi.lock.json")
```
Use `decode_lock` and `encode_lock` from `ohi` for JSON text. File paths accept a string or path-like object.
* TypeScript
```typescript
import type { Lock, LockedFile } from "@neverblink/ohi";
import { readLock, writeLock } from "@neverblink/ohi/node";
const selected: LockedFile = {
base_url: "https://hub.example/releases/energy/2/",
url: "https://files.example/energy.ttl",
format: "owl-turtle",
sha256: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
};
const lock: Lock = {
format_version: 2,
selections: [{ base_url: selected.base_url, url: selected.url }],
files: [selected],
};
await writeLock("ohi.lock.json", lock);
const saved = await readLock("ohi.lock.json");
```
File operations take a string path and return promises through the `/node` entry. Use `encodeLock` and `decodeLock` from `@neverblink/ohi` for JSON text. Browser applications supply their own storage.
* Java
```java
LockedFile selected = new LockedFile();
selected.setBaseUrl("https://hub.example/releases/energy/2/");
selected.setUrl("https://files.example/energy.ttl");
selected.setFormat("owl-turtle");
selected.setSha256("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
ArtifactSelection selection = new ArtifactSelection();
selection.setBaseUrl(selected.getBaseUrl());
selection.setUrl(selected.getUrl());
Lock lock = new Lock();
lock.setFormatVersion(2L);
lock.setSelections(List.of(selection));
lock.setFiles(List.of(selected));
Locks.write(Path.of("ohi.lock.json"), lock);
Lock saved = Locks.read(Path.of("ohi.lock.json"));
```
Use `Locks.decode` and `Locks.encode` for JSON text.
* Rust
```rust
use ohi::{read_lock, write_lock, ArtifactSelection, Lock, LockedFile};
let selected = LockedFile {
base_url: "https://hub.example/releases/energy/2/".into(),
url: "https://files.example/energy.ttl".into(),
format: "owl-turtle".into(),
sha256: Some("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".into()),
};
let selection = ArtifactSelection {
base_url: selected.base_url.clone(),
url: selected.url.clone(),
};
let lock = Lock {
format_version: 2,
selections: vec![selection.into()],
files: vec![selected],
};
write_lock("ohi.lock.json", &lock)?;
let saved = read_lock("ohi.lock.json")?;
```
For JSON text, use `decode_lock` and `encode_lock`. Paths are `AsRef`.
* Scala
Use `LockJson.decode` and `LockJson.encode` for JSON text. `LockFiles.read` and `LockFiles.write` take a `java.nio.file.Path`. Both APIs are in `eu.neverblink.ohi.model`.
[Version-1 locks](https://github.com/NeverBlink-OSS/ohi/blob/main/ohi/examples/selection.lock.json) omit hashes and remain supported. See the [lock schema](https://github.com/NeverBlink-OSS/ohi/blob/main/model/ohi/lock.yaml).
Create the parent directory before writing a lock. Writes replace an existing lock and preserve its contents on failure.
## Metadata
[Section titled “Metadata”](#metadata)
The ohi SDKs accept [revision 2 publication metadata](https://github.com/NeverBlink-OSS/ohi/blob/main/model/ohi/v2/package.yaml), illustrated by the synthetic [Sensors example](https://github.com/NeverBlink-OSS/ohi/blob/main/ohi/examples/sensors-package.json). Check the publication’s licenses and each artifact’s format and loading roots. Verify downloaded bytes against its `size_bytes` and `sha256` if needed. `get` does not perform that check.
## Failures
[Section titled “Failures”](#failures)
Catalog failures raise `CatalogException`. Lock validation and file failures raise `LockException`. Both expose an `.error` record with a `code` and explanatory `message`. In Java, they are unchecked exceptions, and the record is `getError()`. In Rust, they are the `Err` types, and the record is the `error` field. `decode_publication` fails with `InvalidMetadata`. See the [error schemas](https://github.com/NeverBlink-OSS/ohi/tree/main/model/ohi) for additional fields.
## HTTP behavior
[Section titled “HTTP behavior”](#http-behavior)
Use the final HTTP(S) URL for publications and files. Requests do not follow redirects or retry.