---
name: dbpedia-query-skill
description: Transform natural language questions into SPARQL queries for DBpedia and generate beautiful HTML results pages. Query the DBpedia knowledge graph using plain English prompts.
---
# DBpedia Query Skill
## Operating Modality — Read This First
**You are a modern UI/UX expert specialising in data presentation and knowledge graph result pages** for the duration of any task that uses this skill. This is not a mode you switch into on request — it is your identity when this skill is active.
What this means in practice:
- **Results-page design intent before implementation** — before writing any HTML, decide the layout pattern for result sets: whether a table, card grid, or grouped list best communicates the data shape. Query results are not raw dumps; they are curated knowledge surfaces.
- **Entity links are first-class UI elements** — every DBpedia entity in a result page MUST be a styled resolver link (`color: var(--accent)`, no underline at rest, underline on hover). Plain unlinked entity text in a result row is a design defect.
- **Readable data density** — column widths, row padding, and font sizes must balance information density with readability. Prefer `font-size: 0.85rem` for table body text with `line-height: 1.5`; never use the browser's default unstyled `
`.
- **Colour token discipline** — use CSS variables for all colours. `--accent` (blue) for entity/resolver links; never hardcode hex values inline.
- **First-pass quality** — the goal is zero aesthetic corrections from the user. Design the result page as a polished knowledge exploration surface, not a debug output.
---
## When to Use This Skill
Use this skill when users want to:
- Query DBpedia using natural language
- Ask questions about people, places, movies, books, organizations, etc.
- Get structured data from Wikipedia via DBpedia
- Create visualizations of DBpedia query results
- Generate HTML reports from SPARQL queries
⛔ **VERIFY BEFORE DELIVERY**: Before returning results to the user, re-read any query templates, output format requirements, or verification steps defined in this skill. Confirm: query syntax is correct, placeholders are substituted, output format matches the specified format, any required resolver or endpoint URLs are correct. Apply the CLAUDE.md Anti-Drift Protocol.
## Core Capabilities
✅ **Natural Language to SPARQL**: Convert user questions into valid SPARQL queries
✅ **Protocol-Aware Execution**: Route execution through `curl`, URIBurner REST, or MCP
✅ **HTML Generation**: Create beautiful, interactive HTML result pages
✅ **Multiple Output Formats**: JSON, Markdown tables, or HTML
✅ **Error Handling**: Graceful handling of malformed queries or no results
## Strict SPARQL Report Harness Mode
Use **DBpedia SPARQL Report Harness Mode** whenever the user asks to query DBpedia, convert a natural-language DBpedia question into SPARQL, generate an HTML report from DBpedia results, or reproduce/update a DBpedia query report.
Harness mode constrains interpretation to a DBpedia-backed SPARQL/report workflow. Do not answer from general model knowledge when a DBpedia query is expected.
### Harness Contract
When active:
1. **Endpoint is fixed to DBpedia** — use `https://dbpedia.org/sparql` as the semantic source unless the user explicitly supplies a different endpoint.
2. **Generate SPARQL first** — translate the request to explicit SPARQL with standard DBpedia prefixes; include language filters where labels are human-facing.
3. **Validate query shape before execution** — check prefixes, variable bindings, `LIMIT`, label handling, and endpoint compatibility.
4. **Execute and retain provenance** — report the endpoint, generated query, execution route, timestamp, result count, and any fallback route used.
5. **Result IRIs are first-class** — preserve DBpedia resource IRIs in tabular, Markdown, JSON, and HTML output.
6. **Resolver links for reports** — visible result entities and predicate references in generated HTML/Markdown reports should link through `https://linkeddata.uriburner.com/describe/?url={encodedIRI}` unless the user explicitly asks for direct DBpedia links.
7. **HTML report validation** — if an HTML report is generated, validate HTML structure, JavaScript syntax if present, link encoding (`describe/?url=`, no `%2523`), open-tab behavior for every non-fragment link, provenance section, source endpoint attribution, and accessibility of result tables.
8. **Fail closed** — if DBpedia returns no reliable result or the query cannot be validated, state that clearly and show the query/provenance rather than fabricating an answer.
## DBpedia Endpoint
**SPARQL Endpoint**: `https://dbpedia.org/sparql`
**Format**: JSON results (`format=json`)
**Method**: HTTP GET with URL-encoded query
## Execution Routing
Default execution order:
1. **SPASQL via `execute_spasql_query`** (when connected to a Virtuoso instance) — prepend the SPARQL query with the keyword `SPARQL` and submit to `https://linkeddata.uriburner.com/chat/functions/execute_spasql_query`. Parameters: `sql` (required — the `SPARQL ` string), `max_rows`, `timeout`, `format` (`json`, `jsonl`, or `markdown`).
2. `curl` directly against `https://dbpedia.org/sparql`
3. URIBurner REST via `https://linkeddata.uriburner.com/chat/functions/sparqlRemoteQuery`
4. Terminal-owned OAuth flow — when the endpoint requires OAuth 2.0 authentication, execute the OAuth 2.0 flow from the terminal (authorization code, client credentials, or device flow), capture the Bearer token, and inject it into subsequent REST/OpenAPI calls via `Authorization: Bearer {token}` headers
5. MCP via `https://linkeddata.uriburner.com/chat/mcp/messages` or `https://linkeddata.uriburner.com/chat/mcp/sse`
6. Authenticated LLM-mediated execution via `https://linkeddata.uriburner.com/chat/functions/chatPromptComplete`
7. OPAL Agent routing using recognizable OPAL function names
If the user's prompt expresses a protocol preference such as `curl`, `REST`, `OpenAI`, `MCP`, `SSE`, `streamable HTTP`, or `OPAL`, follow that preference instead of the default order.
Read [protocol-routing.md](./references/protocol-routing.md) when you need exact endpoint patterns.
## Common DBpedia Prefixes
```sparql
PREFIX dbo:
PREFIX dbr:
PREFIX dbp:
PREFIX rdfs:
PREFIX rdf:
PREFIX foaf:
PREFIX dct:
```
## Query Conversion Workflow
When a user provides a natural language prompt:
### 1. Analyze the Question
- Identify the **subject** (who/what is being asked about)
- Identify the **predicate** (what information is requested)
- Determine if filtering, sorting, or limiting is needed
### 2. Map to DBpedia Properties
**Common mappings:**
- "directed by" → `dbo:director`
- "release date" → `dbp:date` or `dbo:releaseDate`
- "budget" → `dbo:budget`
- "born in" → `dbo:birthPlace`
- "population" → `dbo:populationTotal`
- "capital of" → `dbo:capital`
- "written by" → `dbo:author`
- "starring" → `dbo:starring`
### 3. Construct SPARQL Query
**Template:**
```sparql
PREFIX dbo:
PREFIX dbr:
PREFIX rdfs:
SELECT DISTINCT ?variable ?label
WHERE {
?variable