Why do we need Ontology for AI Agents ?

We want a better understanding and support for a more meaningful conversation.

To have a better conversation experience, we need to have a memory. Memory process could be divided into:

  • memory construction

  • memory retrieval

  • memory pruning and forgetting

I believe construction requires reasoning and a deep understanding of domain and ontologies, giving us tools for construction and meaningful retrieval.

Graphs are not Enougth for GraphRAG. Missed Critical component

The Rise of Graph RAGs and the Quest for Data Quality

ai.plainenglish.io

Ontology vs. DB

In my previous article, I discussed the differences between databases and ontologies, particularly in the context of relational databases. We explored the concepts of open and closed world assumptions, how they shape our approach to knowledge representation, and why staying open to new knowledge is crucial. Those ideas remain relevant, but today, I want to dive into another important dimension: the relationship between ontologies and graph databases.

Ontology vs Databases for AI Agent Memory

A Short History of Databases

ai.plainenglish.io

Graph Databases: RDF Store vs. Property Graphs

When we talk about graph databases, we must first clarify what kind of graph storage we mean. There are two primary types:

  • RDF Stores: These follow the Resource Description Framework (RDF) and are often used for semantic web applications. They support reasoning and structured ontologies.

  • Property Graphs: These are used in databases like Neo4j and feature labeled nodes and relationships with attributes, making them robust for certain types of queries and analysis.

I also talk about models that could build a bridge between these models without the need to translate graphs into different representations.

Unified Knowledge Graph Model — RDF, RDF* vs LPG — The end of war

Knowledge Graph community is divided into RDF adopters and Property Graph folks. It is the ultimate question for…

ai.plainenglish.io

We could see a LPG and a layer on top of RDF* that make graph more compact.

Both types have their advantages, but the challenge arises when we try to use ontologies within property graph models.

Engines vs Databases

As I mention in the same article

Ontology vs Databases for AI Agent Memory

A Short History of Databases

ai.plainenglish.io

Sometimes, we need engines, not databases, to get the required capabilities. We could run a graph engine on top of nongraph storage.

The same applies to ontology layers. We could have ontological reasoning achieved with engines that could be run on top of data.

Challenges of Ontologies for Property Graphs

One of the biggest challenges I’ve encountered is integrating ontologies with property graphs. Unlike RDF stores, which natively support reasoning and ontological structures, property graphs lack built-in ontology support. Existing tools offer limited reasoning capabilities, making it difficult to leverage ontological frameworks directly.

Some solutions, like Neo4j’s neosemantic tools, allow you to store ontologies as graphs. However, they provide only basic reasoning features. A common workaround is to translate property graphs into RDF, but this process is cumbersome and not always feasible in real-time scenarios.

Ontologies as a Graph

It’s important to remember that ontologies themselves are graphs. They consist of nodes (concepts) and edges (relationships), but with a crucial difference: these relationships go beyond simple links and can express complex logical constraints, hierarchies, and semantic meaning.

In other words, an ontology isn’t just another graph — it’s a structured framework that provides meaning and inference capabilities beyond what a standard property graph can offer.

Ontologies Beyond Graphs: Reasoning via Ontologies

The fundamental power of ontologies lies not in their structure, but in their ability to reason. Unlike traditional graph databases that focus on efficient querying and multi-hop traversals, ontologies provide reasoning frameworks that enable inference, subclass hierarchies, and logical relationships.

This is a game-changer because it allows systems to derive new knowledge rather than just retrieve existing data. For example, if a system knows that all cats are mammals and that mammals are animals, it can infer that all cats are animals — even if that specific fact isn’t explicitly stored.

Ontologies and Common Logic

Ontologies go beyond data structuring; they encode rules and relationships using common logic principles.

This ability to model logic differentiates an ontology from a graph database. A graph database efficiently stores and retrieves relationships, but an ontology provides the semantic layer necessary for automated reasoning.

