Wikidata › The Solution: Facts as Data, Not Text

Michael BrenndoerferJune 5, 20259 min read
History of Language AIAll chapters
Part 4 of 9Deep Learning Arrives
Chapter 42Wikidata › The Solution: Facts as Data, Not Text
Reading section 3 of 7 · The Solution: Facts as Data, Not Text · 9 minSection 3 of 7 · 9 min

Book contents

Section 3 of 7 · 9 min read

Wikidata › The Solution: Facts as Data, Not TextOne section · Sections in this chapter3 / 7 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Wikidata's solution was elegantly simple: instead of storing facts as sentences that need to be parsed, store them as structured data that machines can query directly. Think of it like the difference between telling someone "Paris is the capital of France" and filling out a form:

Entity: Paris Property: capital of Value: France

The first requires understanding natural language. The second is unambiguous data that a program can query instantly. This shift from text to structure solved all the problems we just discussed.

The Building Blocks: Items, Properties, and Values

At the heart of Wikidata sits a beautifully simple data model with just three core concepts. Let's understand each one:

Items represent entities in the world.people, places, concepts, events, anything you can point to and say "that thing." Each item gets a unique identifier that looks a bit cryptic at first:

  • Paris → Q90
  • France → Q142
  • Douglas Adams → Q42
  • The concept "cat" → Q146

These identifiers are completely language-independent. Q90 means Paris whether you're speaking English, French, Japanese, or Swahili. That independence lets the same item support multiple languages, as we'll see.

Properties represent attributes or relationships.the connections between items. They also get unique identifiers:

  • "capital of" → P36
  • "birth date" → P569
  • "population" → P1082
  • "author" → P50

Like items, properties work across all languages. P36 means "capital of" regardless of what language you're using.

Values complete the statements. This provided the actual data. A value might be:

  • A specific date (March 11, 1952)
  • A number (2.1 million)
  • Most commonly, a reference to another item (Q142 for France)

How Facts Become Triples

These three building blocks combine to create what we call triples.simple statements with three parts: subject-property-object. The fact "Paris is the capital of France" becomes:

(Q90, P36, Q142)

Or in more readable form:

Paris (Q90) → capital of (P36) → France (Q142)

That's it. No parsing required. No ambiguity. Just a clean, queryable fact that any program can understand instantly.

Multiple statements about the same entity can be associated with the same item. Paris (Q90) has hundreds of properties:

  • Population → 2.1 million
  • Area → 105.4 square kilometers
  • Mayor → Anne Hidalgo (Q3284)
  • Founded → 3rd century BC
  • Country → France (Q142)
  • Instance of → city (Q515)

Each property creates another connection in what we call a knowledge graph.a web of entities connected by relationships.

Why Triples Matter

The triple structure (subject-property-object) forms the foundation of knowledge graphs, and it's more powerful than it might seem at first.

