5badcd8d6f409740add5560e56a65d56bac77e92
Visualizador Instanciados
This repo is a Docker Compose stack for visualizing large RDF/OWL graphs stored in AnzoGraph. It includes:
- A Go backend that queries AnzoGraph via SPARQL and serves a cached graph snapshot + selection queries.
- A React/Vite frontend that renders nodes/edges with WebGL2 and supports “selection query” + “graph query” modes.
- A Python one-shot service to combine
owl:importsinto a single Turtle file. - An AnzoGraph container (SPARQL endpoint).
Quick start (Docker Compose)
- Put your TTL file(s) in
./data/(this folder is volume-mounted into AnzoGraph as/opt/shared-files). - Optionally configure
.env(see.env.example). - Start the stack:
docker compose up --build
Then open the frontend:
http://localhost:5173
Stop everything:
docker compose down
Services
Defined in docker-compose.yml:
anzograph(imagecambridgesemantics/anzograph:latest)- Ports:
8080,8443 - Shared files:
./data → /opt/shared-files
- Ports:
backend(./backend_go)- Port:
8000(API under/api/*) - Talks to AnzoGraph at
SPARQL_HOST/SPARQL_ENDPOINT
- Port:
frontend(./frontend)- Port:
5173 - Proxies
/api/*toVITE_BACKEND_URL
- Port:
owl_imports_combiner(./python_services/owl_imports_combiner)- One-shot: optionally produces a combined TTL by following
owl:imports
- One-shot: optionally produces a combined TTL by following
Service READMEs:
backend_go/README.mdfrontend/README.mdpython_services/owl_imports_combiner/README.mdanzograph/README.md
Repo layout
backend_go/– Go API service (SPARQL → snapshot + selection queries)frontend/– React/Vite WebGL rendererpython_services/owl_imports_combiner/– Python one-shot OWL imports combinerdata/– local shared volume for TTL inputs/outputs (gitignored)docker-compose.yml– service wiringflake.nix– optional Nix dev shell
Configuration
This repo expects a local .env file (not committed). Start from .env.example.
Common knobs:
- Backend snapshot size:
DEFAULT_NODE_LIMIT,DEFAULT_EDGE_LIMIT,MAX_NODE_LIMIT,MAX_EDGE_LIMIT - SPARQL connectivity:
SPARQL_HOSTorSPARQL_ENDPOINT, plusSPARQL_USER/SPARQL_PASS - Load data on backend startup:
SPARQL_LOAD_ON_START=truewithSPARQL_DATA_FILE=file:///opt/shared-files/<file>.ttl - Frontend → backend proxy:
VITE_BACKEND_URL
API (backend)
Base URL: http://localhost:8000
GET /api/health– livenessGET /api/stats– snapshot stats (uses default limits)GET /api/graph– graph snapshot- Query params:
node_limit,edge_limit,graph_query_id
- Query params:
GET /api/graph_queries– available graph snapshot modes (graph_query_idvalues)GET /api/selection_queries– available selection-highlight modes (query_idvalues)POST /api/selection_query– run a selection query for highlighted neighbors- Body:
{"query_id":"neighbors","selected_ids":[...],"node_limit":...,"edge_limit":...,"graph_query_id":"default"}
- Body:
POST /api/sparql– raw SPARQL passthrough (debug/advanced)POST /api/neighbors– legacy alias (same behavior asquery_id="neighbors")
Frontend UI
- Mouse:
- Drag: pan
- Scroll: zoom
- Click: select nodes
- Top-right buttons: “selection query” mode (how neighbors/highlights are computed for the current selection)
- Bottom-right buttons: “graph query” mode (which SPARQL edge set is used to build the graph snapshot; switching reloads the graph)
Notes on performance/limits
- The backend caches snapshots in memory; tune
DEFAULT_*_LIMITif memory is too high. - The frontend renders a sampled subset when zoomed out, and only draws edges when fewer than ~20k nodes are visible.
Nix dev shell (optional)
If you use Nix, flake.nix provides a minimal devShell:
nix develop
Description
Languages
TypeScript
53.9%
Go
40.7%
Python
3.8%
Dockerfile
0.8%
Nix
0.5%
Other
0.3%