# kodymoodley/relfinder architecture

> Architecture diagram of the GitHub repository kodymoodley/relfinder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kodymoodley/relfinder
- Repository: https://github.com/kodymoodley/relfinder

## Overview

#### 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: [`relfinder/src/lib/sparql/engine.ts`](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/engine.ts) (SPARQL engine), [`relfinder/src/lib/sparql/graphBuilder.ts`](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/graphBuilder.ts) (Path & subgraph builder), [`relfinder/src/lib/search/coldStartBootstrap.ts`](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/search/coldStartBootstrap.ts) (Client search index), [`relfinder/src/router/index.ts`](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/router/index.ts) (View router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_spa["Vue SPA"]
  node_main["Application bootstrap<br/>Vue entry<br/>[main.ts]"]
  node_app["App shell<br/>Vue root<br/>[App.vue]"]
  node_router["View router<br/>Vue router<br/>[index.ts]"]
  node_connection_view["Connection setup<br/>Vue view<br/>[ConnectionView.vue]"]
  node_graph_view["Relationship workflow<br/>Vue view<br/>[GraphView.vue]"]
  node_ui_state["Navigation & pins<br/>Pinia stores<br/>[navigation.ts]"]
  node_connection_state["Connection state<br/>Pinia store<br/>[connection.ts]"]
  node_graph_canvas["Interactive graph<br/>Cytoscape view<br/>[GraphCanvas.vue]"]
end

subgraph group_rdf["RDF access & graph"]
  node_sparql_engine["SPARQL engine<br/>query runtime<br/>[engine.ts]"]
  node_query_builder["Query builder<br/>SPARQL builder<br/>[queryBuilder.ts]"]
  node_rdf_parser["Local RDF parser<br/>[parser.ts]"]
  node_graph_builder["Path & subgraph builder<br/>graph logic<br/>[graphBuilder.ts]"]
  node_entity_search["Entity lookup<br/>SPARQL search<br/>[entitySearch.ts]"]
end

subgraph group_search["Search & persistence"]
  node_search_bootstrap["Client search index<br/>search bootstrap"]
  node_search_worker["Search index worker<br/>Web Worker"]
  node_query_cache[("Query cache<br/>browser storage<br/>[queryCache.ts]")]
  node_graph_storage[("Graph storage<br/>browser storage<br/>[graphStorage.ts]")]
end

subgraph group_schema["Schema exploration"]
  node_schema_pipeline["Schema extraction & state<br/>schema pipeline<br/>[schemaExtractor.ts]"]
  node_schema_canvas["Schema browser<br/>Vue canvas<br/>[SchemaCanvas.vue]"]
end

subgraph group_deploy["Deployment"]
  node_sparql_proxy["CORS SPARQL proxy<br/>Caddy proxy"]
  node_compose["Container deployment<br/>Docker Compose<br/>[docker-compose.yml]"]
end

node_main -->|"mounts"| node_app
node_app -->|"uses"| node_router
node_router -->|"routes to"| node_connection_view
node_router -->|"routes to"| node_graph_view
node_connection_view -->|"configures"| node_connection_state
node_connection_view -->|"loads local RDF"| node_rdf_parser
node_connection_state -->|"supplies source settings"| node_sparql_engine
node_graph_view -->|"finds entities"| node_entity_search
node_graph_view -->|"requests paths"| node_graph_builder
node_entity_search -->|"queries"| node_sparql_engine
node_graph_builder -->|"builds traversal queries"| node_query_builder
node_query_builder -->|"executes through"| node_sparql_engine
node_graph_builder -->|"emits graph"| node_graph_canvas
node_search_bootstrap -->|"indexes in"| node_search_worker
node_search_bootstrap -->|"supports discovery"| node_entity_search
node_search_bootstrap -->|"uses"| node_query_cache
node_graph_builder -->|"persists results"| node_graph_storage
node_sparql_engine -->|"supplies schema data"| node_schema_pipeline
node_schema_pipeline -->|"renders through"| node_schema_canvas
node_compose -->|"provisions"| node_sparql_proxy
node_sparql_engine -.->|"uses when CORS blocked"| node_sparql_proxy

