← All AI Engineer talks

AI Engineer World's Fair 2025

The Knowledge Graph Mullet: Trimming GraphRAG Complexity

About this talk

William Lyon of Hypermode presents a hybrid knowledge-graph architecture that combines property-graph interfaces with RDF triple storage to simplify GraphRAG. Using Dgraph, he explains RDF modeling, posting-list optimizations, DQL and GraphQL-inspired queries, Ratel, and vector search, then demonstrates Model Context Protocol integration, graph-powered recommendations, and long-running Modus agents that retrieve GitHub content and generate code-aware outputs.

Chapters

  1. 0:00The knowledge-graph mullet: property graphs meet RDF
  2. 3:59Dgraph architecture, RDF triples, posting lists, and DQL
  3. 9:01News knowledge graphs, Ratel, and vector similarity search
  4. 15:55Dgraph MCP servers, graph mutations, and recommendations
  5. 24:44Stateful Modus agents and GitHub-powered code generation
  6. 32:34Resources and closing remarks

Talk transcript

  1. 0:00

    Hey everyone, my name is Will, and in this talk we're gonna be learning all about the Knowledge Graph Mullet and how it can trim graph RAG complexity. Uh, let's jump right in.

  2. 0:14

    So bear with me a little bit in this analogy, uh, but if you're famar- familiar with the mullet haircut, this is a classic business in the front, party in the back, uh, sort of short up front, long in the back, uh, hairstyle that, uh, was popular in the, in the '80s and '90s.

  3. 0:33

    And if we think of like, what are the benefits of the mullet haircut, it's really all about low maintenance, easy to work with, but versatile and adaptable in different environments.

  4. 0:46

    And if we extend that analogy to knowledge graphs, that gives us the Knowledge Graph Mullet, which is all about property graph in the front and RDF triples in the back.

  5. 1:00

    So really what this talk is about is combining concepts from the property graph world and the RDF world to have a hybrid and versatile approach for working with knowledge graphs.

  6. 1:18

    So if you're familiar with the graph ecosystem at all, you've probably heard some of this terminology, but property graph and RDF are typically thought of as two totally different paradigms for working with graphs.

  7. 1:35

    Uh, in the property graph world, we're thinking about nodes, relationships, key value pair properties. We're thinking about traversing the graph using pattern matching, uh, often with a query language called Cypher.

  8. 1:52

    In the RDF world, we're typically talking about, uh, ontologies using a query language called SPARQL, thinking about triples. Uh, RDF comes from the semantic web and linked data world.

  9. 2:10

    And what I wanna show today is that really these concepts can be used together, where we can really leverage the benefits and sort of best of both worlds, uh, to again expose a property graph model for how we want to think about and query the data, but leverage the scalability

  10. 2:34

    of RDF triples, uh, in our knowledge graph system.

  11. 2:41

    We're going to take a look at an open source project called Dgraph to, uh, work with our knowledge graphs. Um, let's talk about really like a working definition of knowledge graph, first of all.

  12. 2:56

    So we're gonna say that a knowledge graph is really just an instance of a property graph. So the property graph model is all about nodes. Nodes can have one or more labels, which is a way to, uh, tell us what type of node, uh, we're talking about, a way to group nodes.

  13. 3:17

    You can think of labels as kinda similar to like tables from the relational database world. Uh, and then we have relationships that have a single type and direction, then we can store arbitrary key value pair properties on nodes and relationships.

  14. 3:37

    And the, the semantics, right, so how our entities are connected is encoded in the data model. We don't just say that two nodes are related to each other. We say that this talk has, uh, a certain topic, or this talk was presented at a conference, right?

  15. 3:59

    We're talking about things, not strings, which was the, the title of Google's blog post in 2012 introducing the Google Knowledge Graph. But I think that's, I think that's right.

  16. 4:11

    I think that's one of the most important pieces of thinking about knowledge graphs, is that we have a canonical representation of the thing.

  17. 4:23

    Dgraph was first open sourced and released in 2017, and, uh, initially was really optimizing for large scale graph data, so the, the D is for distributed, and scale in terms of volume.

  18. 4:43

    Uh, so the original Dgraph team came from, uh, ex-folks from Google that were inspired by, uh, Google Spanner Graph. Dgraph is this really interesting sort of hybrid in this world of graph databases where we use the property graph model for, uh, data modeling and querying, uh, but we use RDF,

  19. 5:08

    uh, for data interchange, and we work with triples as the smallest unit of record. So if we take a look at these two paradigms that we're talking about, the property graph model, uh, where nodes, node labels, relationship types, and key value pair properties are sort of the, the core fundamentals of the data model.

  20. 5:33

    And if we compare that with RDF, which is all about triples, so subject, predicate, object, which we can think of as like a sentence. Uh, the subject, this is always going to be a node.

  21. 5:47

    A predicate can be a relationship or a property. And then an object in the case where, uh, the predicate is a relationship, is a node, or the value of a property

  22. 6:02

    Let's look at how Dgraph works with both property graphs and triples. So the first thing we need to do to model a property graph as an RDF triple is to have a unique ID for each node.

  23. 6:18

    The unique ID maps to some offset in disk so that we're able to traverse the graph very quickly and efficiently.

  24. 6:30

    Then the next piece is, again, to, uh, think of our node as the value of our unique ID. So the subject we said is always gonna be a node, and, uh, really specifically, it's always going to be a unique ID.

  25. 6:48

    That's like a pointer to the node. Then the predicate is going to be, uh, a relationship or a property. And in the case where it's a relationship, then our object is going to be another, uh, node ID.

  26. 7:06

    So this is going to be a predicate that connects two nodes as a relationship, or it's gonna be the value of our property. Dgraph uses an important optimization called a posting list, where we are, uh, grouping by predicate and, uh, using a list of the unique node IDs of all the nodes that this node

  27. 7:30

    is connected to by that predicate. So this allows us to traverse the graph, uh, very efficiently.

  28. 7:38

    DQL, uh, we said, is the query language that we use with Dgraph. Uh, DQL was very much inspired by GraphQL. GraphQL was, uh, open sourced by Facebook shortly, uh, before Dgraph, uh, was released.

  29. 7:57

    And, uh, at that time, there was a lot of interest in, uh, exploring GraphQL beyond its intention as an API query language. So we can see some similar concepts from DQL.

  30. 8:12

    Uh, we start every DQL graph traversal with a well-defined starting point, so that's our root criteria here, where we're often using an index to find the nodes as the starting point for our traversal.

  31. 8:27

    Then we use a selection set structure, which is this nested structure that, uh, specifies both the properties that we want to return to our query, uh, but also this nested structure represents a traversal in the graph.

  32. 8:47

    Similar to GraphQL, the data returned from a DQL query is JSON that matches the structure of our selection set. Let's take a look at an example, uh, using news data.

  33. 9:01

    Uh, so how would we create a knowledge graph of news articles? So here's an example from The New York Times. Uh, so we have, uh, a news article, and if we think of what sort of graph model we would build from this, well, we would think of the, uh, entities that are mentioned, like what are the organizations,

  34. 9:22

    the, uh, people, the topics that are mentioned. We might model those as nodes in the graph. We also have, uh, the author. We have images to think of. And we also have unstructured data to work with in the graph.

  35. 9:37

    Now, there are different approaches for how we might chunk and embed unstructured data, uh, maybe using the semantic structure of the article. In this example, we're just gonna say every paragraph is a chunk, uh, and we're going to model those chunks as nodes in the graph.

  36. 9:59

    So here's a graph model, uh, that we're gonna use to represent our news knowledge graph. We have an article node that represents the article itself. It u-- It has a, a URL, a publish date, a title, an abstract.

  37. 10:13

    But then we have, uh, the author of the article, topics that may be mentioned in the article, organizations that may be mentioned. Uh, we also have geographic areas that might be mentioned in the article, uh, and images, uh, as well.

  38. 10:29

    So you can see how we can traverse from the article to the topic node to then other articles that have the same topic or that mention the same geographic location.

  39. 10:41

    Now, we mentioned, uh, chunking and embedding earlier. Uh, what we're gonna do is calculate an embedding of each chunk and store that as a node property. This will allow us to use vector search as an entry point for our graph.

  40. 11:01

    So, uh, vector similarity search gives us an entry point into the graph. We can think of this as the lexical graph, where we're identifying chunks of a document that are, uh, close to vector space, uh, of a embedding of our query.

  41. 11:20

    But that's just the start in GraphRAG. Uh, in a naive RAG approach, we would do the vector search to find these chunks. That document would th- then be injected into the prompt to add, uh, context.

  42. 11:33

    But in GraphRAG, that's just the starting point. Then we traverse through the graph to the article nodes, to the topics that are relevant for this article, to other articles that have the same topic or that mention the same organization.

  43. 11:50

    Um, and again, that's just one entry point. The, uh, other entry points might be using a geospatial index. Maybe we want to find all of the, uh, news about, uh- Areas within a certain region or find news articles, uh, near me, and then traverse the graph to find other relevant

  44. 12:15

    articles that become context for, uh, for our model. Similarly, we might have, uh, an image embedding model where we're doing, uh, image similarity search as well, again, just as an entry point.

  45. 12:30

    So I like to think of GraphRAG really being all about different subgraph entry points, where we have this concept of the lexical graph for vector search with unstructured data, uh, the domain graph that we're sort of traversing through to find relevant context for the model.

  46. 12:50

    Let's take a look at a hands-on example of actually using this data, uh, with Dgraph. This is a tool called Ratel, which is a query workbench for Dgraph. Uh, we can execute DQL queries and work with and visualize the results.

  47. 13:09

    Our initial query was just a simple count of the number of articles. Let's look at a more complex query, uh, where we are searching for the first ten articles, then traversing the graph to find topics connected to those articles.

  48. 13:25

    So we can, uh, inspect the graph in this graph visualization to have an idea of how these topics are connected to articles. Let's look at a more complex example.

  49. 13:38

    Uh, so here we are filtering for articles that are published after a certain date and then traversing to the geographic areas mentioned in those articles.

  50. 13:53

    Let's see how we can use the, uh, geographic distance search in Dgraph. So here we're looking for geographic areas in the news that are within fifty kilometers of New York City and then traversing to find the articles connected to those geographic regions.

  51. 14:15

    And we can see things like Manhattan and Brooklyn. Uh, let's look at a vector search example. So using the, uh, vector similarity search functionality in Dgraph, we're passing a embedding.

  52. 14:29

    Uh, I think this is an embedding of the phrase money laundering, and looking for articles that are close in vector space, and then traversing to find, uh, topics, geographic regions, organizations connected to these, uh, these articles.

  53. 14:52

    We can then add a more complex traversal to then search from those articles that, uh, were a match for our vector similarity search to traverse through the topic nodes to find other articles that have overlapping topics, but that may not have shown up through our vector similarity search.

  54. 15:14

    And this gives us, uh, a way to, in this case, visually explore, uh, the graph. But of course, we can look at the JSON representation, uh, of the data return that matches our selection set.

  55. 15:28

    Okay, that was a quick look at using DQL to query our Dgraph instance. Um, I want to talk about some of the features in the latest release of Dgraph.

  56. 15:40

    Uh, the first interesting bit is that, uh, all of the enterprise features of Dgraph have been moved into a single open source release, uh, and we're continuing to add new features.

  57. 15:55

    Uh, the interesting one I want to dive into in this case is Model Context Protocol, so the MCP server for Dgraph. Uh, so let's talk a little bit about MCP, and then we'll look specifically at the Dgraph MCP server.

  58. 16:13

    Uh, so this is a screenshot from the Anthropic DeepLearning.AI course, uh, which is linked here. This is, um, I think a really good course if you're interested in not just learning about the concepts of MCP, but how do you actually build and deploy MCP servers.

  59. 16:33

    Fundamentally, MCP is a way of exposing tools to models. In the context of databases, this means we're giving, uh, the database, uh, we're giving the model rather a way to interact with our database.

  60. 16:51

    With Dgraph, uh, each Dgraph instance serves a MCP server. There's a, uh, read-only instance, which will only expose, uh, the ability to execute queries or inspect the schema. Uh, and then the full endpoint also exposes functionality for mutations, so adding data and also tool for altering the

  61. 17:16

    schema. So some of the use cases for the Dgraph MCP server are in agentic coding assistant, uh, environments, so tools like Windsurf or Cursor, uh, where we're able to do things like leveraging the schema or the data that are retrieved the MCP server

  62. 17:40

    to, um, auto-generate writing, uh, CRUD endpoints in our app or other way generating, uh, DQL queries in our app. Another use case might be more exploratory data analysis, uh, which we might do in a tool like Claude Desktop, where we're actually generating DQL queries, uh, and

  63. 18:07

    Fetching data from the database to understand, uh, what data is in our graph. [lips smack] Let's take a look at using the Dgraph MCP server, uh, with Claude Desktop. So the first thing I'm gonna do is sign into, uh, Hypermode and create a new graph.

  64. 18:28

    Hypermode graphs are, uh, powered by Dgraph, so this is going to deploy a Dgraph cluster, including the MCP server endpoint. So we can see the MCP configuration, uh, in addition to the Dgraph connection string. [lips smack]

  65. 18:45

    So we'll copy the MCP configuration, and in Claude Desktop, we'll edit the developer config and paste in that MCP configuration, uh, and then restart Claude, which will give us access to the MCP server tools for Dgraph.

  66. 19:06

    Uh, let's load some sample data into Dgraph. So let's, uh, create fictitious customer, product, and order data for, say, uh, for an e-commerce use case. And so the first thing that Claude is gonna do is update the schema.

  67. 19:24

    Uh, I should say, actually, the first thing it's gonna do is inspect the schema, uh, and see that our database is empty, then generate a graph schema that represents the data model that we're going to work with, so orders and how they're connected to products and customers.

  68. 19:42

    Uh, then Claude is gonna generate a series of mutations to actually create data in the graph, generating, uh, fictitious customer names, customer information, uh, products, and so on. Now, it's important to, to point out here that with database MCP servers, it's the model that is generating the database query and then

  69. 20:07

    using the tools defined in the MCP server to execute those queries against the database. And Claude is smart enough to verify that the data created in the database matches its expectations.

  70. 20:23

    So here we can see, uh, that Claude is generating DQL queries to verify, uh, the data was actually created, uh, as expected.

  71. 20:36

    Uh, in this case, it found missing relationships, uh, and so it's adding a mutation to add those relationships to the graph. Now, this is a really interesting way for learning new developer tooling.

  72. 20:50

    So here we've, uh, created, uh, a graph schema. We've added data to the graph without really having to, uh, to worry about the specific query language. But it's a great way to learn that query language, learn how to use these developer tools.

  73. 21:07

    Uh, now let's generate a graph visualization to understand the data in the graph. So here Claude generates a query to fetch data from the graph and generates the JavaScript to render a graph visualization.

  74. 21:23

    Um, so this is a helpful way to understand the connections in our graph. Uh, and we have ways for viewing the schema, uh, zeroing in on customers and orders, or just inspecting, uh, product information.

  75. 21:42

    We have different layout options in addition to the typical force-directed layout. Uh, hierarchical or radial layouts can be useful for interpreting graphs. Uh, but let's stick with the force-directed layout, and let's explore using Dgraph for generating product recommendations for a specific user.

  76. 22:06

    So this is a, a typical graph database use case, uh, generating personalized recommendations by traversing the graph. Uh, you can think of the different approaches we could take here from collaborative filtering, uh, which could be find similar users in the graph.

  77. 22:24

    What are those users purchasing that, uh, our user is not? Those may be good items to recommend to the user. To content-based recommendations based on the purchase history of our user, uh, what are attributes that they may be interested in, uh, demographic approaches as well.

  78. 22:46

    And here Claude is generating, uh, queries that show us using these different approaches, uh, and then how these can be combined to generate a single database query.

  79. 23:02

    Now, Claude doesn't always get the, the queries right. So this example, uh, we can see there's an error with the first approach, and so Claude is gonna iterate a bit, uh, until we get back results as expected.

  80. 23:18

    Again, really useful tool, I think, for understanding some of these concepts. Uh, now our final deliverable here is going to be a HTML report that Claude is gonna generate that allows us to explore the different approaches for implementing these, uh, recommendations and show us the results as well as the DQL query used for

  81. 23:43

    each of these. So that was a look at the Dgraph MCP server. If we zoom out a little bit, so far we've seen how to work with knowledge graphs, uh, how to expose tools to a model for interacting with that knowledge graph, uh, through Dgraph.

  82. 24:06

    Uh, but there's a piece that's missing here, which is the agent orchestration. Uh, and so to enable building, uh, agentic apps-

  83. 24:15

    At Hypermode, we've created the Modus Agent Orchestration Framework, which is an open source framework for creating AI agents, uh, really for bringing

  84. 24:29

    data to models and exposing tools, uh, and abstractions for working, uh, with agentic flows. So Modus is an open source project. Uh, you can find this on GitHub.

  85. 24:44

    Really, the functionality we think of, uh, in Modus is abstractions not only for working with models and data, but a runtime for, uh, working with large scale number of agents that are stateful and long-running, uh, which is why we think it's important to have a

  86. 25:09

    runtime, uh, as well as an SDK library for working with agents. Modus does some interesting things with WebAssembly. So we use WebAssembly to target multiple languages, uh, for different SDKs.

  87. 25:27

    So you're able to write your logic in languages like Go or AssemblyScript, and then under the hood, that is compiled to WebAssembly, and a single unified GraphQL API is generated that leverages, uh, the types that you've defined in your Modus app and the signature, uh, of the functions you've defined to stitch a single

  88. 25:52

    GraphQL schema, uh, together. Uh, the Modus runtime, uh, leveraging WebAssembly gives us some advantages as well for security and a sandbox environment for your AI agents to run in.

  89. 26:08

    Uh, but all of that WebAssembly aspect is abstracted away from, uh, from the user.

  90. 26:15

    So leveraging now these open source components, so the Mo- Modus Orchestration, uh, Framework, leveraging Dgraph for building knowledge graphs, uh, let's take a look at building domain-specific agents starting with a prompt.

  91. 26:33

    Uh, so this is, uh, the core for Hypermode agents, where we think it's really important to be able, uh, to get up and running with a domain-specific agent by writing a prompt and exposing tools via MCP server.

  92. 26:51

    Uh, so, uh, for my final demo, we'll take, uh, a quick look at, uh, Hypermode agents.

  93. 27:00

    I'm gonna switch back to Hypermode, and we're gonna go to the Threads tab, uh, which is our, uh, area for building agents. Uh, let's create a new agent. We'll give him a name, Bob Loblaw, works in our marketing department as a social media intern.

  94. 27:19

    Uh, we're gonna define a prompt which gives our agent a, a bit of background. He's going to be a social media expert, uh, who's really good at, uh, creating short snippets that are showing developers how to use, uh, deep technical tooling and explain technical concepts.

  95. 27:39

    Uh, we'll choose a reasoning model. Uh, we'll use the GPT 4.1, uh, model to orchestrate this agent. Uh, and the next thing we need to do is add connections.

  96. 27:51

    Our agent needs to be able to, uh, interact with its environment, so we'll give him access to GitHub, Notion, uh, and our company docs through Ref. These are all MCP servers that are, uh, exposing tools that, uh, allow the agent to interact, uh, with those services, uh, and authorized, uh, on our behalf.

  97. 28:16

    So let's give him a task to analyze, uh, a specific GitHub repo, in this case, the Hypernews repo, which has, uh, the tooling for importing, building, querying, and working with that news knowledge graph that, uh, I showed earlier.

  98. 28:33

    And we're gonna generate, uh, social media posts that explain how to use some of the concepts explained in that GitHub repo. So at the beginning, we can see the tool calls that our agent made.

  99. 28:48

    So first, he's searching for the Hypernews GitHub repo using, uh, tools from the GitHub MCP server, then getting, uh, specific file contents to use, uh, to generate social media posts, uh, that show how to use specific features, uh, explained in, uh, or I should say implemented in this GitHub repo.

  100. 29:13

    So this is a good start, um, but let's ask our agent to update these posts to include some relevant code snippets. Uh, and so our agent is now going to choose, uh, what tools to call here, uh, going back to GitHub, looking at, uh, source files

  101. 29:38

    that may be relevant, and adding code snippets here. So now you can see our social media posts have, uh, code snippets where appropriate, and this is a mix of DQL queries when we're talking about Dgraph, some Go code from, uh, the Modus SDK, some terminal commands.

  102. 29:58

    Uh, this looks good. Uh, let's ask our agent to save this to our, uh, Notion workspace so that we can queue these up, uh, to post on, uh, our Twitter account.

  103. 30:12

    And, uh, we need to tell our agent, uh, what page, uh, to use. So we'll say, uh, "Let's post these to my private scratchpad." And again, we've authorized, uh, the agent to have access to our Notion workspace through the Notion MCP server.

  104. 30:35

    Uh, so that's how our agent is able to access my scratchpad page. Uh, and we can see the Notion tools that our agent used to update our Notion page.

  105. 30:50

    And if we switch over to Notion, we can see my scratchpad that includes our updated code snippets for our social media posts.

  106. 31:02

    So that's really cool. We, uh, built an agent just from a prompt, gave him access to actually interact with GitHub and Notion, uh, on my behalf. One thing that's really neat, uh, about Hypermode Agents is I can now eject to code, uh, to have the Modus code that, uh, we're

  107. 31:26

    using to actually run this agent. So I can then add more complex logic, other connections, uh, to enhance my agent using Modus. So that was a quick look at Hypermode Agents, being able to create an agent from a prompt and access to

  108. 31:51

    MCP-powered connections, uh, while also being able to eject to code leveraging, uh, our open source tooling.

  109. 32:03

    Hypermode Agents is in early access now, uh, so there's a link there on the screen if you'd like to, uh, sign up to give this a try for early access.

  110. 32:15

    Great. Well, that was a look at the Knowledge Graph Mullet, uh, how we can leverage tools from the property graph and RDF ecosystems, uh, to build powerful GraphRAG workflows as the foundation for building AI agents.

  111. 32:34

    Uh, I hope you found that useful. Uh, feel free to, uh, use that link on the screen to check out the slides, and also look at the resources, uh, that we've added in the video description.

  112. 32:48

    Uh, thanks a lot for watching. Cheers.