Skip to main content

pyowl2-profiles

Fast OWL 2 profile detection (EL/RL/QL/DL) over pyoxigraph.

PyPI License: MIT Python versions

Installation

pip install pyowl2-profiles

Quick start

import pyoxigraph
from pyowl2_profiles import detect_profiles, PROFILE_NAMES

# Load your ontology into a pyoxigraph store
store = pyoxigraph.Store()
with open("my-ontology.ttl", "rb") as f:
    store.load(f.read(), pyoxigraph.RdfFormat.TURTLE)

# Run detection
result = detect_profiles(store, graph_iri=None)

# Check verdicts
for profile in PROFILE_NAMES:  # ("el", "rl", "ql", "dl")
    r = result[profile]
    status = "IN" if r["in_profile"] else "OUT"
    print(f"OWL 2 {profile.upper()}: {status}  ({r['total_violations']} violations)")

# Inspect violation samples
for sample in result["el"]["sample_violations"][:3]:
    print(f"  {sample['axiom_type']}: {sample['subject_iri']}")

Why this library

  • No JVM. ROBOT requires Java; pyowl2-profiles runs entirely in Python with no external runtime.
  • No second parse. If you already have data in a pyoxigraph store (e.g., from a pipeline), detection adds only a few lightweight SPARQL queries.
  • Fast. On moderate-sized ontologies (< 1M triples), detection completes in under a second. Cold-start (load + detect) is 10-1400x faster than ROBOT depending on ontology size.
  • Standard Python packaging. pip install, import, done.

CLI usage

Detect profiles for a file

pyowl2-profiles detect my-ontology.ttl
pyowl2-profiles detect my-ontology.ttl --format json
pyowl2-profiles detect my-ontology.ttl --profile EL

Benchmark against ROBOT

# Requires robot on PATH
pyowl2-profiles benchmark onto1.ttl onto2.owl --csv results.csv

# Skip ROBOT, ours only
pyowl2-profiles benchmark onto1.ttl --skip-robot

Validation

Validated against ROBOT 1.9.10 on a 19-ontology biomedical fleet: 19/19 (100%) verdict agreement across all four profiles (EL, RL, QL, DL).

See docs/usage.md for a detailed walkthrough and benchmark methodology.

API reference

detect_profiles(store, graph_iri=None, ontology_id="", version_id="") -> dict

Run all four OWL 2 profile checks against a pyoxigraph.Store.

Parameters:

  • store — pyoxigraph.Store containing the ontology triples
  • graph_iri — named graph IRI to query, or None for the default graph
  • ontology_id — optional string identifier (informational only)
  • version_id — optional version string (informational only)

Returns a dict with keys "el", "rl", "ql", "dl", "indexed_at". Each profile value is a dict with:

  • in_profile (bool) — True if no violations found
  • total_violations (int) — total violation count
  • violations_by_axiom_type (dict[str, int]) — per-type counts
  • sample_violations (list[dict]) — up to 50 example violations, each with axiom_type, subject_iri, manchester (rendered tokens), and optionally details

ProfileViolation

Frozen dataclass for a single violation: profile, axiom_type, subject_iri, details, manchester.

PROFILE_NAMES

("el", "rl", "ql", "dl") — the four OWL 2 profiles in subset order.

ProfileName

Type alias: Literal["el", "rl", "ql", "dl"].

Acknowledgement

Originally extracted from OntoExplorer, a FAIR ontology repository at Maastricht University Institute of Data Science.

License

MIT — see LICENSE.

Metadata

Release files for pyowl2-profiles 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyowl2-profiles 0.1.0
File Size Uploaded Provenance Actions
pyowl2_profiles-0.1.0.tar.gz 38.3 kB Without provenance Details for pyowl2_profiles-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyowl2-profiles 0.1.0
File Interpreter ABI Platform Actions
pyowl2_profiles-0.1.0-py3-none-any.whl Python 3 none any Details for pyowl2_profiles-0.1.0-py3-none-any.whl

Total release size: 68.7 kB

Release files / pyowl2_profiles-0.1.0.tar.gz

Download URL pyowl2_profiles-0.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
28c1f123bd3d6e3ab0348e1c707c2e39976ec848bc1de21ed52cc63ec362feb6
BLAKE2b-256 checksum
How to use checksums
f2bc5f73b455edcfaea1f744b6e2c41c09c59630ead8f9e2b92830d1faeace28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pyowl2_profiles-0.1.0-py3-none-any.whl

Download URL pyowl2_profiles-0.1.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fd67ca0c1c64582906828e4de290ebc1fe969ae90fd0587ef770cea120813f5
BLAKE2b-256 checksum
How to use checksums
349a43dd50de73788f6d664e447b4829ea0e2f259677dc4e4c589e297bd2361f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for pyowl2-profiles 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page