semantica.ontology provides the full lifecycle for knowledge graph schemas:
  • Auto-generate ontologies from KG data via a 5-stage pipeline (Semantic Network → YAML → Types → Hierarchy → TTL)
  • LLM-powered ontology generation for complex domains via LLMOntologyGenerator
  • SHACL validation: generate shapes, validate graphs, and get violation reports
  • OWL/RDF export in Turtle, RDF/XML, and JSON-LD formats
  • Ontology Hub visual editor available in semantica.explorer (v0.5.0)

Exported Classes

Getting Started

OntologyEngine is your main entry point for the complete ontology workflow:

OntologyEngine (Unified Facade)

OntologyEngine orchestrates the full ontology lifecycle: generation, validation, export, and evaluation:

OntologyEngine Methods

OntologyGenerator (5-Stage Pipeline)

OntologyGenerator auto-generates a formal ontology from your knowledge graph entities and relationships:
1

Semantic Network Parsing

Extract concepts and patterns from entity types and relationship structures in the source data.
2

YAML-to-Definition

Transform the extracted patterns into intermediate class and property definitions.
3

Definition-to-Types

Map definitions to OWL constructs: owl:Class, owl:ObjectProperty, owl:DatatypeProperty.
4

Hierarchy Generation

Build taxonomy trees using transitive closure and cycle detection: produces rdfs:subClassOf chains.
5

TTL Generation

Serialize the final ontology to Turtle format using rdflib. Also available: RDF/XML and JSON-LD.

SHACL Validation

Generate SHACL shapes from an ontology and validate any graph against them:

Validation Report Fields

LLM-Powered Ontology Generation

For complex or novel domains where schema patterns are hard to infer statistically:

OWL / RDF Export

Namespace Management

Ontology Evaluation

Measure coverage, completeness, and granularity of a generated ontology:

Common Workflows

Generate and validate an ontology in 3 steps:

Ingest an Existing Ontology

Load and parse an ontology file for downstream use:
Ontology versioning (VersionManager, OntologyVersion) has moved to semantica.change_management. Import from there: from semantica.change_management import VersionManager.
  • Reasoning — Apply inference rules over ontology axioms.
  • Knowledge Graph — The graph being modeled by the ontology.
  • Export — Export ontologies as RDF, OWL, or JSON-LD.
  • Conflicts — Detect ontology constraint violations.