What Is an Ontology?
In knowledge engineering and the semantic web, an ontology is a formal, explicit specification of the concepts, categories, properties, and relationships that exist within a domain. It defines the vocabulary and rules that structure a knowledge base — the "schema" for how knowledge should be represented and what inferences are valid.
The word comes from philosophy (the study of what exists), but in computer science it has a precise technical meaning: a machine-readable model of a domain that enables structured reasoning, data interoperability, and knowledge sharing across systems.
Components of an Ontology
A well-formed ontology typically includes:
- Classes (Concepts): Categories of things that exist in the domain —
Person,Organization,Product,Event. - Individuals (Instances): Specific members of a class —
OpenAIis an instance ofOrganization. - Properties: Attributes of classes —
OrganizationhasfoundingDate,headquartersLocation,numberOfEmployees. - Object Properties (Relations): Relationships between classes —
PersonworksAtOrganization,ProductdevelopedByOrganization. - Axioms: Logical rules and constraints — "If A acquiredBy B, then B owns A"; "A Person cannot be an Organization".
- Hierarchy (Taxonomy): Classes organized in subclass relationships —
SaaSCompanyis a subclass ofTechCompanywhich is a subclass ofOrganization.
Ontology Languages
The W3C has standardized two ontology languages:
- RDFS (RDF Schema): Defines basic class hierarchies and properties. Simple but limited reasoning.
- OWL (Web Ontology Language): Full-featured ontology language with description logic. Supports automated inference, consistency checking, and rich constraints.
OWL ontologies are used in domains requiring rigorous formal semantics: biomedical informatics (Gene Ontology, SNOMED CT), legal knowledge systems, and enterprise data integration.
Ontologies in AI Systems
Ontologies serve several roles in modern AI:
- Knowledge graph schema: An ontology defines what types of nodes and edges are valid, ensuring the graph is consistent and queryable in predictable ways.
- Entity disambiguation: When extracting entities from text, an ontology helps resolve ambiguity by constraining what types of entities can appear in what contexts.
- Reasoning and inference: OWL reasoners can derive new facts from existing ones without explicit storage — if A is a subclass of B, all instances of A are automatically instances of B.
- Cross-system interoperability: Two systems using the same ontology can exchange data without custom mapping logic.
Lightweight vs. Heavyweight Ontologies
Ontologies exist on a spectrum:
| Type | Description | Example |
|---|---|---|
| Taxonomy | Simple class hierarchy | Product category tree |
| Thesaurus | Synonyms and related terms | WordNet |
| Formal ontology | Full OWL with axioms and reasoning | Gene Ontology |
| Upper ontology | Abstract foundational concepts | DOLCE, BFO |
Most AI application developers work with lightweight ontologies — simple class hierarchies and a defined set of relationship types — rather than full OWL specifications.
Practical Consideration
Building an ontology well requires significant domain expertise and is one of the most time-consuming parts of a knowledge graph project. A common pragmatic approach is to start with an existing upper ontology or industry standard (e.g., Schema.org for general web content) and extend it with domain-specific classes rather than designing from scratch.