# OntoPipe (rev02) - A PMD Demonstrator for Heat-Treatment Data Acquisition
**OntoPipe** comes with a basic deployment procedure rooted in a few assumptions (no sophisticated installation environment is used):
1. the work directory "ontopipe" included in the archive is the only
place where files will be added or "installed". Correspondigly,
the show-case example OntoPipe can be "uninstalled" by removing the
directory
2. a functional Docker environment is already installed on the target
system, where the current $USER has to be a member of the docker
group ("tested" - once, but that one time thoroughly - with Docker
Compose version >=1.26.2, on an Ubuntu 18.04 system)
3. there is enough free disk space in the $USER's home directory
(ultimately requires ~10-15GB - apparently this prototype is not
optimized w.r.t. disk usage, the "downloadable" is ~30MB in size)
Early Feedback
--------------
* "A wrapping into a binder (https://mybinder.org/) could help to get this running"
Setup
-----
The following CLI commands will set up the Docker- and BlazeGraph environment for the Heat-Treatment show-case.
```bash=1
# unpack the show-case archive in a $USER's home directory
tar xjf ontopipe-rev02.tar.bz2
# change into the resulting work directory
cd ontopipe/
# adapt the configuration files to the local deployment environment
./customize_volumepaths.sh
# kickstart the Docker environment of the show-case example
docker-compose build
```
This may take a while:

```bash=12
# create containers and attach to blazegraph
docker-compose up
```
The `docker-compose up` command will NOT terminate at this point, but rather show multiple color-highlighted messages from *collector-db*, *nginx* and *aggregator-db* and indicate that it is waiting for connections. Therefore, open a new shell to execute the following CLI commands.
```bash=1
# show exemplary input files that are located in example/csv/
ls -l example/csv/
# start the show-case workflow by uploading a selected input file
./example/upload.sh -i example/csv/2021.03.11_17.13.25_Charge_3398.csv
./example/upload.sh -i example/csv/2021.03.12_14.44.53_Charge_3399.csv
./example/upload.sh -i example/csv/2021.03.16_11.31.39_Charge_3401.csv
./example/upload.sh -i example/csv/2021.03.30_18.05.03_Charge_3402.csv
# open 127.0.0.1 in a web-browser, either manually in an window manager or by executing
sensible-browser localhost
```
Interface
---------
The browser should now be able to access the following GUI:

The interface-controls (for the *Heat_Treatment_showcase*[^1]) can trigger the following action(s):
| Button | Action |
| ------------------- | ---------------------------------------------------- |
| **Query** | Performs a SPARQL *SELECT* query based on textbox input|
| **Update** | Performs "other" (e.g. *INSERT*, *CLEAR*, *DELETE*, etc.) SPARQL queries based on textbox input|
| **VOWL** | Renders the current poplulated graph database [WebVOWL](http://vowl.visualdataweb.org/webvowl.html) view.|
| **Upload** | Selects an ontology file as .ttl or .rdf (preferably .ttl) and adds it to the current graph database|
| **Blazegraph GUI** | Link to Blazegraph's own GUI |
| **Create** | Creates a new dataset based on the name provided via the adjacent textbox. (whitespaces are replaced by underscores) |
| **Clear** | Performs a "Clear all" SPARQL query on the dataset with the provided via the adjacent textbox|
| **Destroy** | Removes the dataset with the provided via the adjacent textbox|
Tear-Down
---------
After working with the Heat-Treatment show-case, the entire setup can be shut down using these CLI commands:
```bash=12
# clear the dataset Heat_Treatment_showcase and delete formerly created files from dockervolumes/shared_volume/
./example/clear_ds.sh
# stop the containers
docker-compose down --volume
```
Known Issues
------------
* If the [WebVOWL](http://vowl.visualdataweb.org/webvowl.html) visualization does not load, clearing the browser's cache and refreshing the page is required.
* `docker-compose up` following an `docker-compose up` (without an intermediate `docker-compose down --volume`) generates a "please remove the existing volume" error that is not caught by the "basic deployment procedure". Killing a running `docker-compose up` (e.g. via Ctrl+C) seems to work fine, though.
[^1]: The same interface controls exist for *kb*, which is a default database created by blazegraph and is not relevant for our show-case.