Skip to content
wikidata-search logo

Wikidata Search Skill

wikidata-search

Search for items and properties on Wikidata and retrieve entity details, claims, and external identifiers. Supports both keyword search (Wikidata Action API) and semantic/hybrid search (Wikidata Vector Database), plus direct entity retrieval (Special:EntityData) and structured querying (WDQS SPAR...

kltng/humanities-skills0installs7stars

SKILL.md

Full skill instructions

Wikidata Search Skill

Search and retrieve data from Wikidata, the free knowledge base.

Critical: Things Claude Won't Know Without This Skill

Wikidata Vector Database (semantic search)

This is the highest-value feature of this skill. The Wikidata Vector Database at wd-vectordb.wmcloud.org provides semantic/​hybrid search over all Wikidata items — something you can't do with the standard Action API or SPARQL.

A descriptive User-Agent header is required or you get 403.

curl -H 'User-Agent: WikidataSearchSkill/​1.0 (contact: [email protected])' \
  'https://wd-vectordb.wmcloud.org/​item/​query/?query=historical+Chinese+cartography&lang=all&K=20'

Response includes QID, similarity_score, rrf_score, and source (vector vs keyword).

Property search: replace /​item/​query/ with /​property/​query/.

Optional params: lang, K (result count), instanceof (comma-separated QIDs), rerank.

WDQS SPARQL also requires User-Agent

curl -G 'https://query.wikidata.org/​sparql' \
  --data-urlencode 'query=SELECT ?item ?label WHERE { ?item wdt:P31 wd:Q12857432 . ?item rdfs:label ?label . FILTER(LANG(?label)="en") }' \
  -H 'Accept: application/​sparql-results+json' \
  -H 'User-Agent: WikidataSearchSkill/​1.0 (contact: [email protected])'

External identifiers live in claims

# claims[property_id][0]["mainsnak"]["datavalue"]["value"] → identifier string
# Common: P214 (VIAF), P244 (LoC), P227 (GND), P213 (ISNI), P268 (BnF)

Choosing an Access Method

NeedMethod
Keyword search by label/​aliasAction API wbsearchentities
Semantic / fuzzy concept discoveryVector Database (hybrid vector + keyword)
Fetch a known entity's JSONSpecial:EntityData/​{ID}.json
Complex graph queries / reportingWDQS SPARQL

Python Script

Use scripts/​wikidata_api.py for programmatic access (zero dependencies):

from scripts.wikidata_api import WikidataAPI
wd = WikidataAPI()

# Keyword search
results = wd.search("Zhu Xi", language="en", limit=5)

# Semantic search (Vector DB) — the key differentiator
candidates = wd.vector_search_items("historical Chinese cartography", lang="all", k=20)

# Entity retrieval
entity = wd.get_entity("Q9397", props=["labels", "descriptions", "claims"])

# External identifiers
ids = wd.get_identifiers("Q9397", include_labels=True)
# → {'VIAF ID (P214)': '46768804', 'Library of Congress ID (P244)': 'n81008179', ...}

# SPARQL
results = wd.sparql_json("SELECT ?item ?label WHERE { ?item wdt:P31 wd:Q12857432 . ?item rdfs:label ?label . FILTER(LANG(?label)='en') }")

# Direct entity JSON (fast for current state)
data = wd.get_entitydata("Q42", flavor="simple")

API Endpoints Quick Reference

EndpointURL
Action APIhttps://www.wikidata.org/​w/​api.php
Entity JSONhttps://www.wikidata.org/​wiki/​Special:EntityData/​{ID}.json
SPARQLhttps://query.wikidata.org/​sparql
Vector DBhttps://wd-vectordb.wmcloud.org

API Etiquette

  • Rate limit: 0.5–1s between requests
  • User-Agent: Required for Vector DB and WDQS (include contact info)
  • Respect 429: Honor Retry-After headers
  • Action API: Use maxlag parameter; batch with pipe-separated IDs (max 50)
  • SPARQL: Request only needed fields; use LIMIT

Related Skills

  • cbdb-api: Cross-reference Wikidata entities with CBDB biographical data for Chinese historical figures
  • chgis-tgaz: Look up historical places found via Wikidata in the CHGIS Temporal Gazetteer for detailed administrative history

Resources

  • references/​api_reference.md — Complete API specs for all four access methods
  • scripts/​wikidata_api.py — Full-featured Python client with rate limiting, retries, and identifier extraction

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View