Skip to main content

When Devotion Meets Data: Grounding Sacred AI in Ontology

In the realm of devotional worship, AI assistants can now navigate the intricate web of sacred terms and traditions. This article explores how ontology-driven agents, tested on biomedical data, offer a blueprint for faithful, accurate, and trustworthy digital companions.

The Unseen Layers of Devotional Knowledge

Every tradition carries a hidden web of meaning. Ask a devotee about "the festival of lights," and they might think of Diwali, while another speaks of Hanukkah. A simple query like "show me all prayers for healing" can sprawl across liturgies, saints, and scriptural verses. These connections rarely live in a simple database table. They lurk in hierarchies, synonyms, and relationships that are often only understood by the faithful.

This is the same challenge that AI engineers face in enterprise settings. Data systems struggle to capture the implicit knowledge that humans take for granted. But a recent experiment from Snowflake offers a surprising blueprint. They tested ways to ground AI agents in formal ontologies—structured networks of concepts—using biomedical data. The results have profound implications for devotional AI.

What Is an Ontology, Really?

An ontology is a formal, explicit description of concepts and their relationships. Think of it as a family tree for knowledge. In medicine, the Cell Ontology classifies over 33,000 cell types, linked by 50,000 edges. In religion, imagine an ontology of sacred texts, rituals, and figures, where "prayer" connects to "meditation," "chanting," and "contemplation" through typed relationships.

Many traditions already have such structures. The Library of Congress Subject Headings and the Dewey Decimal System are crude ontologies. More sophisticated ones exist for specific faiths, encoding liturgies, calendars, and theological categories. Yet most devotional apps and AI assistants still rely on flat keyword searches. They miss the rich context that an expert devotee would bring.

Why Your Devotional AI Needs a Semantic Layer

Snowflake's experiment started with a baseline: a Semantic View. This is a governed layer that sits on top of raw data, presenting entities, relationships, and metrics in a business-friendly way. For a devotional app, a Semantic View might define "God," "scripture," "ritual," and "pilgrimage" as logical entities, with facts like "prayer_occurrence" and dimensions like "tradition" or "holy_day."

This baseline allows an AI to answer simple questions. But it fails when a user asks, "Show me all fasting practices in Advent." The term "Advent" is a season, not a single day. It has subcategories—Sundays, weekdays, and specific feasts. A Semantic View alone can't expand that concept without explicit instructions. That's where ontologies come in.

Building a Knowledge Graph for the Sacred

Snowflake's first enhancement was a knowledge graph, stored directly in tables. They created node and edge tables, allowing for graph traversal. In a devotional context, you might have nodes for "Jesus," "Eucharist," and "Passover," with edges like "celebrated_during" or "symbolizes."

The key is a recursive CTE, a SQL technique that traverses an unknown number of steps. In their biomedical test, they used it to expand a parent concept like "epithelial cell" into all 693 descendants. For a devotional AI, a query about "Christian holidays" could dynamically expand to include Easter, Pentecost, and every saint's day, without hardcoding each one.

This approach gave their agent seven tools, including "get_ancestors" and "get_hierarchy_path." It improved accuracy by about ten percentage points. But it also introduced complexity. The AI had to choose the right tool and input exact names. One mistake, and the answer fell apart.

GraphRAG: A Simpler Path to Understanding

The next approach was flat GraphRAG. Instead of traversing the graph at query time, they precomputed a rich profile for each concept. Each profile included the concept's name, definition, synonyms, neighbors, and aggregated descendant data. They indexed these profiles for hybrid keyword-vector search. At query time, the agent searched for relevant profiles and passed that context to the SQL generator.

For a devotional assistant, this means a search for "Lent" would return a profile that includes not only the season but also its associated practices, scriptures, and even related holidays. The AI doesn't need to walk the hierarchy step by step. It retrieves a ready-made package of knowledge.

This approach used only two tools, cutting down on errors. It also handled synonyms gracefully. A user typing "Eid" would match "Eid al-Fitr" and "Eid al-Adha" automatically. The result? Another ten-point accuracy boost, with less variance across runs.

Hardcoding the Last Mile

Even with GraphRAG, some questions stumped the AI. Terms like "internal organ lining" didn't map neatly to any single cell type. The same happens in devotion. A user might ask about "acts of charity"—a concept that spans fasting, almsgiving, and volunteer work. No single ontology node covers it.

Snowflake's solution was to embed curated mappings directly into the agent's prompts. They hardcoded eight authoritative mappings between cell types and tissue types. For example, "squamous epithelial cell" maps to skin, lung, esophagus, bladder, and cervix. This simple addition closed the final gap, pushing accuracy higher still.

For devotional AI, you might hardcode "penance" as mapping to "confession," "fasting," and "prayer." It's a pragmatic fix, but it requires human maintenance. Use it sparingly, only for terms that truly can't be derived dynamically.

Iterate, Evaluate, and Trust

The final piece was optimization. Snowflake used their own tool, Cortex Code, to run the evaluation suite 22 times, analyze failures, and tweak prompts. This iterative loop was crucial. Small changes—like enriching search text with tissue-type keywords—made a big difference.

For devotional AI, the lesson is simple: build, test, refine. Start with a semantic layer. Add a knowledge graph if needed. Consider GraphRAG for simplicity. Hardcode only the most stubborn mappings. And always evaluate with real user questions, not just hypotheticals.

The experiment proved that structured knowledge beats raw computation. Accuracy gains came from better context, not more reasoning power. For a devotional assistant, that means grounding every answer in the rich, structured wisdom of the tradition. Only then can it serve the faithful with clarity and trust.

Share this article:

Comments (0)

No comments yet. Be the first to comment!