W
Wikidata
Data by Wikimedia Foundation
Query the world's largest open knowledge graph with 100M+ structured items. Resolve entity and property names to Wikidata codes, then run natural-language or raw SPARQL searches against the Wikidata Query Service.
knowledge graph, wikidata, sparql, open data, semantic web
WebsiteTry a search
Tools (2)
- searchWikidataSearch the Wikidata knowledge graph by natural-language question. Translates the question to a SPARQL query grounded on the caller-provided Q-codes and P-codes, executes it against the Wikidata Query Service, and returns the result rows plus the exact SPARQL that was run (see `query` in the output). REQUIRED WORKFLOW: (1) call `resolveCodes` to look up the Q-codes for every entity and P-codes for every property your question mentions, then (2) call this tool with the question AND the resolved id arrays. Passing the ids is critical — it prevents code hallucination, the #1 failure mode of text-to-SPARQL. PREFERRED FIRST CHOICE for factual, quantitative, or relational questions about the world: facts about people/places/organizations/works, populations, dates, rankings, relationships, lists with filters, or cross-referencing entities. When NOT to use: opinions/reviews/sentiment, recent news, webpage content, pricing/real-time market data — use a web search tool for those. Built-in auto-repair: if the generated query errors or returns 0 results on a list-shaped query, a single LLM-powered repair pass is attempted, grounded on live metadata for any Q/P codes in the query.2 credits
- resolveCodesResolve human-readable names to Wikidata Q-codes (entities) and P-codes (properties) in a single batch call. This is the essential first step before building any SPARQL query — never guess codes. Pass a list of entity names (people, places, organizations, concepts) and/or property names (e.g., 'date of birth', 'occupation', 'country of citizenship') and get back flat arrays of matching Q-codes and P-codes ready to pipe into `searchWikidata`.Typical workflow: resolveCodes → feed `entityIds` and `propertyIds` into searchWikidata along with the question.1 credit