It is bring a topic of deductive databases for a knowledge graph reasoning.

Personal Knowledge Graphs. Semantic Entity Persistence in DataLog. Deductive databases

How logical and declarative programming could answer a complex question of personal Graphs

volodymyrpavlyshyn.medium.com

OWL, Rules, and Formal Logic

The Web Ontology Language (OWL) is a key component in ontology-based reasoning. OWL allows us to define complex relationships between entities, impose constraints, and encode rules that guide logical inference. Unlike property graphs, which rely on explicit data retrieval, OWL enables a reasoning engine to infer new facts based on predefined axioms and logic.

OWL supports:

  • Class Hierarchies: Defining subclasses and parent-child relationships.

  • Property Constraints: Establishing domain and range restrictions.

  • Logical Rules: Utilizing Description Logic (DL) to formalize reasoning processes.

  • Inference Mechanisms: Enabling automated deduction of implicit knowledge.

Using OWL alongside reasoning engines (such as Pellet, HermiT, or Fact++) allows for formal logic-based inference, making ontologies a powerful tool in AI, knowledge graphs, and semantic web applications.

SWRL: Extending Ontological Reasoning with Rules

The Semantic Web Rule Language (SWRL) extends OWL by allowing users to define rules that complement ontology-based reasoning. SWRL rules enhance the ability of ontologies to infer new knowledge using logical expressions.

SWRL supports:

  • Rule-Based Reasoning: Defining conditional logic that enables additional inferences.

  • Combination with OWL: Extending OWL’s inference capabilities by applying user-defined rules.

  • Expressing Complex Relations: Allowing IF-THEN statements that go beyond standard OWL axioms.

  • Enhanced Decision-Making: Enabling automated reasoning in expert systems and knowledge-based applications.

For example, a SWRL rule could express that if a person is a parent of another person, and that person is a child, then the first person is also an ancestor. This enables inferencing beyond what is explicitly stated in the ontology.

SWRL, when used with OWL reasoning engines, makes ontologies even more powerful by providing a hybrid approach that combines structured logic with flexible rule-based inference.

The Future: Can LLMs Reason Using Ontologies?

A fascinating open question is whether we can teach large language models (LLMs) to reason based on ontologies. Since ontologies represent structured knowledge, they could serve as a foundation for improving LLM reasoning capabilities. The challenge is making this knowledge representation accessible and integrating it into AI-driven inference engines.

This is an exciting area of research, and I’d love to collaborate with anyone working on these ideas. If you have insights or tools that help bridge ontologies and AI, let’s connect!

Reasoning Layer on Top of Neuro-Symbolic Approach with Logical Networks

A promising approach to enhancing ontology-based reasoning is the integration of neuro-symbolic AI with logical networks. This approach combines the strengths of symbolic reasoning (structured logic-based inference) with neural networks (data-driven learning and pattern recognition).

Key Aspects of Neuro-Symbolic Reasoning

  • Symbolic Representation: Using ontologies and formal logic to encode domain knowledge.

  • Neural Learning: Leveraging deep learning models to process and extract patterns from large-scale data.

  • Hybrid Reasoning: Combining rule-based inference with machine-learned knowledge representations.

  • Logical Networks: Integrating formal logic into neural architectures to enhance structured decision-making.

This neuro-symbolic fusion enables AI systems to reason with incomplete data, infer implicit knowledge, and improve interpretability compared to purely black-box neural networks. By layering logical reasoning on top of AI models, we can build trustworthy, explainable AI that aligns with human logic and knowledge representation.

…

Stay tuned for more on this topic. My next article’ll explore how we can improve ontology-based reasoning in AI models. If you’re interested, let me know, and let’s push the boundaries together!

PS

Article inspired by

The actual differences between Ontologies and Graph databases for appropriate usage

Can work on ontologies with Neo4j, including those based on OWL (Web Ontology Language). However, Neo4j alone is not an…

Originally published on Sovereign Agentic AI on Substack.