A web application for viewing and exploring OWL ontologies with discourse relation examples. Built with FastAPI backend and Angular frontend.
- Corpus Discovery: Automatically loads OWL files following the
<corpus>-<lang>.owlnaming convention - Advanced Filtering: Filter examples by language, connective, relation type, symmetry, and full-text search
- Pagination: Browse through examples with configurable page sizes
- Responsive Design: Mobile-friendly interface
- Detailed View: Modal popup with complete example information
- RESTful API: Comprehensive JSON API with filtering capabilities
ontology-viewer/
├── backend/ # Python FastAPI backend
│ ├── src/
│ │ ├── main.py # FastAPI application
│ │ ├── models.py # Pydantic models
│ │ ├── parser.py # OWL file parsing
│ │ └── config.py # Configuration
│ ├── tests/
│ │ └── test_parser.py
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/ # Angular frontend
│ ├── src/
│ │ ├── app/
│ │ │ ├── components/
│ │ │ │ ├── corpus-list/
│ │ │ │ ├── example-detail/
│ │ │ │ ├── examples-list/
│ │ │ │ └── filter-bar/
│ │ │ ├── services/
│ │ │ │ └── api.service.ts
│ │ │ ├── models/
│ │ │ │ └── example.model.ts
│ │ │ ├── app.component.ts
│ │ │ └── app.module.ts
│ │ ├── index.html
│ │ ├── main.ts
│ │ └── styles.css
│ ├── angular.json
│ ├── tsconfig.json
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ ├── package.json
│ ├── package-lock.json
│ ├── postcss.config.cjs
│ ├── tailwind.config.cjs
│ ├── proxy.conf.json
│ ├── nginx.conf
│ ├── .dockerignore
│ └── Dockerfile
├── nginx/ # Nginx reverse proxy config
│ ├── conf.d/
│ │ └── security.conf
│ ├── html/
│ │ ├── 429.html
│ │ └── 50x.html
│ └── nginx.conf
├── data/ # OWL ontology files
│ ├── discourse.ISO.UDisc.owl
│ ├── ISO-24617-8-en.owl
│ ├── PDC-pl.owl
│ └── PDC-Guidelines-pl.owl
├── docker-compose.yml
├── .env.example
├── .gitignore
└── README.md
- Docker and Docker Compose
-
Clone the repository and configure environment:
cp .env.example .env
-
Edit
.env— set your domain and allowed origins:DOMAIN_NAME=example.com ALLOWED_ORIGINS=https://example.com
-
Prepare SSL certificates:
mkdir -p nginx/ssl cp /path/to/fullchain.pem nginx/ssl/fullchain.pem cp /path/to/privkey.pem nginx/ssl/privkey.pem openssl dhparam -out nginx/ssl/dhparam.pem 2048
-
Start the stack:
docker compose up -d
The application will be available at
https://<your-domain>. -
View logs:
docker compose logs -f
-
Stop the stack:
docker compose down
- Place OWL files in the
data/directory - Follow naming convention:
<corpus-name>-<language-code>.owl - Ensure files import the main ontology
discourse.ISO.UDisc.owl - Restart the stack:
docker compose restart backend
GET /api/health— Returns server status
GET /api/corpora— List available corpora with counts
GET /api/examples— Get paginated examples with filtering- Query parameters:
corpus,language,connective,relation,symmetric,q(search),page,page_size
- Query parameters:
GET /api/examples/{id}— Get specific example by ID
GET /api/ontology/classes— Get ontology class hierarchyGET /api/ontology/relations— Get relation classes with symmetry info
{
"id": "http://purl.org/olia/discourse/discourse.ISO.owl#Example_Purpose",
"text": "Idź do babci, żeby dała ci 20 złotych",
"language": "pl",
"connective": "żeby",
"relation": "Purpose",
"symmetric": false,
"corpus": "PDC",
"ontology_types": [
"http://purl.org/olia/discourse/discourse.ISO.owl#Purpose"
],
"provenance": "PDC-pl.owl"
}{
"name": "PDC",
"language": "pl",
"file": "data/PDC-pl.owl",
"count": 8
}This research was funded in whole by the National Science Centre, Poland, grant 2023/50/A/HS2/00559 ("Universal Discourse: a multilingual model of discourse relations").