Skip to content

SPARQL query explorer UI #48

Description

@JohnRDOrazio

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.tsregisterRdfLanguages() already registers SPARQL
  • lib/editor/lsp-client.tscreateSparqlLspClient() factory (for future LSP integration)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions