ontologist
A Python library for validating RDF data alignment with ontologies without requiring shape resources.
- Github repository: https://github.com/atomobianco/ontologist/
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ontologist-0.2.0.tar.gz | 10.8 kB | Without provenance | Details for ontologist-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ontologist-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for ontologist-0.2.0-py3-none-any.whl |
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
|
Security for ontologist 0.2.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.