A Python library for validating RDF data alignment with ontologies without requiring shape resources.
Project description
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'.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ontologist-0.1.1.tar.gz.
File metadata
- Download URL: ontologist-0.1.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.11 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e42a05aad8b8c7f10923c8c8617af15daa28509ba4b9c5e7636467cb620b816
|
|
| MD5 |
7252b67b2eefd70125c3d4e574bf379d
|
|
| BLAKE2b-256 |
915d53a37c7423ded46e4d3c4febd438f0adb4b842fb078116acb4a5ace16fc7
|
File details
Details for the file ontologist-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ontologist-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.11 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de7ac0ccdbd6760fff053bb2416cdd842f8d07e713f67e2f6d79ff8b898de8d2
|
|
| MD5 |
f2480775eaea217b26df5169949e2ae1
|
|
| BLAKE2b-256 |
18258de6a7e82d44d459119e7f8288e4926cbdabada4d271b012b94d09111090
|