Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

docs(explorer): align explorer routes, CLI flags, and APIs with implementation

Sameer6305c62ff0238a2a
diff --git a/docs/reference/explorer.md b/docs/reference/explorer.md
index 9690007a..6475b3f2 100644
--- a/docs/reference/explorer.md
+++ b/docs/reference/explorer.md
@@ -1,118 +1,129 @@
---
title: "Explorer"
-description: "Interactive FastAPI dashboard for knowledge graph exploration and the Ontology Hub."
+description: "Interactive FastAPI dashboard for knowledge graph exploration, ontology management, and graph analytics."
icon: "map"
---
`semantica.explorer` is a browser-based dashboard for exploring knowledge graphs, managing ontologies, and running visual analyses — no code required after launch.
-## Launch Interface
+## Getting Started
-```bash
-# Install and launch
-pip install semantica[explorer]
-
-# Start the Explorer dashboard
-semantica-explorer --graph my_graph.json --port 8000
+Install, export your graph to JSON, and launch:
-# Or via Python module
-python -m semantica.explorer --graph my_graph.json --port 8000 --host 0.0.0.0
+```bash
+pip install "semantica[explorer]"
```
-<Tip>
- `semantica.explorer` is a **server process**, not a Python library. It exposes no importable classes. Use the CLI or `python -m semantica.explorer` to launch.
-</Tip>
-
-| CLI Flag | Default | Description |
-| --- | --- | --- |
-| `--graph` | required | Path to a graph JSON/pickle file to load on startup |
-| `--port` | `8000` | HTTP port to listen on |
-| `--host` | `127.0.0.1` | Bind address — use `0.0.0.0` to expose on the network |
-| `--no-browser` | off | Suppress auto-opening the browser tab |
-| `--config` | — | Path to a YAML config file for graph store and auth settings |
-| `--debug` | off | Enable debug mode with hot-reload |
-
-## What You Get
-
-<CardGroup cols={2}>
- <Card title="Graph Explorer" icon="diagram-project">
- Interactive node/edge search, filtering, path highlighting, and neighborhood expansion. Indexed search at 0.004ms on 118k-node graphs.
- </Card>
- <Card title="Ontology Hub (v0.5.0)" icon="sitemap">
- Visual ontology editor, SHACL Studio, alignment authoring, health dashboard, and version control — all in the browser.
- </Card>
- <Card title="Distance Intelligence (v0.5.0)" icon="circle-nodes">
- Semantic similarity search, ego-mode neighborhood views, N×N distance heatmaps, and distance band classification.
- </Card>
- <Card title="REST API" icon="code">
- 15+ endpoints for graph data, path finding, embeddings, semantic search, analytics, and export — fully documented at `/docs`.
- </Card>
- <Card title="WebSocket Progress" icon="bolt">
- Long-running exports and analyses stream progress events in real time — no polling required.
- </Card>
- <Card title="CLI Launcher" icon="terminal">
- `semantica-explorer --graph my_graph.json` for instant local startup without writing any Python.
- </Card>
-</CardGroup>
-
-## Installation
+```python
+# 1. Export your graph to a JSON file
+import json
+from semantica.context import ContextGraph
+
+graph = ContextGraph()
+graph.add_node("Python", "language", properties={"paradigm": "multi-paradigm"})
+graph.add_node("FastAPI", "framework", properties={"language": "Python"})
+graph.add_edge("Python", "FastAPI", "enables")
+graph.save_to_file("my_graph.json")
+```
```bash
-pip install "semantica[explorer]"
+# 2. Launch the Explorer
+semantica-explorer --graph my_graph.json
+# → Loading graph...
+# → Graph loaded — 2 nodes, 1 edges
+# → Semantica Explorer · http://127.0.0.1:8000
+# API docs http://127.0.0.1:8000/docs
+# Health http://127.0.0.1:8000/api/health
```
-Requires `uvicorn` and `fastapi`. Included automatically with `pip install semantica[all]`.
+The browser opens automatically at `http://127.0.0.1:8000`. The interactive API docs are at `/docs`.
+
+<Tip>
+ `semantica.explorer` is a **server process**, not an importable Python library. Use the CLI or `python -m semantica.explorer` to launch. The `app.py` module exposes a module-level `app` instance for use with uvicorn or Docker.
+</Tip>
## Launch
<Steps>
<Step title="Save your graph and launch Explorer">
```python
- import json
- from semantica.kg import GraphBuilder
-
- kg = GraphBuilder().build(entities=entities, relationships=relationships)
+ from semantica.context import ContextGraph
- # Export graph to JSON file
- with open("my_graph.json", "w") as f:
- json.dump({"entities": kg.entities, "relationships": kg.relationships}, f)
+ graph = ContextGraph()
+ graph.load_from_file("my_graph.json") # verify graph loads
```
```bash
semantica-explorer --graph my_graph.json
- # → Serving at http://127.0.0.1:8000
+ # Serves at http://127.0.0.1:8000
```
</Step>
<Step title="Custom host and port">
```bash
+ # Expose on the network
semantica-explorer --graph my_graph.json --host 0.0.0.0 --port 8080
# Skip auto-opening the browser
semantica-explorer --graph my_graph.json --no-browser
```
</Step>
- <Step title="Switch graphs without restarting">
+ <Step title="Import new data without restarting">
```bash
+ # Import a JSON or CSV file into the running session
curl -X POST http://localhost:8000/api/import \
- -H "Content-Type: multipart/form-data" \
-F "file=@updated_graph.json"
- # Browser dashboard reloads automatically
+ ```
+ </Step>
+ <Step title="Use via Python module">
+ ```bash
+ python -m semantica.explorer --graph my_graph.json --port 8080
```
</Step>
</Steps>
## CLI Reference
-| Flag | Default | Description |
-| ---- | ------- | ----------- |
-| `--graph`, `-g` | *(required)* | Path to a saved graph JSON file |
-| `--port`, `-p` | `8000` | Port to bind the server |
-| `--host` | `127.0.0.1` | Host to bind the server |
-| `--no-browser` | `false` | Skip auto-opening the browser |
-| `--enable-auth` | `false` | Require `X-API-Key` header on all requests |
-| `--api-key` | `None` | API key value when `--enable-auth` is set |
-| `--cors-origins` | `"*"` | Comma-separated list of allowed CORS origins |
-| `--log-level` | `"info"` | Uvicorn log level |
+The `semantica-explorer` command accepts exactly four flags:
+
+| Flag | Short | Default | Description |
+| ---- | ----- | ------- | ----------- |
+| `--graph` | `-g` | *(required)* | Path to a ContextGraph JSON file to load |
+| `--port` | `-p` | `8000` | Port to bind the server |
+| `--host` | — | `127.0.0.1` | Host to bind the server — use `0.0.0.0` to expose on the network |
+| `--no-browser` | — | off | Skip auto-opening the browser tab |
+
+<Note>
+ There are no flags for authentication, CORS, or log level in the CLI. CORS allowed origins are configured via the `EXPLORER_CORS_ORIGINS` environment variable (comma-separated, default: `http://localhost:5173,http://127.0.0.1:5173`).
+</Note>
+
+```bash
+# Full example
+EXPLORER_CORS_ORIGINS="http://myapp.example.com" \
+ semantica-explorer --graph my_graph.json --host 0.0.0.0 --port 8080 --no-browser
+```
+
+## What You Get
+
+<CardGroup cols={2}>
+ <Card title="Graph Explorer" icon="diagram-project">
+ Interactive node/edge search, path finding, and neighborhood expansion. Indexed search at 0.004ms on 118k-node graphs.
+ </Card>
+ <Card title="Ontology Hub" icon="sitemap">
+ SKOS vocabulary management, SHACL shape generation and validation, ontology alignment, health dashboard, and versioning.
+ </Card>
+ <Card title="Analytics" icon="chart-line">
+ Degree centrality, community detection, connectivity analysis, graph validation, and distance matrices.
+ </Card>
+ <Card title="REST API" icon="code">
+ All features available as a REST API — fully documented at `/docs`.
+ </Card>
+ <Card title="WebSocket Updates" icon="bolt">
+ Real-time graph mutation events streamed over WebSocket at `/ws/graph-updates`.
+ </Card>
+ <Card title="CLI Launcher" icon="terminal">
+ `semantica-explorer --graph my_graph.json` for instant local startup.
+ </Card>
+</CardGroup>
## Features
@@ -120,155 +131,219 @@ Requires `uvicorn` and `fastapi`. Included automatically with `pip install seman
<Tab title="Graph Explorer">
Core dashboard for navigating knowledge graphs:
- - **Indexed search** — find any node by label or type; 0.004ms on 118k-node graphs (v0.5.0)
- - **Bidirectional path finding** — trace paths between any two nodes
- - **Neighbor expansion** — click any node to expand its connections
- - **Filter by entity type** — focus on Person, Organization, Event, or any custom type
- - **Edge label display** — relationship types shown on all edges
- - **Graph declutter** — workspace layout controls for dense graphs
+ - **Indexed search** — POST to `/api/graph/search` with a query; 0.004ms on 118k-node graphs
+ - **Path finding** — BFS or Dijkstra between any two nodes via `GET /api/graph/path?source=&target=`
+ - **Neighbor expansion** — `GET /api/graph/node/{id}/neighbors?depth=2`
+ - **Filter by entity type** — `GET /api/graph/nodes?type=Person`
+ - **Semantic neighborhood** — `GET /api/graph/semantic-neighborhood?node_id=&top_k=20`
+ - **Distance matrix** — `POST /api/graph/distance-matrix`
</Tab>
- <Tab title="Ontology Hub (v0.5.0)">
- Full ontology lifecycle management in the browser:
-
- - **Visual ontology editor** — drag-and-drop class and property authoring
- - **SHACL Studio** — create, validate, and test SHACL shapes with live feedback
- - **Alignment authoring** — author ontology alignments across schemas
- - **Health dashboard** — graph quality metrics, validation status, coverage reports
- - **Version control** — snapshot, diff, and restore ontology versions
+ <Tab title="Ontology Hub">
+ Ontology lifecycle management in the browser:
+
+ - **Registry** — `GET /api/ontology/registry` — list loaded ontologies
+ - **SKOS vocabularies** — `GET /api/ontology/skos/schemes`, `GET /api/ontology/skos/concept/{uri}`
+ - **SHACL** — `POST /api/ontology/shacl/generate`, `POST /api/ontology/shacl/validate`
+ - **Alignments** — `GET/POST /api/ontology/alignments`, `POST /api/ontology/suggest-alignments`
+ - **Proposals & versioning** — `POST /api/ontology/propose`, `GET /api/ontology/versions/{uri}`
+ - **Health** — `GET /api/ontology/health`
</Tab>
- <Tab title="Distance Intelligence (v0.5.0)">
- Semantic neighborhood analysis centered on any node:
-
- - **N×N distance matrices** — pairwise semantic distances across a set of nodes
- - **Ego-mode visualization** — focus on a single node's semantic neighborhood
- - **Distance band classification** — nodes grouped as `near` / `mid` / `far`
- - **Embedding cache** — optimized embedding reuse for large graphs
+ <Tab title="Analytics">
+ Graph metrics running against the loaded graph:
+
+ - **Combined metrics** — `GET /api/analytics?metrics=centrality,community,connectivity`
+ - **Graph validation** — `GET /api/analytics/validation`
+ - **Enrich: link prediction** — `POST /api/enrich/links`
+ - **Enrich: deduplication** — `POST /api/enrich/dedup`
+ - **Enrich: entity extraction** — `POST /api/enrich/extract`
+ - **Temporal** — `GET /api/temporal/snapshot`, `GET /api/temporal/diff`, `GET /api/temporal/bounds`
</Tab>
- <Tab title="Session Management">
- Thread-safe sessions with rollback protection:
-
- - Sessions are per connected browser tab
- - Write operations (annotate, import) roll back automatically on failure
- - All writes appended to audit trail at `/api/provenance/audit`
- - Session state held in memory — use `/api/export/json` to persist between restarts
+ <Tab title="Decisions & Provenance">
+ Decision tracking and provenance queries:
+
+ - **Decisions** — `GET /api/decisions`, `GET /api/decisions/{id}`, `GET /api/decisions/{id}/chain`
+ - **Precedents** — `GET /api/decisions/{id}/precedents`
+ - **Causal distance** — `GET /api/decisions/causal-distance?source=&target=`
+ - **Compliance** — `GET /api/decisions/{id}/compliance`
+ - **Provenance** — `GET /api/provenance?node_id=`, `GET /api/provenance/report?node_id=`
+ - **Annotations** — `GET/POST /api/annotations`, `DELETE /api/annotations/{id}`
</Tab>
</Tabs>
## API Endpoints
-Full interactive docs at `http://localhost:8000/docs`. All endpoints available via REST.
+Full interactive docs at `http://localhost:8000/docs`. All endpoints accept and return JSON.
<AccordionGroup>
<Accordion title="Graph endpoints">
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/graph/summary` | `GET` | Node count, edge count, entity type distribution |
- | `/api/graph/search` | `GET` | Indexed full-text and type-filtered node search |
+ | `/api/graph/stats` | `GET` | Node count, edge count, entity type distribution |
+ | `/api/graph/nodes` | `GET` | List nodes — `?type=&search=&skip=&limit=&cursor=&bbox=` |
| `/api/graph/node/{id}` | `GET` | Fetch a single node with all properties |
- | `/api/graph/neighbors` | `GET` | Neighbors of a node — `?node_id=&depth=2` |
- | `/api/graph/path` | `GET` | Bidirectional shortest path — `?source=&target=` |
- | `/api/graph/subgraph` | `POST` | Extract a subgraph by node IDs or type filter |
- | `/api/graph/annotate` | `POST` | Add a user annotation to a node or edge |
- | `/api/graph/annotations` | `GET` | List all annotations on the graph |
+ | `/api/graph/node/{id}/neighbors` | `GET` | Neighbors of a node — `?depth=1` (1–5) |
+ | `/api/graph/edges` | `GET` | List edges — `?type=&source=&target=&skip=&limit=&cursor=` |
+ | `/api/graph/path` | `GET` | Shortest path — `?source=&target=&algorithm=bfs&directed=true` |
+ | `/api/graph/search` | `POST` | Indexed search — body: `{query, limit, filters, anchor_node}` |
+ | `/api/graph/distance-matrix` | `POST` | Pairwise distances — body: `{node_ids, metric}` (max 50 nodes) |
+ | `/api/graph/semantic-neighborhood` | `GET` | Semantic neighbors — `?node_id=&top_k=20&min_similarity=0.0` |
</Accordion>
- <Accordion title="Ontology endpoints">
+ <Accordion title="Analytics, Enrich & Temporal">
+
+ **Analytics:**
+
+ | Endpoint | Method | Description |
+ | -------- | ------ | ----------- |
+ | `/api/analytics` | `GET` | Graph metrics — `?metrics=centrality,community,connectivity` |
+ | `/api/analytics/validation` | `GET` | Graph validation report |
+
+ **Enrich:**
+
+ | Endpoint | Method | Description |
+ | -------- | ------ | ----------- |
+ | `/api/enrich/extract` | `POST` | Entity extraction from text |
+ | `/api/enrich/links` | `POST` | Link prediction for nodes |
+ | `/api/enrich/dedup` | `POST` | Duplicate detection |
+ | `/api/enrich/merge` | `POST` | Merge duplicate nodes |
+ | `/api/reason` | `POST` | Run reasoning over graph |
+
+ **Temporal:**
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/ontology/classes` | `GET` | List all ontology classes and properties |
- | `/api/ontology/validate` | `POST` | Run SHACL validation; returns violations |
- | `/api/ontology/hierarchy` | `GET` | Class hierarchy as a tree structure |
- | `/api/ontology/vocabulary` | `GET` | SKOS vocabulary terms and alt labels |
- | `/api/ontology/align` | `POST` | Submit two ontologies for alignment |
- | `/api/ontology/diff` | `POST` | Diff two ontology versions |
+ | `/api/temporal/snapshot` | `GET` | Graph snapshot at `?at=ISO8601` (defaults to now) |
+ | `/api/temporal/diff` | `GET` | Diff between two times — `?from_time=&to_time=` |
+ | `/api/temporal/patterns` | `GET` | Temporal activity patterns |
+ | `/api/temporal/bounds` | `GET` | Earliest and latest temporal bounds in graph |
+ | `/api/temporal/distance-history` | `GET` | Distance history — `?source=&target=` |
</Accordion>
- <Accordion title="Provenance, Decisions & Analytics">
+ <Accordion title="Ontology, Vocabulary & SPARQL">
- **Provenance:**
+ **Ontology:**
+
+ | Endpoint | Method | Description |
+ | -------- | ------ | ----------- |
+ | `/api/ontology/registry` | `GET` | List loaded ontologies |
+ | `/api/ontology/load` | `POST` | Load an ontology from URL or content |
+ | `/api/ontology/create` | `POST` | Create a new ontology |
+ | `/api/ontology/search` | `GET` | Search ontology entities — `?q=term` |
+ | `/api/ontology/health` | `GET` | Ontology health and coverage metrics |
+ | `/api/ontology/alignments` | `GET/POST` | List or create ontology alignments |
+ | `/api/ontology/suggest-alignments` | `POST` | AI-suggested alignments |
+ | `/api/ontology/shacl/generate` | `POST` | Generate SHACL shapes |
+ | `/api/ontology/shacl/validate` | `POST` | Validate RDF against SHACL |
+ | `/api/ontology/skos/schemes` | `GET` | List SKOS concept schemes |
+ | `/api/ontology/skos/concept/{uri}` | `GET` | Get a SKOS concept |
+ | `/api/ontology/proposals` | `GET/POST` | Manage ontology change proposals |
+ | `/api/ontology/versions/{uri}` | `GET` | Version history |
+
+ **Vocabulary:**
+
+ | Endpoint | Method | Description |
+ | -------- | ------ | ----------- |
+ | `/api/vocabulary/schemes` | `GET` | SKOS schemes via TripletStore |
+ | `/api/vocabulary/concepts` | `GET` | Concepts in a scheme — `?scheme=URI` |
+ | `/api/vocabulary/hierarchy` | `GET` | Concept hierarchy tree |
+ | `/api/vocabulary/import` | `POST` | Import SKOS/RDF vocabulary file |
+
+ **SPARQL:**
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/provenance/entity/{id}` | `GET` | Full provenance lineage for an entity |
- | `/api/provenance/source/{id}` | `GET` | All entities sourced from a document |
- | `/api/provenance/audit` | `GET` | Full audit trail of Explorer operations |
+ | `/api/sparql` | `POST` | Execute a SPARQL SELECT or ASK query |
+
+ </Accordion>
+ <Accordion title="Decisions, Provenance, Annotations & Export">
**Decisions:**
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/decisions/list` | `GET` | Paginated list of recorded decisions |
- | `/api/decisions/{id}` | `GET` | Single decision with causal chain |
- | `/api/decisions/search` | `GET` | Precedent search — `?query=&limit=5` |
- | `/api/decisions/influence/{id}` | `GET` | Downstream influence of a decision |
+ | `/api/decisions` | `GET` | Paginated list of recorded decisions |
+ | `/api/decisions/{id}` | `GET` | Single decision details |
+ | `/api/decisions/{id}/chain` | `GET` | Causal chain for a decision |
+ | `/api/decisions/{id}/precedents` | `GET` | Similar past decisions |
+ | `/api/decisions/{id}/compliance` | `GET` | Policy compliance check |
+ | `/api/decisions/causal-distance` | `GET` | Causal distance — `?source=&target=` |
- **Analytics:**
+ **Provenance:**
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/analytics/centrality` | `GET` | Degree, betweenness, PageRank scores |
- | `/api/analytics/communities` | `GET` | Community detection result |
- | `/api/analytics/distance` | `POST` | N×N distance matrix for a node list |
- | `/api/analytics/neighborhood` | `GET` | Semantic neighborhood — `?node=&radius=0.4` |
+ | `/api/provenance` | `GET` | Entity provenance lineage — `?node_id=` |
+ | `/api/provenance/report` | `GET` | Provenance export report — `?node_id=` |
- </Accordion>
- <Accordion title="SPARQL, Temporal & Export">
+ **Annotations:**
+
+ | Endpoint | Method | Description |
+ | -------- | ------ | ----------- |
+ | `/api/annotations` | `GET` | List annotations — `?node_id=` (optional) |
+ | `/api/annotations` | `POST` | Create annotation (returns 201) |
+ | `/api/annotations/{id}` | `DELETE` | Delete annotation (returns 204) |
- **SPARQL & Temporal:**
+ **Export / Import:**
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/sparql` | `POST` | Execute a SPARQL SELECT query |
- | `/api/temporal/snapshot` | `GET` | Graph snapshot at a point in time — `?at=ISO8601` |
- | `/api/temporal/range` | `GET` | Nodes/edges active in a time range |
- | `/api/temporal/diff` | `POST` | Diff two temporal snapshots |
+ | `/api/export` | `POST` | Export graph as JSON or CSV — body: `{format, node_ids}` |
+ | `/api/export/distance-enriched` | `POST` | Export pairwise distances as CSV or JSONL |
+ | `/api/import` | `POST` | Import nodes/edges from `.json` or `.csv` file (max 50 MB) |
- **Export & Import:**
+ </Accordion>
+ <Accordion title="Health & Info">
| Endpoint | Method | Description |
| -------- | ------ | ----------- |
- | `/api/export/{format}` | `GET` | Export in: `turtle`, `json-ld`, `ntriples`, `rdf-xml`, `parquet`, `aql`, `csv`, `owl`, `arrow`, `lpg`, `yaml`, `distance-matrix` |
- | `/api/import` | `POST` | Import a graph from file (replaces current graph in session) |
+ | `/api/health` | `GET` | Returns `{"status": "healthy"}` |
+ | `/api/info` | `GET` | Server name, version, status |
+ | `/docs` | `GET` | Interactive Swagger UI — all endpoints |
</Accordion>
</AccordionGroup>
-## WebSocket Progress
+## WebSocket Graph Updates
-Long-running operations stream progress events over WebSocket at `ws://localhost:8000/ws/progress`:
+Real-time graph mutation events are streamed over WebSocket at `ws://localhost:8000/ws/graph-updates`:
```python
-import asyncio, websockets, json
+import asyncio
+import json
+import websockets
+
+async def watch_updates():
+ async with websockets.connect("ws://localhost:8000/ws/graph-updates") as ws:
+ # Server sends an ack on connect
+ ack = json.loads(await ws.recv())
+ print("Connected:", ack)
+
+ # Send a ping to verify the connection is alive
+ await ws.send("ping")
-async def watch_progress():
- async with websockets.connect("ws://localhost:8000/ws/progress") as ws:
async for message in ws:
event = json.loads(message)
- print(f"[{event['operation']}] {event['step']} — {event['progress_pct']:.0f}%")
- if event["status"] in ("completed", "failed"):
- break
+ print("[{}] {}".format(event["event"], event.get("data")))
-asyncio.run(watch_progress())
+asyncio.run(watch_updates())
```
-WebSocket event schema:
+WebSocket message schema:
```json
{
- "operation": "export",
- "step": "serializing nodes",
- "current": 3500,
- "total": 10000,
- "progress_pct": 35.0,
- "status": "running",
- "message": "Serializing 10000 nodes to Turtle...",
- "error": null
+ "event": "graph_mutation",
+ "data": {
+ "event_type": "ADD_NODE",
+ "entity_id": "node_123",
+ "payload": {}
+ },
+ "timestamp": "2024-01-15T10:30:00+00:00"
}
```
-`status` values: `"running"` | `"completed"` | `"failed"` | `"cancelled"`
+Event types broadcast over the WebSocket include: `connection_ack`, `pong`, and `graph_mutation` (fired when nodes or edges are added/updated/removed via import or enrichment). Send the text `"ping"` to receive a `pong` response.
## Performance
@@ -276,36 +351,60 @@ WebSocket event schema:
| -------- | ------- |
| Node search (118k nodes, indexed) | 0.004ms |
| Neighbor expansion (depth 2) | < 5ms |
-| Bidirectional path (118k nodes) | < 50ms |
+| BFS path (118k nodes) | < 50ms |
| SPARQL SELECT (simple pattern) | < 20ms |
-| N×N distance matrix (100 nodes) | ~2s (with embedding cache) |
+| Distance matrix (50 nodes, semantic) | ~2s (with embedding cache) |
The node search index is built on startup. For graphs > 500k nodes, allow extra startup time before connecting.
-## Tips and Common Pitfalls
+Distance matrix is capped at 50 node pairs per request. Semantic distance requires nodes to have embeddings stored in their properties.
-<Warning>
- **Filter large graphs before saving to JSON.** The CLI loads the entire JSON file into memory. For graphs > 10k nodes, filter to the relevant subgraph (e.g., by entity type) before exporting to JSON — Explorer's force-directed layout becomes unusable on very large graphs.
-</Warning>
+## Troubleshooting
+
+**Browser tab does not open**
+The browser is launched 1.5 seconds after the server starts. Use `--no-browser` and open `http://127.0.0.1:8000` manually if the auto-open fails.
+
+**`Error: graph file not found`**
+The `--graph` path must be an existing file. Check the path and ensure the file exists before launching.
+
+**`Error: uvicorn is required`**
+Install the explorer extras: `pip install "semantica[explorer]"`.
+
+**`Connection refused` on API calls**
+The server only binds to `127.0.0.1` by default. To access Explorer from another machine or container, launch with `--host 0.0.0.0`.
+
+**Empty graph after import**
+The import endpoint (`/api/import`) only parses `.json` and `.csv` files. Other formats return HTTP 422. JSON files must contain a top-level `entities`/`nodes` array or `relationships`/`edges` array.
+
+**`PathFinder not available` error from `/api/graph/path`**
+Path finding requires the `semantica[kg]` extras. Install with `pip install "semantica[all]"`.
+
+**Semantic neighborhood returns 503**
+Semantic neighborhood requires node embeddings stored in node properties (keys `embedding`, `vector`, or `node2vec_embedding`). Graphs without embeddings return 503.
+
+**Session state lost after restart**
+Session state is in-memory only. Use `POST /api/export` to save a JSON snapshot before shutting down.
+
+## Tips and Common Pitfalls
<Warning>
- **Use authentication in shared environments.** Pass `enable_auth=True, api_key="..."` whenever Explorer is accessible to more than one person. Without auth, anyone who can reach the port can write to the graph via the annotate and import endpoints.
+ **Filter large graphs before saving to JSON.** The CLI loads the entire JSON file into memory. For graphs > 10k nodes, filter to the relevant subgraph before exporting — the force-directed layout becomes unusable on very large graphs.
</Warning>
<Warning>
- **Export before the session ends.** Session state lives in memory and is lost on server restart. Call `/api/export/json` or `/api/export/turtle` to persist the current state before shutting down. Explorer does not auto-save.
+ **Session state is lost on server restart.** There is no auto-save. Call `POST /api/export` with body `{"format": "json"}` to download the current state before shutting down.
</Warning>
<Tip>
- **Use WebSocket progress for long operations.** Export, analysis, and large SPARQL queries stream progress to `ws://localhost:8000/ws/progress`. Polling the REST endpoints instead gives no progress signal — use the WebSocket client so users see incremental updates.
+ **Use the REST API for automation, Explorer UI for exploration.** Explorer's REST endpoints are a stable programmatic API — pipe them into scripts to automate batch annotation, SPARQL querying, or exports.
</Tip>
<Tip>
- **Pass `session_timeout` for demos and shared notebooks.** The default session never expires. In Jupyter or shared environments, set `session_timeout=1800` (30 minutes) so stale sessions don't hold large graphs in memory.
+ **CORS origins are configured via environment variable.** Set `EXPLORER_CORS_ORIGINS` to a comma-separated list of allowed origins before launching (e.g. `EXPLORER_CORS_ORIGINS="http://myapp.example.com"`).
</Tip>
<Tip>
- **Use the REST API for automation, Explorer UI for exploration.** Explorer's REST endpoints are a stable programmatic API — pipe them into scripts to automate batch annotation, SPARQL querying, or exports. The browser UI is for interactive exploration and sharing; they use the same server.
+ **Use `/api/analytics/validation` to check graph quality.** The validator detects orphaned nodes, missing types, and other structural issues before you expose the graph to downstream pipelines.
</Tip>
<CardGroup cols={2}>
@@ -319,6 +418,6 @@ The node search index is built on startup. For graphs > 500k nodes, allow extra
Programmatic graph rendering without the Explorer server.
</Card>
<Card title="Export" icon="file-export" href="export">
- Export to RDF, Parquet, AQL without launching a server.
+ Export to RDF, Parquet, and other formats without launching a server.
</Card>
</CardGroup>