Each triple represents a single factual claim that can be independently verified, updated, or removed. This atomic structure allows Wikidata to handle partial information gracefully. If one fact about an entity changes (say, Paris's population), only that specific triple needs updating while other facts remain intact. No need to rewrite entire paragraphs or worry about maintaining consistency across text.

The triple model also enables multi-hop reasoning.following chains of relationships to answer complex questions. Want to find all cities with populations over 1 million that are capitals of countries in Europe? You can query that by following property chains:

city → population → > 1 million
city → capital of → country
country → located in → Europe

This kind of reasoning is trivial with triples but nearly impossible with unstructured text.

The structured representation eliminated the ambiguity that plagued natural language text. Instead of parsing a sentence like "Paris, the capital city of France, has a population of over 2 million," the system stored discrete facts:

  • Paris (Q90) → capital of (P36) → France (Q142)
  • Paris (Q90) → population (P1082) → 2.1 million
  • Paris (Q90) → instance of (P31) → city (Q515)

This precision enabled automated systems to retrieve, combine, and reason about facts without the uncertainty that comes with natural language understanding. No more wondering whether "bank" refers to a financial institution or the side of a river.the entity identifier makes it unambiguous.

Building Knowledge Together

Wikidata used Wikipedia's proven model of open collaboration. Anyone could add facts or correct and maintain existing data. This solved a problem that had doomed earlier knowledge bases.

Traditional knowledge bases required small teams of experts to curate every fact. This approach doesn't scale. A team of 10 experts might manage 100,000 facts, but what about 100 million facts? You'd need 10,000 experts working full-time. That's not feasible.

Wikidata took a different approach: let the community build it. Anyone could:

  • Add new items and properties
  • Contribute facts with sources
  • Correct errors
  • Update information as it changes
  • Review and verify other contributors' work

This collaborative model enabled remarkably rapid growth. Within months of launch, Wikidata contained millions of items covering diverse domains from geography and history to science and culture. The decentralized editing model meant that experts in specific domains could contribute specialized knowledge (a marine biologist could add facts about whale species), while general contributors could add widely known facts (anyone could add the capitals of countries).

Quality Control Through Community

But wait.if anyone can edit, how do you ensure quality? Wikidata implemented several sophisticated mechanisms:

Source citations: Each statement could include references pointing to sources, enabling verification and traceability. If someone claimed that Paris had a population of 10 million, they needed to cite a source. The community could then verify that claim.

Qualifiers for context: Contributors could add qualifiers providing additional context. A person's occupation might change over time, so you could add temporal qualifiers:

  • Occupation: Professor (2000-2005)
  • Occupation: University President (2005-2010)
  • Occupation: Author (2010-present)

This allowed Wikidata to represent facts that change over time without losing historical information.

Complete change history: The system tracked every edit ever made. The community could review changes, revert problematic edits, and understand how information evolved. If someone vandalized a page, it could be reverted with a single click.

Community consensus: Disputed facts could be discussed and resolved through community consensus, just like Wikipedia articles. The collaborative model meant thousands of eyes were watching for errors and inconsistencies.

Breaking Language Barriers

Remember the multilingual nightmare we discussed earlier? Wikidata solved it with an elegant design: language-agnostic identifiers combined with multilingual labels.

Take the item Q146, which represents the concept of a cat (the animal). The identifier is the same in every language.it's just a number. But this item has labels in dozens of languages:

  • English: "cat"
  • French: "chat"
  • German: "Katze"
  • Spanish: "gato"
  • Japanese: "猫" (neko)
  • Arabic: "قط" (qiṭṭ)

Applications query the knowledge graph using language-agnostic identifiers, then retrieve labels in whatever language they need. A French application could ask for all animals with four legs and get back Q146, Q144 (dog), Q726 (horse), and others, then display the French labels to users.

This approach enabled multilingual applications while avoiding the duplication and inconsistency problems that had plagued language-specific knowledge bases. The facts are stored once, but they can be displayed in any language.

The Wikipedia Integration

The multilingual design revolutionized how Wikipedia language editions worked together. Instead of each language edition maintaining separate infobox data (with all the inconsistencies that created), they could all reference the same Wikidata items.

When a fact changed.a person's occupation, a place's population, a country's leader.updating the single Wikidata item automatically propagated the change to all 300+ language editions that used that information. This centralization dramatically reduced maintenance burden while ensuring consistency across languages.

No more situations where:

-English Wikipedia says Paris has 2.1 million people

  • French Wikipedia says 2.2 million
  • German Wikipedia says 2.3 million
  • Spanish Wikipedia has no population data at all

Now there's one authoritative source (Wikidata), and all language editions display the same fact in their respective languages. Update it once, and it updates everywhere.

Querying the Knowledge Graph

Wikidata provided programmatic access through its API and a query language called SPARQL (pronounced "sparkle"). Think of SPARQL as SQL for knowledge graphs.it lets you ask complex questions about entities and their relationships.

Unlike SQL's tabular queries that work with rows and columns, SPARQL queries traverse relationships between entities. Here's a simple example. Want to find all female scientists born in the 19th century who won a Nobel Prize? In SPARQL, you'd write something like:

SELECT ?scientist ?scientistLabel WHERE {
  ?scientist wdt:P31 wd:Q5 .           # is a human
  ?scientist wdt:P21 wd:Q6581072 .     # gender: female
  ?scientist wdt:P106 wd:Q901 .        # occupation: scientist
  ?scientist wdt:P569 ?birthDate .     # has birth date
  ?scientist wdt:P166 wd:Q7191 .       # received: Nobel Prize
  FILTER(YEAR(?birthDate) >= 1800 && YEAR(?birthDate) < 1900)
}

This query follows chains of relationships (scientist → occupation → scientist, scientist → received → Nobel Prize) and applies filters (birth year between 1800 and 1900). The result? A list of scientists matching all these criteria, pulled from millions of entities in milliseconds.

SPARQL: The Language of Knowledge Graphs

SPARQL (SPARQL Protocol and RDF Query Language) enabled applications to perform complex reasoning tasks that would be difficult or impossible with traditional databases.

Want to find all cities with populations over one million that are capitals of countries in Europe? SPARQL can do that by following property chains:

city → population → > 1 million
city → capital of → country  
country → located in → Europe

Want to find all actors who starred in movies directed by someone who won an Oscar? SPARQL can traverse those relationships too:

actor → starred in → movie
movie → directed by → director
director → received → Oscar

This kind of multi-hop reasoning is what makes knowledge graphs so powerful for AI applications.

Open Access: Knowledge for Everyone

The open access model meant that anyone could use Wikidata's structured knowledge without restrictions, licenses, or fees. Removing those barriers encouraged adoption:

  • Researchers could download complete data dumps for offline processing and analysis
  • Applications could query the live database through APIs without usage limits
  • Developers could build tools that used Wikidata's knowledge for their own purposes
  • Students could learn about knowledge graphs with real-world data

This openness accelerated adoption and enabled innovative applications that would not have been possible with closed or proprietary knowledge bases. By 2012, the open source and open data movements had demonstrated the power of unrestricted access to information, and Wikidata embraced these principles fully.