How kodymoodley/relfinder works
Purpose and runtime
RelFinder is a fully client-side RDF relationship explorer. Users connect to a SPARQL 1.1 endpoint or load RDF locally, select two entities, and inspect discovered connecting paths in an interactive graph. The Vue 3/TypeScript SPA starts at relfinder/src/main.ts, mounts relfinder/src/App.vue, and routes between connection, graph, and browse views through relfinder/src/router/index.ts.
Application workflow and state
Connection setup is owned by relfinder/src/views/ConnectionView.vue and persisted in relfinder/src/stores/connection.ts. It captures endpoint, optional Basic Auth/proxy, or local RDF input. Navigation and user-pinned entities are separate Pinia state domains in relfinder/src/stores/navigation.ts and relfinder/src/stores/pinned.ts, keeping UI flow distinct from data access.
RDF source boundary
Remote graph access is mediated by the SPARQL engine and query layer: relfinder/src/lib/sparql/engine.ts, relfinder/src/lib/sparql/queryBuilder.ts, and relfinder/src/lib/sparql/types.ts. Local uploads are parsed into RDF-compatible data via relfinder/src/lib/rdf/parser.ts, enabling the same search/query concepts across endpoint-backed and file-backed sessions. The development API/proxy integration point is relfinder/api/sparql.ts.
Entity discovery and relationship search
The graph workflow in relfinder/src/views/GraphView.vue accepts two entities and query constraints, then uses entity lookup and path/subgraph logic in relfinder/src/lib/sparql/entitySearch.ts, relfinder/src/lib/sparql/graphBuilder.ts, and relfinder/src/lib/sparql/subgraphStrategy.ts. This stage applies configurable path depth, ignored predicates, class/language filtering, and cycle behavior before emitting graph nodes and edges.
Search performance and client persistence
Autocomplete and broader entity discovery use a layered client-side search subsystem: relfinder/src/lib/search/coldStartBootstrap.ts, relfinder/src/lib/search/entityCache.ts, and relfinder/src/workers/searchIndex.worker.ts. Search strategies, ranking fusion, and eviction are extensible under relfinder/src/lib/search/strategyRegistry.ts, relfinder/src/lib/search/fusion/weightedSum.ts, and relfinder/src/lib/search/eviction/lru.ts. Query, graph, and schema results persist separately in browser storage through relfinder/src/lib/cache/queryCache.ts, relfinder/src/lib/cache/graphStorage.ts, and relfinder/src/lib/cache/schemaStorage.ts.
Visualization and schema exploration
relfinder/src/components/graph/GraphCanvas.vue renders returned paths using Cytoscape.js and D3-force, while GraphToolbar.vue and NodeDetail.vue provide layout, selection, and node inspection controls. Schema extraction and state are isolated in relfinder/src/lib/sparql/schemaExtractor.ts, relfinder/src/stores/schema.ts, and rendered through relfinder/src/components/schema/SchemaCanvas.vue; this supports schema-level browsing independently of an individual relationship result.
Deployment and external infrastructure
The browser communicates with public SPARQL endpoints directly when CORS permits. For blocked endpoints, Docker Compose provisions the frontend plus a Caddy CORS proxy defined by docker-compose.yml, proxy/Caddyfile, and proxy/Dockerfile. The frontend is Vite-built; the repository also supplies a development container image at relfinder/Dockerfile.dev.
Main entry points: engine.ts SPARQL engine · graphBuilder.ts Path & subgraph builder · coldStartBootstrap.ts Client search index · index.ts View router
Components 21
Vue SPA
- Application bootstrap
relfinder/src/main.ts - App shell
relfinder/src/App.vue - View router
relfinder/src/router/index.ts - Connection setup
relfinder/src/views/ConnectionView.vue - Relationship workflow
relfinder/src/views/GraphView.vue - Navigation & pins · Keeps UI navigation and pinned entities separate from source access.
relfinder/src/stores/navigation.ts - Connection state
relfinder/src/stores/connection.ts - Interactive graph · Renders paths with Cytoscape.js and D3-force.
relfinder/src/components/graph/GraphCanvas.vue
RDF access & graph
- SPARQL engine
relfinder/src/lib/sparql/engine.ts - Query builder
relfinder/src/lib/sparql/queryBuilder.ts - Local RDF parser · Converts uploads into the same RDF-compatible source model.
relfinder/src/lib/rdf/parser.ts - Path & subgraph builder · Applies depth, predicate, class, language, and cycle constraints.
relfinder/src/lib/sparql/graphBuilder.ts - Entity lookup
relfinder/src/lib/sparql/entitySearch.ts
Search & persistence
- Client search index · Builds layered autocomplete and entity discovery over cache and worker indexing.
relfinder/src/lib/search/coldStartBootstrap.ts - Search index worker
relfinder/src/workers/searchIndex.worker.ts - Query cache
relfinder/src/lib/cache/queryCache.ts - Graph storage
relfinder/src/lib/cache/graphStorage.ts
Schema exploration
- Schema extraction & state · Extracts schema data and maintains independent schema browsing state.
relfinder/src/lib/sparql/schemaExtractor.ts - Schema browser
relfinder/src/components/schema/SchemaCanvas.vue
Deployment
- CORS SPARQL proxy · Docker-provisioned fallback for endpoints blocked by CORS.
proxy/Caddyfile - Container deployment · Provisions frontend and CORS proxy.
docker-compose.yml
Connections 21
- Application bootstrap → App shell: mounts
- App shell → View router: uses
- View router → Connection setup: routes to
- View router → Relationship workflow: routes to
- Connection setup → Connection state: configures
- Connection setup → Local RDF parser: loads local RDF
- Connection state → SPARQL engine: supplies source settings
- Relationship workflow → Entity lookup: finds entities
- Relationship workflow → Path & subgraph builder: requests paths
- Entity lookup → SPARQL engine: queries
- Path & subgraph builder → Query builder: builds traversal queries
- Query builder → SPARQL engine: executes through
- Path & subgraph builder → Interactive graph: emits graph
- Client search index → Search index worker: indexes in
- Client search index → Entity lookup: supports discovery
- Client search index → Query cache: uses
- Path & subgraph builder → Graph storage: persists results
- SPARQL engine → Schema extraction & state: supplies schema data
- Schema extraction & state → Schema browser: renders through
- Container deployment → CORS SPARQL proxy: provisions
- SPARQL engine → CORS SPARQL proxy: uses when CORS blocked