Skip to main content

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

Project description

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'.

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

ontologist-0.2.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ontologist-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file ontologist-0.2.0.tar.gz.

File metadata

  • Download URL: ontologist-0.2.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.12 Linux/6.11.0-1014-azure

File hashes

Hashes for ontologist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ee90047db400f53fd93d66c9f052960b9545c743688049f24acc6c2cf006676b
MD5 dd96163f486575cabf4f6860f9dd7963
BLAKE2b-256 f1878c2d1dd3134873f6ce285e428d1fa41c1d05119e3e63fec4489fd6a9843f

See more details on using hashes here.

File details

Details for the file ontologist-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ontologist-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.12 Linux/6.11.0-1014-azure

File hashes

Hashes for ontologist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd4ced71baea671d0021af396ac212c2016bfe2434db3d0ce31318f5734214e8
MD5 b9c66b5fe9711c2f26da49c9d69c9092
BLAKE2b-256 4241a8d31b2b51aa61fd98c8547b3230b1b95f1c44e7e18faae05385e7ee9e9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page