# Unl2rdf web demo

This is a [dockerized](https://www.docker.com/) webdemo of the [unl2rdf java parser](https://gitlab.tetras-libre.fr/unl/unl2rdf)

## Requirements

+ [Docker](https://docs.docker.com/get-docker/)
+ [Docker-compose](https://docs.docker.com/compose/install/)

## Install

```bash
cp .env.sample .env
docker-compose up
```

The first time this process will take a while as it has to [build](#build-process) the docker images and the [java parser](https://gitlab.tetras-libre.fr/unl/unl2rdf).

Then open in a browser `http://localhost:5000`

## build process

The docker build process consists in three steps

1. On create a debian base image with jdk
2. Create a build image that retrieve the unl2rdf parser sources and builds it
3. Create an image to run the flask application

### Triggering a rebuild

Docker caches every step of the build, if the java parser has changed, `docker-compose build` will not detect it, so you have to change `GIT_REF=` in the `.env` file to point to the desired commit, branch or tag. Then you can run `docker-compose build` and only the required steps to rebuild the java parser will run again.

## Developpement

This is a one page [flask](https://flask.palletsprojects.com) app to acces the [unl2rdf parser](https://gitlab.tetras-libre.fr/unl/unl2rdf), the web app is full python, everything is in the file `src/app/app.py` and in `src/app/static/<css|js>`

The display rendering uses the templates in the directory `src/app/templates` see [flakes templating](https://flask.palletsprojects.com/en/1.1.x/quickstart/#rendering-templates).

Js and css dependencies are installed via npm in directory `src/app/static`