The Ontology Masterclass A developer argues that vector-embedding RAG struggles to disambiguate polysemous terms like "bond"—the James Bond character, financial bonds, chemical bonds, and bonding actions all cluster together in embedding space—and that ontologies, unlike schemas or join-based tools such as NVIDIA's Auto Ontology, supply the meaning needed to resolve such queries. Using the James Bond universe as a worked example, the piece distinguishes schemas that record where data lives from ontologies that capture what it means. Ontologies don't just tell you where your data is. They tell you what it means. And what does that have to do with James Bond? Hello and welcome. This is my ontology masterclass. I've actually never taken one of those masterclasses, so I have no idea what happens next. So segue, segue, segue...and here we go James Bond. Or the word bond itself. What a semantically ambiguous word. How many different things can that word mean? And it gets even more complicated than that. Just on the surface, we can see that the word bond could be: Just those alone, one word, so many different things, and these are all very valid definitions. These aren't esoteric use cases for these terms—these are first-order definitions for these particular use cases. If we're talking about an AI system, how would we typically retrieve this? Before ontologies, likely using semantic similarity search with vector embeddings. In the case of the word bond , what happens if we have data where you have the character James Bond, a financial bond, chemical bonds, and bonding actions? You're gonna end up in an embeddings space where these things are all very close together. And that's gonna cause a lot of difficulty in disambiguation. What you're gonna end up doing is retrieving a lot of text chunks that may or may not be relevant, and it's gonna be very, very difficult to determine that relevancy. If you're just doing vector RAG where you're retrieving text chunks, you're totally leaving this up to an LLM to figure out what the correct context is. Am I talking about James Bond the character? Am I talking about a financial bond? Depending on how large these chunks are, there may not be a very good, clear answer, which is gonna lead to guesswork. And as we know, LLMs are not gonna shy away from making a guess. We're seeing a lot of emerging technologies in this space like NVIDIA's Auto Ontology. What does that one do? That one's interesting because it does something very useful, but is it an ontology? What it's doing is essentially finding a way to retrieve data from relational data tables using SQL. Now, SQL and ontologies don't really go together. So what are we really talking about? We're talking about creating relationships spanning multiple data tables, and what is that? That's a join. If we think about our traditional triple — subject, predicate, object — the ontology schema that a platform like NVIDIA's Auto Ontology is creating really has a predicate that's just something like a "has," because all it's doing is joins between different data tables. Make no mistake, that capability is useful to be able find this data, but it's just telling us where it is. There's no meaning to answer the other big questions like what , why , and how . If we just search for the word bond , we're gonna find wherever it lives in these different tables, but we don't know anything about it. We don't know what it means. It's just a schema. And what's the difference between a schema and an ontology? This schema tells us where the data is stored. That's pretty important for the retrieval part. But the ontology can also tell us what it means . That's why we have ontologies. Let's work through an example using the James Bond universe. This one gets pretty interesting pretty quickly. If we think about the character James Bond and just use the one example of the novel Casino Royale , we're going to see some interesting things. For one, this is a character created by Ian Fleming. And not only are there multitudes of films across many generations at this point with different actors, that's only kind of the beginning of the story, as you'll see. For instance, we could ask two questions: You're thinking, what do those two questions have to do with each other? Well, they actually are related, because Ian Fleming named James Bond after the ornithologist James Bond. So what did James Bond study? Well, he was an ornithologist. Who created James Bond? That was Ian Fleming. One was a real person, and one is a character, yet they share an unexpected bond . See what I did there? Ok, moving on... Now, it gets much stickier from there. Let's just look at Casino Royale . We have three different representations and three different actors that played it: So how would you understand all of this without a hierarchical structure that captures multi-hop relationships of an ontology? To make all of this explicit, the ontology starts by drawing a hard line between the real world and the fictional world,declaring them completely disjoint: bond:RealWorldEntity a owl:Class ; rdfs:label "real-world entity"@en . bond:FictionalEntity a owl:Class ; rdfs:label "fictional entity"@en ; rdfs:comment "Anything that exists only inside a Bond story world."@en ; owl:disjointWith bond:RealWorldEntity . From there, it links the real-world layer people, works, productions, canons, performances to the fictional layer characters, organizations, codenames using three key bridges. Quick note on the naming below: Eon refers to Eon Productions , the British studio behind the official James Bond film series since 1962, as opposed to unofficial "non-Eon" Bond films made by other studios. bond:CharacterVersion : bond:JamesBond from how that character is realized in a specific continuity or standalone work bond:LiteraryBond , bond:JimmyBond1954 , bond:SirJamesBond1967 , bond:ClassicEonBond , bond:CraigBond . In-universe facts—like MI6 affiliation or holding the 007 codename which even shifts to Nomi in bond:CodenameAssignment —attach to the bond:Portrayal : bond:performedBy , a specific bond:portraysVersion , and a specific screen work bond:inScreenWork . That's how the system knows Sean Connery played the official bond:NeverSayNeverAgainBond in the non-Eon film bond:closelyAdapts , bond:looselyAdapts , bond:takesTitleFrom , bond:borrowsElementsFrom , bond:remakes , or bond:parodies the original. Look at how cleanly this disambiguates those three versions of Casino Royale —including separating the official Eon Productions film from the earlier TV adaptation and the non-Eon spoof: bond:CasinoRoyale1954 a bond:TelevisionWork ; bond:releaseYear 1954 ; bond:adapts bond:CasinoRoyaleNovel . bond:CasinoRoyale1967 a bond:NonEonFilm ; Unofficial film not made by Eon Productions bond:releaseYear 1967 ; bond:looselyAdapts bond:CasinoRoyaleNovel ; bond:parodies bond:EonBondSeries . Spoofs the official Eon Productions series bond:CasinoRoyale2006 a bond:Film ; bond:releaseYear 2006 ; bond:partOfProductionSeries bond:EonBondSeries ; Official Eon Productions series bond:setInContinuity bond:CraigContinuity ; bond:closelyAdapts bond:CasinoRoyaleNovel . And then each actor's performance is explicitly tied to the right version of Bond in the right work: bond:Portrayal Nelson CR1954 a bond:Portrayal ; bond:inScreenWork bond:CasinoRoyale1954 ; bond:performedBy bond:BarryNelson ; bond:portraysVersion bond:JimmyBond1954 . bond:Portrayal Niven CR1967 a bond:Portrayal ; bond:inScreenWork bond:CasinoRoyale1967 ; bond:performedBy bond:DavidNiven ; bond:portraysVersion bond:SirJamesBond1967 . bond:Portrayal Craig CR2006 a bond:Portrayal ; bond:inScreenWork bond:CasinoRoyale2006 ; bond:performedBy bond:DanielCraig ; bond:portraysVersion bond:CraigBond . Even better, because many classes are defined like bond:EonFilm , bond:FlemingAdaptation , bond:Actor , or bond:DoubleOAgent , a reasoner can infer them automatically from the relationships rather than forcing you to tag everything by hand, For example, automatically classifying Casino Royale 2006 as an official bond:EonFilm simply because it's part of bond:EonBondSeries . Now compare that to what happens with a text-to-SQL semantic layer like NVIDIA Auto Ontology. NVIDIA Auto Ontology is genuinely useful for what it's built to do: it ingests metadata from relational databases like Postgres, Snowflake, or Databricks , builds a layer of business terms and valid join paths, and grounds an AI agent's SQL queries so it stops hallucinating column names. If you want to ask, "What was Q3 revenue by region?" it's great. But try throwing the James Bond universe at text-to-SQL and relational joins, and the cracks show up immediately: Actors , Films , and Characters tables connected by foreign keys. A text-to-SQL agent can easily join SeanConnery → NeverSayNeverAgain1983 → JamesBond . But a SQL join is just a flat link—it doesn't know that Sean Connery in WHERE clauses for every edge case, SQL treats them as the exact same entity. bond:derivesFrom is a transitive property. Because bond:FlemingDerivedWork . Likewise, bond:EonFilm and bond:DoubleOAgent are bond:Work , while owl:disjointWith guarantees a real-world bond:Person like the ornithologist James Bond or actor Daniel Craig can never be conflated with a bond:FictionalEntity . A text-to-SQL semantic layer can tell an agent That's the difference. If we want to ask, "Are these characters represented in a way that's true to the original novel?" or "Which 007 are we talking about?" we need ontologies to do that. Relational joins and text-to-SQL tell you where the rows live. Graph structures and ontologies tell you what they mean. Now, what's another use case where relational tables really aren't going to help us, but a graph structure and ontologies can? Processes with rules and logical conditions. Just take the financial bond as an example. You have conditions on whether a bond payment has been made on time. There's yes/no, there's criteria on that, there will be dates, there will be ranges. How would you really store that in tables? That wouldn't make sense, because how would we typically draw that? We would draw it as a flowchart with arrows and conditional statements: if, then, yes, no . A lot of you probably already work with something that is that: DAGs. DAGs are essentially those. And what's the G in DAG? Graph. And what are ontologies? A specialized graph data structure. Aha, it's all coming together, isn't it? A table really wouldn't be able to tell us how these steps are structured. Well, I guess you could just do a 1, 2, 3, 4, 5 in a table, but what happens when you have branches and logical statements? Those would have to pivot to other tables, which would require joins. Again, we get that word join . Whereas with an ontology, we natively have that connecting piece, that connecting logic with a rich predicate that tells us what the steps are and what the conditions are. Those rules can be captured by a graph system with ontologies governing it. That's exactly what we're doing with TrustGraph https://github.com/trustgraph-ai/trustgraph . It's not just being able to say, "Where is my data stored?" it's being able to understand, "What does it mean?" And not just what it means in terms of which James Bond I'm talking about, but if I have a process flow, what are the next steps? What are the conditions I have to satisfy to determine which branch in the flow I go to? Just as an example, think about how many different ways a single word can be used all within the same company: How would you know which one of those you're referring to if all you have is vector similarity search? That's just going to give us the things that are near each other in that embedding space, and you're going to be relying on an LLM to read through the text and figure out which one you're talking about. Schemas know where the data is and can retrieve it, but they can't tell you anything about that data. It's the same thing again, you're relying on an LLM to completely tell you what it means. Ontologies solve both of those problems with explicit relationships, explicit structures, and explicit connections that show which of these words mean what and belong to which space. Does this reference to Bond belong in the James Bond universe? Does it belong to the time James Bond was played on American television as an American? Does it mean the Daniel Craig James Bond? Or does it mean chemical bonds? Ontologies can solve those problems, and these are all things we can do with TrustGraph. And that whole finding things and executing processes? Yeah, TrustGraph 3 is coming very, very soon. Very soon. In fact, if you know where to look, it might already be here...