A Python library for validating RDF data alignment with ontologies without requiring SHACL definitions.
- Github repository: https://github.com/atomobianco/ontologist/
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 exist for RDF validation, they may require explicit SHACL shape definitions, 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 SHACL definitions
- Getting detailed violation reports for debugging and improvement
- Validate RDF data against ontology definitions without SHACL
- Detect undefined classes and properties
- Verify property domain and range constraints
- Provide detailed violation reports
pip install onto-match
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)