Skip to main content

ontologist

Release Build status License

A Python library for validating RDF data alignment with ontologies without requiring shape resources.

Why?

When working with Large Language Models (LLMs) to extract RDF data based on ontologies, it's crucial to verify that the extracted data aligns correctly with the target ontology. While tools like pySHACL or PyShEx exist for RDF validation, they may require additional shape resources, or may fail on certain validation checks.

This library provides a programmatic approach to verify ontology alignment, making it particularly suitable for:

  • Validating LLM-extracted RDF data
  • Working with ontologies that lack shape definitions
  • Getting detailed violation reports for debugging and improvement

Installation

pip install ontologist

Quick Start

from rdflib import Graph
from ontologist import validate

# Load your ontology and data graphs
data = Graph().parse("your_data.ttl")
ontology = Graph().parse("your_ontology.ttl")

# Validate the data
is_valid, violations, report = validate(data, ontology)

print(report)
Validation Report
Conforms: False
Results (1):
PROPERTY type violation:
	Property 'ex:Prop1' of instance 'ex:Class1' can't have value of type 'http://www.w3.org/2001/XMLSchema#string' because it requires type 'http://www.w3.org/2001/XMLSchema#integer'.

Metadata

Release files for ontologist 0.2.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 ontologist 0.2.0
File Size Uploaded
ontologist-0.2.0.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ontologist 0.2.0
File Interpreter ABI Platform
ontologist-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / ontologist-0.2.0.tar.gz

Download URL ontologist-0.2.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee90047db400f53fd93d66c9f052960b9545c743688049f24acc6c2cf006676b
BLAKE2b-256 checksum
How to use checksums
f1878c2d1dd3134873f6ce285e428d1fa41c1d05119e3e63fec4489fd6a9843f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.12 Linux/6.11.0-1014-azure

Release files / ontologist-0.2.0-py3-none-any.whl

Download URL ontologist-0.2.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd4ced71baea671d0021af396ac212c2016bfe2434db3d0ce31318f5734214e8
BLAKE2b-256 checksum
How to use checksums
4241a8d31b2b51aa61fd98c8547b3230b1b95f1c44e7e18faae05385e7ee9e9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.12 Linux/6.11.0-1014-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

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