Skip to content

feat(graph-explorer): add Graph Explorer with LLM query translation, i18n, and exploration UI#52

Closed
will-yuponce-db wants to merge 13 commits intomainfrom
feature/graph-explorer
Closed

feat(graph-explorer): add Graph Explorer with LLM query translation, i18n, and exploration UI#52
will-yuponce-db wants to merge 13 commits intomainfrom
feature/graph-explorer

Conversation

@will-yuponce-db
Copy link
Contributor

@will-yuponce-db will-yuponce-db commented Feb 9, 2026

Summary

Adds a full-featured Graph Explorer for visualizing and editing property graphs stored in Databricks Unity Catalog tables. Includes backend CRUD via the Statement Execution API, a force-directed visualization canvas, LLM-powered natural language / Cypher / Gremlin to SQL query translation, and an exploration-first UI with context menus and diagram management.

Backend

  • GraphExplorerManager — all graph operations via statement_execution.execute_statement() (no Postgres/SQLAlchemy)
  • Pydantic request/response models (models/graph_explorer.py)
  • FastAPI routes: GET /api/graph-explorer, POST /save, DELETE /node, DELETE /edge, PUT /node, POST /ensure-table
  • LLM query translation endpoint — translates natural language, Cypher, and Gremlin to Databricks SQL
  • Auto-creates Databricks table if it doesn't exist (CREATE TABLE IF NOT EXISTS)
  • Consolidated LLM_ENDPOINT config (removed duplicate LLM_FOUNDATIONAL_ENDPOINT)
  • PermissionChecker on all routes (READ_ONLY for reads, READ_WRITE for mutations), matching the app-wide RBAC pattern
  • Centralized GraphExplorerManagerDep in dependencies.py / manager_dependencies.py

Frontend

  • Table name selector bar (enter catalog.schema.table, click Connect)
  • Force-directed graph visualization via react-force-graph-2d with performance optimizations
  • Node/edge CRUD dialogs, search, controls panel (filters, labels, layout sliders), node palette
  • Context menus for nodes, edges, and canvas with full CRUD actions
  • LLM query panel — natural language, Cypher, and Gremlin input with SQL preview
  • Diagram manager — save, name, and restore curated subgraph snapshots (localStorage)
  • useGraphEditor hook for client-side graph state management
  • Full i18n support (EN, DE, ES, FR, IT, JA, NL)

Code quality & CI fixes

  • Added pre-commit config, ESLint, Prettier
  • Fixed 54 failing backend unit tests and 9 test errors
  • Fixed TypeScript errors (unused imports, type mismatches)
  • Added i18n mocks to graph-explorer frontend tests

Integration

  • Feature registered in features.py (backend) and features.ts (frontend)
  • Route registered in app.py, view wired in app.tsx
  • Manager initialized at startup (startup_tasks.py)
  • Navigation sidebar picks up the feature via getNavigationGroups()
  • Permission-gated via PermissionChecker with graph-explorer feature ID

Test plan

  • TypeScript compiles cleanly (tsc --noEmit)
  • All frontend tests pass (34 graph-explorer + full suite)
  • All 680 backend tests pass (including test_graph_explorer_manager.py)
  • CI green (TypeScript Type Check, Frontend Tests, Backend Tests, Coverage Report)
  • Manual: Navigate to Graph Explorer, enter a table name, verify graph loads
  • Manual: Create/edit/delete nodes and edges, verify persistence in Databricks
  • Manual: Test LLM query translation (natural language, Cypher, Gremlin)
  • Manual: Verify unauthorized users get 403 on graph-explorer endpoints

Integrates property graph editor/visualizer from graph-demo into ontos.
All graph data reads/writes go through Databricks Statement Execution API
(no Postgres tables). Users specify a Unity Catalog table name in the UI
and the backend auto-creates it if needed.

Backend:
- GraphExplorerManager using statement_execution.execute_statement()
- Edge-centric table schema (node_start_id, relationship, node_end_id)
- Standalone nodes stored as EXISTS self-referencing edges
- Pydantic models for API request/response validation
- FastAPI routes: GET, POST /save, DELETE /node, DELETE /edge, PUT /node

Frontend:
- Table name selector with Connect/Reload/Save actions
- Force-directed graph visualization (react-force-graph-2d)
- Node/edge CRUD dialogs, search, controls panel, node palette
- useGraphEditor hook for client-side graph state management
- 33 unit tests (types, hook, component)

Also includes pre-existing config renames (postcss.config, tailwind.config
.js -> .cjs) and import reordering in database.py from prior branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
will-yuponce-db and others added 3 commits February 9, 2026 13:35
Co-authored-by: Cursor <cursoragent@cursor.com>
…oloring

