Files
semantica/explorer
00ceb09960 fix(ontology): address review blockers from PR #524
Backend:
- Replace false conforms=True SHACL stub with status=unavailable always;
  live validation cannot be wired until OntologyEngine.validate_graph is
  connected to a data graph — a stub that returns conforms=True misleads
  users editing shapes
- Cap node/edge fetches in health, suggest-alignments, and SHACL generation
  at _MAX_ANALYSIS_NODES (5 000) with a logger.warning when the graph
  exceeds the limit; unbounded limit=999_999 fetches cause OOM on large graphs
- Set SHACL health dimension score to 0.0 (was 70.0) when status=unavailable;
  exclude unavailable dimensions from the total_score average so they neither
  inflate nor deflate the result
- Allow alignments to reference external/unloaded URIs (e.g. schema.org)
  without raising 404; label falls back to URI fragment or caller-supplied
  source_label/target_label fields added to OntologyAlignmentRequest
- Fix _alignment_id to use uuid.NAMESPACE_OID instead of NAMESPACE_URL;
  the composite key is not a URL
- Fix _summarize_shapes to normalise \r\n before splitting on .\n so shape
  parsing works correctly on Windows line endings

Frontend:
- Wrap handleSave/handleSuggest/handleRemove/handleAcceptSuggestion in
  useCallback in AlignmentsTab for consistency with sibling components
- Add ephemeral-storage banner in AlignmentsTab warning that alignments are
  session-memory-only and not persisted across restarts
- Fix exportReport in HealthTab to append/remove anchor from document before
  clicking and defer URL.revokeObjectURL to avoid Blob URL leak in some browsers
- Derive health dimension grid column count from health.dimensions.length
  instead of the hardcoded repeat(5, ...) that breaks if the backend adds
  or removes a dimension
- Add minimal Monarch tokenizer for the Monaco turtle language registration
  in ShaclStudio so prefix declarations, IRIs, SHACL properties, comments,
  and string literals are syntax-highlighted; previously the editor rendered
  as plain text despite theme rules being defined

Tests (11 passing, was 5):
- Rename test_shacl_validate_has_stable_contract to
  test_shacl_validate_returns_unavailable and assert status == unavailable
- Add test_shacl_validate_rejects_empty_turtle (expects 422)
- Add test_health_returns_404_for_unknown_ontology
- Add test_health_shacl_dimension_is_zero_when_unavailable with total_score check
- Add test_delete_unknown_alignment_returns_404
- Add test_alignment_upsert_is_idempotent (verifies ID stability and created_at
  preservation across updates)
- Add test_alignment_accepts_external_uri (verifies no 404 for schema.org URIs)
- Relax test_alignment_suggestions_are_ranked label assertions to substring
  checks so the test survives similarity algorithm changes

Co-authored-by: KaifAhmad1 <mohammadk78600@gmail.com>
Co-authored-by: ZohaibHassan16 <zohaib@hawksight.ai>
2026-05-02 15:53:47 +05:30
..

Semantica Knowledge Explorer

A real-time visual interface for exploring knowledge graphs, decision intelligence, entity resolution, ontologies, and graph analytics built on top of the Semantica library.


Requirements

Dependency Minimum Version
Node.js 18.x or higher (20.x recommended)
npm 9.x or higher
Python 3.8+
Semantica backend running on http://127.0.0.1:8000

Check your versions:

node --version
npm --version
python --version

Quick Start (Local Development)

1. Clone the repository

git clone https://github.com/Hawksight-AI/semantica.git
cd semantica

2. Install the Semantica Python package

pip install semantica

Or install from source if you have the repo:

pip install -e .

3. Start the Semantica backend

The Explorer proxies all /api and /ws requests to http://127.0.0.1:8000. The backend must be running before you open the UI.

# From the repo root
python -m semantica.server

The backend starts on port 8000 by default. Keep this terminal open.

4. Install frontend dependencies

Open a second terminal:

cd explorer
npm install

Note: This project uses Vite 5 and requires Node 18+. If you are on Node 16 or earlier, upgrade first.

5. Start the dev server

npm run dev

Vite starts on http://localhost:5173 by default. Open that URL in your browser.


What you should see

The Explorer opens with a persistent left sidebar and six workspace tabs:

Tab What it shows
Knowledge Graph Interactive Sigma.js canvas — nodes, edges, zoom, ForceAtlas2 layout
Timeline Temporal event scrubber over the graph
Decisions Causal chain viewer with outcome badges and decision filter
Registry Live audit log of every graph mutation (add-node, add-edge, etc.)
Entity Resolution Duplicate detection and entity merge workflow
KG Overview Aggregate stats, community breakdown, centrality heatmap
Ontology SKOS/OWL vocabulary hierarchy and schema summary

Project structure

explorer/
├── src/
│   ├── App.tsx                        # Root layout, tab routing, workspace wiring
│   ├── index.css                      # Global resets, fonts, keyframe animations
│   ├── store/
│   │   └── registryStore.ts           # Pub/sub audit registry (no external state lib)
│   └── workspaces/
│       ├── GraphWorkspace/            # Sigma.js graph canvas + inspector panel
│       ├── DecisionWorkspace/         # Causal flow diagram + decision list
│       ├── TimelineWorkspace/         # vis-timeline temporal scrubber
│       ├── ManageWorkspace/           # Registry, KG Overview, Ontology tabs
│       └── EnrichWorkspace/           # Entity resolution tab
├── index.html
├── vite.config.ts                     # Dev proxy → 127.0.0.1:8000, build → ../semantica/static
└── package.json

Available scripts

Run these from inside the explorer/ directory:

# Start the dev server with hot module replacement
npm run dev

# Type-check and build a production bundle into ../semantica/static
npm run build

# Preview the production build locally
npm run preview

# Run ESLint over all source files
npm run lint

# Run the graph store multi-edge unit tests
npm run test:graph-store

API & WebSocket proxy

During development, Vite forwards requests automatically — no CORS configuration needed:

Pattern Forwarded to
/api/* http://127.0.0.1:8000/api/*
/ws ws://127.0.0.1:8000/ws

If you run the backend on a different port, update server.proxy in vite.config.ts.


Production build

cd explorer
npm run build

The compiled assets are written to ../semantica/static/. The Semantica Python server serves this folder automatically at its root URL — no separate web server needed.


Troubleshooting

Blank graph / no data loads

  • Make sure the Semantica backend is running (python -m semantica.server) before opening the UI.
  • Check the browser console for failed /api/graph requests — the proxy target may need updating in vite.config.ts.

npm install fails or hangs

  • Ensure you are using Node 18 or 20. Node 16 and Vite 5 are incompatible.
  • Delete node_modules/ and package-lock.json, then re-run npm install.

Port 5173 already in use

  • Vite will automatically try the next available port and print it in the terminal. Use that URL instead.

WebSocket not connecting (real-time mutations not appearing)

  • Confirm the backend exposes a /ws WebSocket endpoint.
  • Check browser DevTools → Network → WS tab for the connection status.

Tech stack

  • React 19 + TypeScript (strict noUnusedLocals)
  • Vite 5 with babel-plugin-react-compiler
  • Sigma.js 3 + Graphology — graph rendering and in-memory graph store
  • ForceAtlas2 — physics-based layout worker
  • @tanstack/react-query — data fetching for ontology and vocab tabs
  • vis-timeline — temporal event visualization
  • lucide-react — icon set

Contributing

See the root CONTRIBUTING.md and open issues on the main Semantica repository.