Skip to main content

Sound, performant OWL 2 DL (SROIQ) reasoner in Rust — Python bindings

Project description

rustdl

Sound, performant OWL 2 DL (SROIQ) reasoner in Rust, with Python bindings. No JVM, no subprocess — native classification via PyO3.

rustdl beats HermiT on every measured ORE workload and wins outright against Konclude on Horn-fragment ontologies. See the project README for the full benchmark table.

Install

pip install rustdl

Wheels are published for CPython 3.10+ on Linux (x86_64, aarch64), macOS (Apple Silicon), and Windows (AMD64). Other platforms build from the sdist (needs a Rust toolchain).

Quick start

import rustdl

# Classify an ontology. Format auto-detected from the extension:
# .ofn (OWL Functional), .owx (OWL/XML), .rdf / .owl (RDF/XML).
result = rustdl.classify("pizza.ofn")

print(f"{len(result.classes)} classes, {len(result.unsatisfiable)} unsatisfiable")

# Query the computed hierarchy
result.is_subclass("http://ex.org/Margherita", "http://ex.org/Pizza")  # -> bool
result.subclasses_of("http://ex.org/Pizza")     # -> list[str]
result.superclasses_of("http://ex.org/Margherita")  # -> list[str]
result.equivalent_classes("http://ex.org/Pizza")    # -> list[str]
result.direct_subsumers("http://ex.org/Margherita") # -> list[str] (Hasse-direct parents)

API

Classification

result = rustdl.classify(path, *, per_pair_timeout_ms=None, saturation_only=False)
result = rustdl.classify_bytes(data, format="ofn", *, per_pair_timeout_ms=None, saturation_only=False)
  • per_pair_timeout_ms — bound each subsumption test; pairs that exceed it default to "not subsumed" (a sound under-approximation — robust against pathological SROIQ inputs).
  • saturation_only — skip the tableau entirely; EL-closure-only under-approximation. Dramatically faster on mostly-EL ontologies.

classify / classify_bytes return a Classification:

member type meaning
.classes list[str] all declared class IRIs
.unsatisfiable list[str] classes proved ⊑ ⊥
.inconsistent bool whole ontology unsatisfiable
.is_subclass(sub, sup) bool is sub ⊑ sup entailed?
.subclasses_of(cls) list[str] every D with D ⊑ cls
.superclasses_of(cls) list[str] every D with cls ⊑ D
.equivalent_classes(cls) list[str] classes equivalent to cls
.direct_subsumers(cls) list[str] Hasse-direct parents of cls

One-shot queries

Each parses the file, answers one question, and returns:

rustdl.is_consistent(path)                        # -> bool
rustdl.is_class_satisfiable(path, class_iri)      # -> bool
rustdl.is_subclass_of(path, sub_iri, sup_iri)     # -> bool
rustdl.is_instance_of(path, class_iri, indiv_iri) # -> bool
rustdl.instances_of(path, class_iri)              # -> list[str]
rustdl.realize(path)                              # -> dict[str, list[str]]

realize returns each individual IRI mapped to its most-specific entailed class IRIs.

For repeated queries over the same ontology, prefer classify(path) once and query the returned Classification — each top-level function re-parses.

Inference materialization

rustdl.materialize_inferred_subclass_axioms(path)   # -> list[tuple[str, str]]
rustdl.materialize_inferred_class_assertions(path)  # -> list[tuple[str, str]]

materialize_inferred_subclass_axioms yields (sub, sup) pairs for every entailed subsumption (excluding reflexive, owl:Thing/owl:Nothing, and unsatisfiable classes). materialize_inferred_class_assertions yields (class, individual) pairs. Useful for writing an inferred ontology back to disk.

Errors

rustdl.RustdlError            # base — catches everything from the library
rustdl.ParseError             # the OWL file couldn't be parsed
rustdl.UnsupportedAxiomError  # HasKey, role chains > length 2, etc.
rustdl.UnknownClassError      # an IRI argument isn't a declared class
try:
    result = rustdl.classify("ontology.ofn")
except rustdl.ParseError as e:
    print(f"bad input: {e}")
except rustdl.RustdlError as e:
    print(f"reasoning failed: {e}")

Soundness & coverage

rustdl is sound: every reported subsumption is a genuine entailment (FP=0 against Konclude on the validation corpus). Completeness is partial — the default classifier is empirically near-complete across the measured corpus but not provably complete on all of SROIQ. saturation_only and per_pair_timeout_ms are sound-but-incomplete by construction.

Data-property and datatype axioms outside the recognized preprocessing patterns are silently dropped (a sound under-approximation). HasKey and role chains longer than length 2 raise UnsupportedAxiomError. SWRL rules are skipped.

See the project documentation for the full coverage matrix, soundness contract, and architecture notes.

License

Apache-2.0 OR MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustdl-0.2.1.tar.gz (534.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustdl-0.2.1-cp310-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

rustdl-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

rustdl-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

rustdl-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

rustdl-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

rustdl-0.2.1-cp310-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file rustdl-0.2.1.tar.gz.

File metadata

  • Download URL: rustdl-0.2.1.tar.gz
  • Upload date:
  • Size: 534.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustdl-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2c6c65a52bc67184976260df3755bbfa82e9d6db350e7581b39d78c6bd6b5c5b
MD5 2c7f6800cbea32c2a931c0586d73bc0c
BLAKE2b-256 3b1290520de608395320913bb268a376f8ed9be8e2b4bef8df692bb675a62aa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1.tar.gz:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: rustdl-0.2.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 87a4d991848e8d7ddcba4f3e36e9d25980267daed58365b410815f0e53c72311
MD5 da21ab2cd81cadcb57d2e6782c71c3ef
BLAKE2b-256 661e1b669e80420d6ecb8d897eeb7c697bbce1c7d6f1a63ae207b9febfd3896a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-win_amd64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dbf4c22c9a89a0a2ed4f35c94b59121eea7551c82dbf712f8ee72c1c87160f1c
MD5 e0749b4047c3f436d1cc7fe34b0b60c0
BLAKE2b-256 d018ba61fdcfb24f9492862c56a90ee990cf1302808e9121fa8b7f4e8e4a2d82

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9ebfd7fbbe704f63c04bfdb86c9fe1767478ab1814b3bffff23f85aa7bb80e12
MD5 c8544c45768a08bc41fd92971bb4be8d
BLAKE2b-256 2cbba5a051716518e84be2cd6284b7d026ac905f7e666a12ef3104f84a6c534d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d37598bd1adf9d5fd6656aca1342ef8a644c97bb015fbc1573a2e2ad94d6439
MD5 9e6bc391357aac97bc31a934f2912474
BLAKE2b-256 c2326707648f689f95c1fd169e4aa686e497f7dcf5870463a3dccb3616c044ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 340334e10b21dc6417092b621d95a1d002a156a035033955f61d93757e3a745d
MD5 6756353fcbda1a3620137c196375f63e
BLAKE2b-256 ceb1dec5fda9b5cd4e217e6a86bc6f4c71e13fc70a7c5f9cf753431d45fc09cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustdl-0.2.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustdl-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee508237e58e4409a4ddf74348a9ea19d137603878256ecf3da6a37c703c4373
MD5 0acf2e2e06417e037c005d15bb893dbe
BLAKE2b-256 416ceeab39d48332d7d83f8f972e2071263443bbd6bc18a75ad733b523e2a050

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustdl-0.2.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-python.yml on MaastrichtU-IDS/rustdl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page