What Are Knowledge Graphs? A Gentle Introduction
What Are Knowledge Graphs? A Gentle Introduction
The Story Behind the Web of Connections
Consider the last time you planned a trip. Perhaps you wanted to visit Paris for a week, see the Eiffel Tower, try authentic French cuisine, and perhaps squeeze in a day trip to Versailles. If you pause and reflect on how your mind worked through this planning process, you'll notice something fascinating: your brain didn't process this as a linear to-do list. Instead, you likely thought in connections. You associated the Eiffel Tower with its location in Paris, connected Paris to France, linked French cuisine to specific dishes you'd heard about, and considered how transportation might connect these various experiences. You might have thought about your friend Sarah who visited Paris last year and posted photos of a small café near the Seine—this memory became part of your planning web, influencing where you might want to eat.
This natural, interconnected way of thinking represents the essence of what knowledge graphs capture and enable. A knowledge graph is, at its core, a way of organizing information that mirrors how humans naturally think and reason about the world—through relationships between things, not just isolated facts about individual things.
Now, consider another scenario. Think about your social circle—your friends, family, colleagues, and acquaintances. If you were to draw this out on paper, you wouldn't just list names in a column. You'd naturally start connecting people: "Alice is married to Bob," "Carol is Alice's sister," "David works with Carol," "Emily is Carol's college roommate." These connections form a web, and understanding any person in this network means understanding their relationships to others.
Knowledge graphs work exactly this way. They represent information as a network where discrete pieces of knowledge—called entities—are linked together through meaningful relationships. This structure allows computers and humans alike to navigate information naturally, following connections the way you might follow a path through an interesting neighborhood, discovering new insights along the way.
Understanding Knowledge Through Connections
The human brain possesses an extraordinary capacity for recognizing patterns and making connections. When you hear the word "apple," your mind doesn't simply retrieve a dictionary definition. Instead, a cascade of associations emerges: the fruit itself, perhaps the technology company with the same name, the story of Isaac Newton's inspiration, the phrase "an apple a day keeps the doctor away," or memories of your grandmother's apple pie. Each of these associations links to other concepts, creating an ever-expanding web of interconnected knowledge in your mind.
Cognitive scientists describe this phenomenon as associative memory, and it represents one of the most powerful aspects of human cognition. We excel at recognizing similarities between disparate concepts, drawing analogies, and applying knowledge from one domain to solve problems in another. Traditional computer systems, however, have struggled to replicate this kind of flexible, associative thinking.
For most of computing history, information has been stored in highly structured formats that rigidly separate data into distinct categories. Databases organize information into tables with rows and columns, like a spreadsheet. Each piece of information sits in its designated cell, with strict rules about what types of data can be stored where. While this approach offers advantages in terms of data integrity and efficient storage for specific, predictable queries, it struggles when we want to explore information in flexible, exploratory ways.
Imagine trying to answer a question like "Which philosophers influenced scientists who studied quantum mechanics?" using a traditional database. You would need to know the exact table structure, the foreign key relationships, and write a complex query joining multiple tables. The database wouldn't understand that "influenced" represents a meaningful intellectual connection that might manifest in various ways—through direct mentorship, through published works, through shared institutional affiliations, or through explicit acknowledgments in academic papers.
Knowledge graphs take a fundamentally different approach. Instead of organizing information into rigid tables, they represent knowledge as a graph—a mathematical structure composed of nodes and edges. In this context, nodes represent entities (things we want to represent), and edges represent relationships (the connections between things). This simple but powerful abstraction allows us to model the rich, interconnected nature of real-world knowledge.
The Three Pillars of Knowledge Graphs
Every knowledge graph rests on three foundational pillars: entities, relationships, and semantics. Understanding these three components—and how they work together—provides the foundation for everything that follows in this book.
Entities: The Things in Our Knowledge Universe
Entities are the fundamental building blocks of a knowledge graph. An entity represents a distinct thing that exists in the world and can be meaningfully distinguished from other things. The scope of what can qualify as an entity is remarkably broad: a person, a place, a concept, an event, a product, an animal, a molecule, or even an abstract idea can be an entity within a knowledge graph.
Consider how many different entities might exist within a knowledge graph about the city of London. You would find entities for specific people (the Mayor of London, famous authors who lived there, historical figures), places (the Tower of London, Hyde Park, Westminster Abbey, specific neighborhoods), organizations (the Metropolitan Police, the British Museum, Transport for London), events (the Great Fire of London, the 2012 Olympics), concepts (the British constitutional system, the concept of a "borough"), and products (the London Underground's Oyster card system). Each of these entities represents a distinct node in the knowledge graph, waiting to be connected to other entities through relationships.
Entities typically have properties that describe their characteristics. A person entity might have properties for name, date of birth, nationality, and occupation. A place entity might have properties for geographic coordinates, population, and administrative region. These properties provide additional detail about each entity, enriching the information available for queries and analysis.
An important aspect of entities is how they're uniquely identified. In a well-designed knowledge graph, each entity has a unique identifier that distinguishes it from all other entities, even if they share similar names. This is essential because natural language is full of ambiguities: "Paris" could refer to the capital of France, a city in Texas, or a person named Paris. A knowledge graph resolves this ambiguity by giving each Paris a unique identifier and carefully defining its relationships, allowing the system to understand exactly which Paris is being discussed in any context.
Relationships: The Connections That Give Meaning
If entities are the nouns of a knowledge graph, relationships are the verbs—the actions and connections that link entities together and bring the graph to life. A relationship connects two entities and describes the nature of their connection. Where an entity might exist in isolation in a purely descriptive model, relationships transform a collection of facts into a network of interconnected knowledge.
Relationships in knowledge graphs are explicit and typed, meaning we don't just know that two entities are connected—we know exactly how they're connected. Instead of a generic "linked to" relationship, we might specify "works for," "married to," "located in," "invented by," or "caused by." This specificity is enormously valuable because it allows the knowledge graph to under