ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

wikidata-query-skill

Transform natural language questions into SPARQL queries for Wikidata and generate beautiful HTML results pages. Query the Wikidata knowledge base using plain English prompts.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/kidehen/query-wikidata
Or

Wikidata Query Skill

When to Use This Skill

Use this skill when users want to:

  • Query Wikidata using natural language
  • Get comprehensive, multilingual data about entities
  • Access property-rich information (Wikidata has extensive properties)
  • Create visualizations of Wikidata query results
  • Generate HTML reports from SPARQL queries
  • Query data with better temporal coverage than DBpedia

Core Capabilities

Natural Language to SPARQL: Convert user questions into valid Wikidata SPARQL ✅ Query Execution: Execute queries against Wikidata Query Service ✅ HTML Generation: Create beautiful, interactive HTML result pages ✅ Multiple Output Formats: JSON, Markdown tables, or HTML ✅ Label Service: Automatic label resolution for human-readable results

Wikidata Endpoint

SPARQL Endpoint: https://query.wikidata.org/sparql Accept Header: application/sparql-results+json Method: HTTP GET with URL-encoded query User-Agent: Required (use Claude-Code-Wikidata-Skill/1.0)

Wikidata Naming Convention

Properties: wdt:P### (e.g., wdt:P57 for director) Entities: wd:Q### (e.g., wd:Q51566 for Spike Lee) Service: wikibase:label for automatic label resolution

Common Wikidata Properties

P31  - instance of
P57  - director
P577 - publication date
P2130 - cost/budget
P50  - author
P170 - creator
P19  - place of birth
P20  - place of death
P569 - date of birth
P570 - date of death
P27  - country of citizenship
P106 - occupation
P735 - given name
P734 - family name
P1082 - population
P36  - capital

Query Conversion Workflow

When a user provides a natural language prompt:

1. Identify Entity

Find the Wikidata Q-number for the main subject:

  • Use descriptive search if needed
  • Example: "Spike Lee" → wd:Q51566

2. Map to Wikidata Properties

Common mappings:

  • "directed by" → wdt:P57
  • "release date" / "published" → wdt:P577
  • "budget" → wdt:P2130
  • "born in" → wdt:P19
  • "author" / "written by" → wdt:P50
  • "population" → wdt:P1082
  • "capital" → wdt:P36

3. Construct SPARQL Query

Template with Label Service:

SELECT DISTINCT ?item ?itemLabel ?property
WHERE {
  ?item wdt:P### wd:Q### ;     # property: entity
        wdt:P31 wd:Q### .       # instance of: type
  OPTIONAL { ?item wdt:P### ?property . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY <sort_criteria>
LIMIT <number>

CRITICAL: Always include the label service for human-readable output!

4. Execute Query

Use curl with proper headers:

curl -s -G "https://query.wikidata.org/sparql" \
  -H "Accept: application/sparql-results+json" \
  -H "User-Agent: Claude-Code-Wikidata-Skill/1.0" \
  --data-urlencode "query=<SPARQL_QUERY>"

5. Generate Output

Options:

  • JSON: Raw query results
  • Markdown Table: Formatted for terminal display
  • HTML Page: Interactive, styled results page with Wikidata branding

Metadata

Author@kidehen
Stars1776
Views0
Updated2026-03-02
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-kidehen-query-wikidata": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.