Summary
The backend already has a fully functional read-only SPARQL endpoint (POST /api/v1/search/sparql) supporting SELECT, ASK, CONSTRUCT, and DESCRIBE queries. The frontend has SPARQL Monaco language support pre-built (lib/editor/languages/sparql.ts) with syntax highlighting and query templates, but no UI to actually run queries.
This issue tracks building the SPARQL query explorer UI to connect the two.
Plan
1. SPARQL API client (lib/api/sparql.ts)
- Typed client calling
POST /api/v1/search/sparql
- Request:
{ query, ontology_id, branch?, timeout? }
- Response handling for all three result shapes: SELECT (variables + bindings), ASK (boolean), CONSTRUCT (Turtle graph)
2. SPARQL Query Editor component
- Monaco editor instance using the existing SPARQL language definition from
lib/editor/languages/sparql.ts
- "Run Query" button with loading state
- Query timeout configuration (default 30s)
- Branch selector (query against any branch)
3. Results viewer
- SELECT: table with column headers from
variables, rows from bindings, with IRI/literal/bnode styling
- ASK: simple boolean display (true/false)
- CONSTRUCT/DESCRIBE: read-only Turtle source view (reuse TurtleEditor in read-only mode)
- Execution time display (
took_ms from response)
4. Query templates
- Expose the existing templates from
sparql.ts (SELECT, CONSTRUCT, ASK, DESCRIBE, FILTER, OPTIONAL, UNION, etc.) as a dropdown palette
- Templates should be pre-filled with relevant prefixes from the current ontology
5. Integration point
- New "SPARQL" tab in the project editor page alongside Source and Health tabs
- Accessible to all users with project read access (viewer+)
Existing infrastructure to leverage
lib/editor/languages/sparql.ts — complete Monaco language definition with tokenizer, completions, and templates
lib/editor/languages/index.ts — registerRdfLanguages() already registers SPARQL
lib/editor/lsp-client.ts — createSparqlLspClient() factory (for future LSP integration)
Related
Summary
The backend already has a fully functional read-only SPARQL endpoint (
POST /api/v1/search/sparql) supporting SELECT, ASK, CONSTRUCT, and DESCRIBE queries. The frontend has SPARQL Monaco language support pre-built (lib/editor/languages/sparql.ts) with syntax highlighting and query templates, but no UI to actually run queries.This issue tracks building the SPARQL query explorer UI to connect the two.
Plan
1. SPARQL API client (
lib/api/sparql.ts)POST /api/v1/search/sparql{ query, ontology_id, branch?, timeout? }2. SPARQL Query Editor component
lib/editor/languages/sparql.ts3. Results viewer
variables, rows frombindings, with IRI/literal/bnode stylingtook_msfrom response)4. Query templates
sparql.ts(SELECT, CONSTRUCT, ASK, DESCRIBE, FILTER, OPTIONAL, UNION, etc.) as a dropdown palette5. Integration point
Existing infrastructure to leverage
lib/editor/languages/sparql.ts— complete Monaco language definition with tokenizer, completions, and templateslib/editor/languages/index.ts—registerRdfLanguages()already registers SPARQLlib/editor/lsp-client.ts—createSparqlLspClient()factory (for future LSP integration)Related