liveBook · Manning

Graph database

As explained in AI Agents and Applications

A graph database stores entities and relationships as connected data that can be queried by those relationships.

A graph database stores entities as nodes and their connections as edges, then lets applications navigate and query those relationships directly. This structure suits knowledge-intensive applications where relationships, inference, and explainability matter more than simple similarity retrieval. section 10.5 section 1.2.1

A small graph

A person named Roberto can connect to a profession, a football team, and that team's league: (Roberto, hasOccupation, SoftwareDeveloper), (Roberto, isFanOf, InterMilan), and (InterMilan, playsIn, SerieA). The same facts can be represented as RDF subject-predicate-object triples or queried through systems such as Neo4j with Cypher and other systems with Gremlin. section 10.5

Figure 10.4 Graph representation of data. Nodes represent entities such as Roberto and InterMilan, while edges such as hasOccupation and isFanOf depict their relationships.
figure

Use the graph representation to inspect how entity nodes and relationship edges encode facts that are difficult to capture in traditional database structures. section 10.5

In LLM applications, a graph database complements rather than replaces vector retrieval. It can preserve longer-lived entity relationships for memory and planning, while an LLM can extract graphs from unstructured text, generate Cypher or SPARQL from natural-language questions, and turn query results into answers. Reliable query generation requires schema-constrained prompts with examples and careful handling of generated statements. section 1.2.1 section 10.5

Figure 10.5 The Knowledge Graph RAG architecture (KG-RAG) is similar to vector store–based RAG setups, but it uses a SPARQL generator. The generator converts a natural language question into SPARQL, which is executed on the knowledge graph database. The retrieved graph data is then provided to the LLM, along with the original question, to synthesize the answer.
figure

Follow the Knowledge Graph RAG flow from a natural-language question to generated SPARQL, graph execution, retrieved data, and synthesized response. section 10.5

How AI Agents and Applications covers it

How deep it goes
Defines nodes, edges, triples, and query languages, then sketches LLM-assisted extraction and generation without detailing database operations.
Examples
Uses Roberto, InterMilan, and SerieA triples plus a Knowledge Graph RAG pipeline and schema-constrained Cypher prompt.
What it assumes
Assumes familiarity with databases and LLM applications while introducing graph entities, relationships, RDF triples, and query generation.
What you can do after
Evaluate graph-backed RAG designs and understand how LLMs extract relationships, generate queries, and synthesize graph results.
How it connects
Connects graph databases with knowledge graphs, vector stores, RAG, agents, RDF, SPARQL, Cypher, Gremlin, and LangChain.

Also explained in

Compare how 4 books explain graph database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.