Internationalize all Graph Explorer components using react-i18next with
translation files for en, de, fr, es, it, ja, nl. Fix stale closure bug
preventing edge creation by using useRef for interactive callbacks in
react-force-graph-2d. Fix node coloring to preserve type-based colors
on selection/hover by rendering state indicators as separate rings.

Co-authored-by: Cursor <cursoragent@cursor.com>
@will-yuponce-db will-yuponce-db marked this pull request as draft February 11, 2026 15:30
@will-yuponce-db will-yuponce-db changed the base branch from feature/code-quality-v2 to main February 11, 2026 15:31
will-yuponce-db and others added 7 commits February 11, 2026 11:38
…ce overhaul

Add a collapsible Graph Query Panel that translates Cypher, Gremlin, or
natural language queries to Databricks SQL via a configurable foundational
LLM endpoint (LLM_FOUNDATIONAL_ENDPOINT). Results overlay the main graph.

Backend:
- New /api/graph-explorer/query and /llm-config endpoints
- GraphExplorerManager: LLM translation, graph schema introspection,
  query result parsing, OpenAI-compatible client with SDK OBO fallback
- Pydantic models for query request/response and LLM config
- LLM_FOUNDATIONAL_ENDPOINT config with fallback chain

Frontend:
- New GraphQueryPanel component with language toggle, example queries,
  SQL preview, limit-removal, and contextual status alerts
- GraphVisualization: d3-force clustering by node type, degree-based
  sizing, adaptive edge opacity, collision forces, progressive quality
  reduction for large graphs (>5k elements), throttled hover, position
  caching across data updates
- GraphControls: edge opacity slider, "Select All" for filters, improved
  color legend with proposed/modified indicators
- Added d3-force dependency for custom force configuration
- i18n strings for query panel

Co-authored-by: Cursor <cursoragent@cursor.com>
- Regenerate yarn.lock for d3-force and @types/d3-force additions
- Add missing 'natural' key to buildExampleQueries return type

Co-authored-by: Cursor <cursoragent@cursor.com>
Phase 1 of the Graph Explorer evolution plan — exploration-first UI:

- 1a: Expand-neighbors API endpoint with direction/type filtering,
  truncation metadata; frontend mergeNeighbors/collapseNode hooks
- 1b: Right-click context menus for nodes (expand/collapse/edit/delete),
  edges (edit/delete), and canvas (create node/fit to screen)
- 1c: Server-side safety limits (GRAPH_MAX_NODES/EDGES/QUERY_TIMEOUT
  config), automatic truncation with frontend banner
- 1d: Dual results view — graph/table/split toggle with sortable
  node and edge tables
- 1e: Save/restore diagram snapshots (localStorage per table)

Tests: 38 new frontend tests (449 total), 25 backend graph explorer
unit tests — all passing, zero regressions vs baseline.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add pytest-asyncio and configure asyncio_mode=auto for async tests
- Fix Pydantic validation in test mocks (UUID, datetime, bool, int types)
- Fix logging references in security_features_manager (logging -> logger)
- Fix data_contract_id -> contract_id in data_products_manager publish
- Fix notifications_manager tests with proper mock injection
- Fix UserInfo construction in search_manager tests (add user/ip fields)
- Fix settings_manager mock with missing WORKSPACE_DEPLOYMENT_PATH

Co-authored-by: Cursor <cursoragent@cursor.com>
…missing DialogDescription

- Add DialogDescription (sr-only) to NodeForm and EdgeForm dialogs
  to satisfy Radix accessibility requirement
- Move "Clear Query" button out of CollapsibleTrigger's child button
  in GraphQueryPanel to fix validateDOMNesting warning
- Bonus: fixes 6 previously failing node-palette tests (455/455 pass)

Co-authored-by: Cursor <cursoragent@cursor.com>
…ntend tests

Remove unused imports (useMemo, React, within, container), cast Element
to HTMLElement for within() calls, and add missing react-i18next mock
to node-palette tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Eliminates the duplicate config field and its fallback validator —
graph explorer now reads LLM_ENDPOINT directly like every other feature.

Co-authored-by: Cursor <cursoragent@cursor.com>
@will-yuponce-db will-yuponce-db changed the title feat(graph-explorer): add Graph Explorer with Databricks-only CRUD feat(graph-explorer): add Graph Explorer with LLM query translation, i18n, and exploration UI Feb 11, 2026
will-yuponce-db and others added 2 commits February 11, 2026 12:46
Add PermissionChecker to all graph-explorer routes (READ_ONLY for
reads, READ_WRITE for mutations). Move get_graph_explorer_manager to
manager_dependencies.py and add GraphExplorerManagerDep to
dependencies.py, matching the pattern used by all other managers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop GraphTableView component, its tests, view-mode toggle UI, and
related i18n keys. The graph canvas is now the only view.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants