# texttechnologylab/uce architecture

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

- Interactive diagram: https://gitdiagram.com/texttechnologylab/uce
- Repository: https://github.com/texttechnologylab/uce

## Overview

UCE is a configurable web explorer for UIMA-annotated corpora. Its main workflow is to import annotated documents, persist structured corpus data, then let users search and explore documents and annotations through the portal; optional services add semantic search and RAG. The README documents the importer-to-database flow and optional services. Some runtime wiring and several README-described capabilities are not shown in the sampled source, so those relationships are marked unverified rather than inferred as direct calls.

Main entry points: [`uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/RAGService.java`](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/RAGService.java) (RAG service), [`uce.portal/uce.corpus-importer/src/main/java/org/texttechnologylab/uce/corpusimporter/Importer.java`](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.corpus-importer/src/main/java/org/texttechnologylab/uce/corpusimporter/Importer.java) (Corpus importer), [`uce.portal/resources/templates/js/search.js`](https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/search.js) (Search interface), [`uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/SearchApi.java`](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/SearchApi.java) (Search API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Corpus ingestion"]
  node_importer["Corpus importer<br/>[Importer.java]"]
  node_database[("PostgreSQL corpus")]
end

subgraph group_portal["Web exploration"]
  node_webapp["Web application<br/>[App.java]"]
  node_searchui["Search interface<br/>[search.js]"]
  node_reader["Document reader<br/>[documentReader.js]"]
  node_visualizations["Corpus visualizations<br/>[graphViz.js]"]
  node_searchapi["Search API<br/>[SearchApi.java]"]
  node_ragui["RAG chat UI<br/>[ragbot.js]"]
end

subgraph group_analysis["Analysis and search"]
  node_layeredsearch["Layered search<br/>[LayeredSearch.java]"]
  node_analysispipe["DUUI analysis<br/>[DUUIPipeline.java]"]
  node_analysismodels["Analysis results<br/>[CohMetrixInfo.java]"]
end

subgraph group_services["Optional services"]
  node_jena["RDF semantic search"]
  node_ragapi["RAG API<br/>[RAGApi.java]"]
  node_ragservice["RAG service<br/>[RAGService.java]"]
  node_ragpython["Python ML service<br/>[webserver.py]"]
end

node_user(("Corpus user"))
node_xmi["UIMA documents"]

node_xmi -->|"imports"| node_importer
node_importer -->|"stores documents"| node_database
node_user -.->|"opens portal"| node_webapp
node_user -.->|"searches corpus"| node_searchui
node_searchui -.->|"submits query"| node_searchapi
node_searchapi -.->|"runs search"| node_layeredsearch
node_layeredsearch -.->|"queries corpus"| node_database
node_user -.->|"reads documents"| node_reader
node_user -.->|"explores corpus"| node_visualizations
node_analysispipe -->|"produces scores"| node_analysismodels
node_jena -.->|"enriches search"| node_database
node_user -.->|"asks questions"| node_ragui
node_ragui -.->|"sends chat"| node_ragapi
node_ragapi -.->|"dispatches chat"| node_ragservice
node_ragservice -.->|"requests model work"| node_ragpython
node_ragservice -.->|"retrieves corpus context"| node_database

click node_importer "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.corpus-importer/src/main/java/org/texttechnologylab/uce/corpusimporter/Importer.java"
click node_webapp "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/App.java"
click node_searchui "https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/search.js"
click node_reader "https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/documentReader.js"
click node_visualizations "https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/graphViz.js"
click node_searchapi "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/SearchApi.java"
click node_layeredsearch "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.search/src/main/java/org/texttechnologylab/uce/search/LayeredSearch.java"
click node_analysispipe "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/DUUIPipeline.java"
click node_analysismodels "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/modules/CohMetrixInfo.java"
click node_jena "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/JenaSparqlService.java"
click node_ragapi "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/RAGApi.java"
click node_ragservice "https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/RAGService.java"
click node_ragpython "https://github.com/texttechnologylab/uce/blob/main/rag/src/webserver.py"
click node_ragui "https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/ragbot.js"

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_importer,node_database,node_user toneBlue
class node_webapp,node_searchui,node_reader,node_visualizations,node_searchapi,node_ragui toneAmber
class node_layeredsearch,node_analysispipe,node_analysismodels toneMint
class node_jena,node_ragapi,node_ragservice,node_ragpython toneRose
class node_xmi toneIndigo
```

## Components

### Corpus ingestion

- [Corpus importer](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.corpus-importer/src/main/java/org/texttechnologylab/uce/corpusimporter/Importer.java): `uce.portal/uce.corpus-importer/src/main/java/org/texttechnologylab/uce/corpusimporter/Importer.java`
- **PostgreSQL corpus**

### Web exploration

- [Web application](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/App.java): `uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/App.java`
- [Search interface](https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/search.js): `uce.portal/resources/templates/js/search.js`
- [Document reader](https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/documentReader.js): `uce.portal/resources/templates/js/documentReader.js`
- [Corpus visualizations](https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/graphViz.js): `uce.portal/resources/templates/js/graphViz.js`
- [Search API](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/SearchApi.java): `uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/SearchApi.java`
- [RAG chat UI](https://github.com/texttechnologylab/uce/blob/main/uce.portal/resources/templates/js/ragbot.js): `uce.portal/resources/templates/js/ragbot.js`

### Analysis and search

- [Layered search](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.search/src/main/java/org/texttechnologylab/uce/search/LayeredSearch.java): `uce.portal/uce.search/src/main/java/org/texttechnologylab/uce/search/LayeredSearch.java`
- [DUUI analysis](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/DUUIPipeline.java): `uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/DUUIPipeline.java`
- [Analysis results](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/modules/CohMetrixInfo.java): `uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/modules/CohMetrixInfo.java`

### Optional services

- [RDF semantic search](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/JenaSparqlService.java): `uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/JenaSparqlService.java`
- [RAG API](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/RAGApi.java): `uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/RAGApi.java`
- [RAG service](https://github.com/texttechnologylab/uce/blob/main/uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/RAGService.java): `uce.portal/uce.common/src/main/java/org/texttechnologylab/uce/common/services/RAGService.java`
- [Python ML service](https://github.com/texttechnologylab/uce/blob/main/rag/src/webserver.py): `rag/src/webserver.py`

### Other components

- **Corpus user**
- **UIMA documents**

## Connections

- UIMA documents → Corpus importer: imports (evidence: `README.md`)
- Corpus importer → PostgreSQL corpus: stores documents (evidence: `README.md`)
- Corpus user → Web application: opens portal
- Corpus user → Search interface: searches corpus
- Search interface → Search API: submits query
- Search API → Layered search: runs search
- Layered search → PostgreSQL corpus: queries corpus
- Corpus user → Document reader: reads documents
- Corpus user → Corpus visualizations: explores corpus
- DUUI analysis → Analysis results: produces scores (evidence: `uce.portal/uce.analysis/src/main/java/org/texttechnologylab/uce/analysis/DUUIPipeline.java`)
- RDF semantic search → PostgreSQL corpus: enriches search
- Corpus user → RAG chat UI: asks questions
- RAG chat UI → RAG API: sends chat
- RAG API → RAG service: dispatches chat (evidence: `uce.portal/uce.web/src/main/java/org/texttechnologylab/uce/web/routes/RAGApi.java`)
- RAG service → Python ML service: requests model work
- RAG service → PostgreSQL corpus: retrieves corpus context
