Skip to content

Getting Started

Five-minute success paths for common goals. Install pins: Install and channels. Limitations: Known limitations.

Rust API in 60 seconds

  1. Load with ontologos_parser::load_ontology (not Ontology::from_file).
  2. Build a Reasoner with Reasoner::builder().profile(...).build(ontology).
  3. Call ontologos_facade::classify(&mut reasoner) — not reasoner.classify() on core.
use ontologos_core::{Profile, Reasoner};
use ontologos_facade::{classify, ClassifyOutcome};
use ontologos_parser::load_ontology;

let ontology = load_ontology("family.owl".as_ref())?;
let mut reasoner = Reasoner::builder().profile(Profile::Auto).build(ontology)?;
match classify(&mut reasoner)? {
    ClassifyOutcome::Taxonomy(t) => println!("taxonomy: {}", t.subsumption_count()),
    ClassifyOutcome::Rdfs(r) => println!("rdfs inferred: {}", r.inferred_total()),
    ClassifyOutcome::Rl(r) => println!("rl inferred: {}", r.inferred_total()),
}

See Classify quick start and Rust integration contract.

Integration rules

Full contract: Rust integration contract.

Crates.io only (no clone)

Download a sample ontology, then build a minimal Rust project:

curl -L -o family.owl \
  https://raw.githubusercontent.com/eddiethedean/ontologos/main/benchmarks/data/family.owl
cargo new ontologos-demo && cd ontologos-demo

Add to Cargo.toml:

[dependencies]
ontologos-core = "1.1.4"
ontologos-parser = "1.1.4"
ontologos-rl = "1.1.4"

src/main.rs:

use ontologos_parser::load_ontology;
use ontologos_rl::rdfs::RdfsEngine;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut ontology = load_ontology(std::path::Path::new("family.owl"))?;
    let report = RdfsEngine::new().materialize(&mut ontology)?;
    println!(
        "mapped {} → {} axioms (inferred {})",
        report.initial_axiom_count,
        report.final_axiom_count,
        report.inferred_total()
    );
    Ok(())
}

Then cargo run.

Expected output (family.owl): mapped axioms ~57; inferred > 0. Counts differ from Protégé — see Known limitations.

For OWL RL saturation, add ontologos-rl = "1.1.4" and see OWL RL saturation.

I want to try it from a clone

  1. Clone and download benchmarks:
git clone https://github.com/eddiethedean/ontologos.git
cd ontologos
./benchmarks/scripts/download.sh
  1. Run the builder example:
cargo run -p ontologos-core --example pizza_builder
  1. Build the CLI and inspect an ontology:
cargo build -p ontologos-cli --release
./target/release/ontologos profile benchmarks/data/family.owl
./target/release/ontologos materialize benchmarks/data/family.owl

I want RDFS materialization

Follow RDFS materialization. Prefer CLI materialize over classify --profile rdfs — both run the same RDFS engine.

I want OWL RL saturation

Follow OWL RL saturation or run:

cargo run -p ontologos-rl --example rl_saturation

From a clone with the CLI built:

./target/release/ontologos classify --profile rl benchmarks/data/family.owl

Or use Python: Reasoner(path="family.owl", profile="rl").classify().

I'm integrating in Rust

Read Choosing an API then the guide for your workflow:

Goal Guide
Build ontologies in code First ontology
Load OWL files Load an OWL file
RDFS materialization RDFS materialization
OWL RL saturation OWL RL saturation
OWL EL classification OWL EL classification
JSON snapshots JSON snapshot v3 (v2 legacy)

I'm evaluating vs ELK / reasonable

See Comparison with existing tools and Conformance coverage.

I'm using Python

pip install ontologos
curl -L -o family.owl \
  https://raw.githubusercontent.com/eddiethedean/ontologos/main/benchmarks/data/family.owl
from ontologos import Reasoner, OntologyBuilder

# profile defaults to "auto" (EL taxonomy or RL saturation)
r = Reasoner(path="family.owl")
report = r.classify()

# In-memory ontology + incremental edits
b = OntologyBuilder()
b.add_class("http://example.org/Food")
b.add_class("http://example.org/Pizza")
b.subclass_of("http://example.org/Pizza", "http://example.org/Food")
r = Reasoner(ontology=b.build(), profile="el", incremental=True)
r.classify()
r.add_subclass_of("http://example.org/VeggiePizza", "http://example.org/Pizza")
r.classify()

See Python guide and Known limitations.

Full learning path

See the documentation index.

Classify from Rust (no clone)

Classify quick startontologos-facade::classify in five minutes.