How do I query Wikidata data with SPARQL?

Updated

Wikidata provides an official SPARQL query service, and that is the intended starting point for querying its structured data. You can begin from the "Get started with Wikidata's SPARQL query service" link on the Wikidata main page. One important condition to keep in mind: the query service is being migrated from Blazegraph to QLever, so existing queries and tools may need adaptation.

What you need before you start

  • A basic understanding of what Wikidata is: a free and open knowledge base that can be read and edited by both humans and machines, acting as central storage for structured data of Wikimedia sister projects and supporting many other sites and services.
  • Familiarity with the idea of data entities. The main page notes Wikidata currently holds 123,585,203 data entities.
  • No special account is required just to read or query data, since the content is available under a free license and exported using standard formats. Creating a user account is mentioned as part of getting involved with the community, not as a prerequisite for querying.

Step-by-step: running your first query

  1. Open the query service. From the Wikidata main page, follow the "Get started with Wikidata's SPARQL query service" link. This is the official entry point described in the page evidence.
  2. Explore a known item first. The main page suggests looking at a featured showcase item for author Douglas Adams (Q42). This helps you see how an entity and its statements are structured before writing queries.
  3. Write or load a SPARQL query. The query service is where you enter SPARQL to retrieve structured data. The page evidence does not describe specific menu positions or editor buttons, so rely on the service's own interface once you arrive.
  4. Run the query and read the results. Expected result: a set of structured data returned from Wikidata's knowledge base, which you can then reuse in your own project.
  5. Adapt for the new endpoint if needed. Because the service is migrating from Blazegraph to QLever, queries and tools may need changes to work with the new endpoint.

The migration you should plan for

The Wikidata Query Service Days 2026 event, scheduled for October 17 to 23, is an online event focused on:

  • the migration of the Wikidata Query Service from Blazegraph to QLever;
  • supporting the Wikidata community, tool maintainers, and data reusers in adapting their queries and tools to the new endpoint.

The session program is described as out now. If you maintain queries or tools, this is the relevant signal to follow.

Common sticking points

  • Assuming your old query still works unchanged. The migration means queries and tools may need adaptation to the new endpoint.
  • Skipping the introduction. The main page points to the Wikidata introduction and tutorials; starting there reduces confusion about entities and statements.
  • Querying without a target item. Looking at a showcase item such as Q42 first gives you a concrete model to imitate.

Where to get help

  • Project chat, Telegram groups, or the live IRC chat are listed as places to talk and ask questions.
  • The community portal is described as the place for a complete starters' guide.
  • The Wikidata introduction explains what Wikidata is.
  • Tutorials are available for learning to edit Wikidata, which supports understanding the data you query.

Using the data afterward

Wikidata content is available under a free license, exported using standard formats, and can be interlinked to other open data sets on the linked data web. The main page also links to guidance on how you can retrieve and use data from Wikidata, which is the natural next step after a successful query.