click node_main "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/main.ts"
click node_app "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/App.vue"
click node_router "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/router/index.ts"
click node_connection_view "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/views/ConnectionView.vue"
click node_graph_view "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/views/GraphView.vue"
click node_ui_state "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/stores/navigation.ts"
click node_connection_state "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/stores/connection.ts"
click node_sparql_engine "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/engine.ts"
click node_query_builder "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/queryBuilder.ts"
click node_rdf_parser "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/rdf/parser.ts"
click node_graph_builder "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/graphBuilder.ts"
click node_entity_search "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/entitySearch.ts"
click node_graph_canvas "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/components/graph/GraphCanvas.vue"
click node_search_bootstrap "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/search/coldStartBootstrap.ts"
click node_search_worker "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/workers/searchIndex.worker.ts"
click node_query_cache "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/cache/queryCache.ts"
click node_graph_storage "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/cache/graphStorage.ts"
click node_schema_pipeline "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/schemaExtractor.ts"
click node_schema_canvas "https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/components/schema/SchemaCanvas.vue"
click node_sparql_proxy "https://github.com/kodymoodley/relfinder/tree/main/proxy/Caddyfile"
click node_compose "https://github.com/kodymoodley/relfinder/blob/main/docker-compose.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_router,node_connection_view,node_graph_view,node_ui_state,node_connection_state,node_graph_canvas toneBlue
class node_sparql_engine,node_query_builder,node_rdf_parser,node_graph_builder,node_entity_search toneAmber
class node_search_bootstrap,node_search_worker,node_query_cache,node_graph_storage toneMint
class node_schema_pipeline,node_schema_canvas toneRose
class node_sparql_proxy,node_compose toneIndigo
```

## Components

### Vue SPA

- [Application bootstrap](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/main.ts): Vue entry · `relfinder/src/main.ts`
- [App shell](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/App.vue): Vue root · `relfinder/src/App.vue`
- [View router](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/router/index.ts): Vue router · `relfinder/src/router/index.ts`
- [Connection setup](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/views/ConnectionView.vue): Vue view · `relfinder/src/views/ConnectionView.vue`
- [Relationship workflow](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/views/GraphView.vue): Vue view · `relfinder/src/views/GraphView.vue`
- [Navigation & pins](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/stores/navigation.ts): Pinia stores · Keeps UI navigation and pinned entities separate from source access. · `relfinder/src/stores/navigation.ts`
- [Connection state](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/stores/connection.ts): Pinia store · `relfinder/src/stores/connection.ts`
- [Interactive graph](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/components/graph/GraphCanvas.vue): Cytoscape view · Renders paths with Cytoscape.js and D3-force. · `relfinder/src/components/graph/GraphCanvas.vue`

### RDF access & graph

- [SPARQL engine](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/engine.ts): query runtime · `relfinder/src/lib/sparql/engine.ts`
- [Query builder](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/queryBuilder.ts): SPARQL builder · `relfinder/src/lib/sparql/queryBuilder.ts`
- [Local RDF parser](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/rdf/parser.ts): RDF parser · Converts uploads into the same RDF-compatible source model. · `relfinder/src/lib/rdf/parser.ts`
- [Path & subgraph builder](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/graphBuilder.ts): graph logic · Applies depth, predicate, class, language, and cycle constraints. · `relfinder/src/lib/sparql/graphBuilder.ts`
- [Entity lookup](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/entitySearch.ts): SPARQL search · `relfinder/src/lib/sparql/entitySearch.ts`

### Search & persistence

- [Client search index](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/search/coldStartBootstrap.ts): search bootstrap · Builds layered autocomplete and entity discovery over cache and worker indexing. · `relfinder/src/lib/search/coldStartBootstrap.ts`
- [Search index worker](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/workers/searchIndex.worker.ts): Web Worker · `relfinder/src/workers/searchIndex.worker.ts`
- [Query cache](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/cache/queryCache.ts): browser storage · `relfinder/src/lib/cache/queryCache.ts`
- [Graph storage](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/cache/graphStorage.ts): browser storage · `relfinder/src/lib/cache/graphStorage.ts`

### Schema exploration

- [Schema extraction & state](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/lib/sparql/schemaExtractor.ts): schema pipeline · Extracts schema data and maintains independent schema browsing state. · `relfinder/src/lib/sparql/schemaExtractor.ts`
- [Schema browser](https://github.com/kodymoodley/relfinder/blob/main/relfinder/src/components/schema/SchemaCanvas.vue): Vue canvas · `relfinder/src/components/schema/SchemaCanvas.vue`

### Deployment

- [CORS SPARQL proxy](https://github.com/kodymoodley/relfinder/tree/main/proxy/Caddyfile): Caddy proxy · Docker-provisioned fallback for endpoints blocked by CORS. · `proxy/Caddyfile`
- [Container deployment](https://github.com/kodymoodley/relfinder/blob/main/docker-compose.yml): Docker Compose · Provisions frontend and CORS proxy. · `docker-compose.yml`

## Connections

- 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
