Skip to content

Ontology Access

All linkml-term-validator plugins use OAK (Ontology Access Kit) to access ontology data.

OAK Adapters

An adapter is OAK's abstraction for accessing ontology sources. Different adapters support different backends:

  • sqlite:obo: - Pre-downloaded OBO ontologies in SQLite format (default, fast, offline)
  • simpleobo: - Simple local OBO files (good for unit tests)
  • ols: - Ontology Lookup Service (online, no local download required)
  • bioportal: - NCBO BioPortal (requires API key)
  • ubergraph: - Ubergraph SPARQL endpoint
  • owl: - Local Functional OWL files (requires oaklib>=0.7.0rc7 for graph traversal)

Default Behavior

Without configuration, the validator uses sqlite:obo: as the default adapter, which automatically creates per-prefix adapters:

  • GO:0008150 → uses sqlite:obo:go
  • CHEBI:15377 → uses sqlite:obo:chebi
  • UBERON:0000468 → uses sqlite:obo:uberon

This works for any ontology the semantic-sql project publishes a database for.

Prefixes without a semantic-sql database

sqlite:obo:<prefix> only exists for ontologies that semantic-sql builds. A generic namespace such as dcterms, schema or skos has none, and nothing in a prefix says which kind it is. When a database fails to download or load, the validator asks the semantic-sql server (a single HEAD request, nothing downloaded) whether a database exists for that prefix:

  • No database, prefix not in oak_config.yaml: expected for a generic namespace. The prefix gets no adapter, and its terms are reported as not checked rather than as errors. They are listed as dcterms (no semantic-sql database) under "Unknown prefixes", are never counted as validated, and the run exits 0 unless --strict is set. Under linkml-validate, PermissibleValueMeaningPlugin reports every meaning it could not resolve at ERROR, these included, but with the message "Could not validate dcterms:title: the semantic-sql server has no database for dcterms" rather than "not found".
  • No database, prefix mapped to sqlite:obo: in oak_config.yaml: a configuration error. The run stops with exit code 3 and suggests another adapter.
  • The database exists, but the cached copy is broken (an interrupted or failed download): the run stops with exit code 3 and names the cached file to delete so it downloads again.

The validator never deletes files in OAK's cache, which other tools share. To check a generic namespace's terms, map its prefix to an adapter that has them in oak_config.yaml.

Per-Prefix Configuration

You can override the adapter for specific prefixes using an oak_config.yaml file:

ontology_adapters:
  GO: sqlite:obo:go           # Use local GO database
  CHEBI: "ols:"               # Use OLS for CHEBI (expanded to ols:chebi)
  MY_CUSTOM: simpleobo:my_ontology.obo  # Use local OBO file
  SKIP_THIS: ""               # Skip validation for this prefix

Important: When using oak_config.yaml, ONLY the prefixes listed in the config will be validated. Unlisted prefixes are reported as "unknown."

Using the Config File

CLI:

linkml-term-validator validate-schema --config oak_config.yaml schema.yaml
linkml-term-validator validate-data --config oak_config.yaml data.yaml --schema schema.yaml

Python API:

from linkml_term_validator.plugins import PermissibleValueMeaningPlugin

plugin = PermissibleValueMeaningPlugin(oak_config_path="oak_config.yaml")

Adapter Details

Uses pre-downloaded OBO ontologies in SQLite format.

Pros: - Fast queries (SQLite is efficient) - Works offline after initial download - No rate limiting - Consistent results

Cons: - Requires initial download - Takes disk space (~100MB-1GB per ontology) - Need to manually update for latest ontology versions

First-time setup:

The first time you validate with a new ontology, OAK will download and build the SQLite database. This can take a few minutes but only happens once.

simpleobo:

Uses local OBO files directly. Ideal for unit tests and custom ontologies.

Usage:

ontology_adapters:
  MY_CUSTOM: simpleobo:path/to/my_ontology.obo
  TEST: simpleobo:tests/data/test_ontology.obo

Pros: - Fast, lightweight - Perfect for testing - No network access required - Full control over ontology version

Cons: - Limited query capabilities compared to SQLite - Only works with OBO format - Need to manage OBO files yourself

ols:

Uses the Ontology Lookup Service (EBI). Online service, no local downloads.

Usage:

ontology_adapters:
  GO: "ols:"     # shorthand for ols:go
  CHEBI: "ols:"  # shorthand for ols:chebi

Pros: - No local downloads - Always uses latest ontology versions - Works out-of-the-box

Cons: - Requires internet connection - Slower than local adapters - Subject to rate limiting - Service availability dependence - Best used with progressive validation; greedy expansion requires descendant support and may be slow for large ontologies

ubergraph:

Uses the Ubergraph SPARQL endpoint. Online service, no local downloads.

Usage:

ontology_adapters:
  GO: "ubergraph:"
  CL: "ubergraph:"

Pros: - No local downloads - Supports graph traversal over OBO ontologies - Useful for integration checks against a shared endpoint

Cons: - Requires internet connection - Slower than local adapters - Service availability dependence

owl:

Uses local Functional OWL files.

Usage:

ontology_adapters:
  MY_CUSTOM: owl:path/to/my_ontology.ofn

Version note: graph traversal with owl: requires oaklib>=0.7.0rc7. With oaklib 0.6.23, the Functional OWL implementation does not expose the traversal methods needed by dynamic enum validation.

bioportal:

Uses NCBO BioPortal. Requires API key.

Setup:

Set BIOPORTAL_API_KEY environment variable:

export BIOPORTAL_API_KEY=your-api-key-here
linkml-term-validator validate-schema --config oak_config.yaml schema.yaml

Usage:

ontology_adapters:
  GO: "bioportal:"
  CHEBI: "bioportal:"

Unknown Prefixes

When the validator encounters a prefix it doesn't recognize (not in oak_config.yaml or not a known OBO ontology), it:

  1. Logs a warning
  2. Skips validation for that term
  3. Reports unknown prefixes at the end of validation

Example output:

⚠️  Unknown prefixes encountered (validation skipped):
  - MY_CUSTOM
  - INTERNAL

Consider adding these to oak_config.yaml to enable validation.

To fix: Add them to your oak_config.yaml:

ontology_adapters:
  MY_CUSTOM: simpleobo:path/to/ontology.obo
  INTERNAL: ""  # Or empty string to explicitly skip

See Also

  • Configuration - Complete configuration guide
  • Caching - How ontology data is cached
  • Validation Types - Understanding the validation plugins
  • Runnable provider examples in examples/oak_providers/