The project HAZOP2RDF is part of the course Projektierung von Automatisierungssystem. The main goal of the project is to transform the HAZOP data, which is stored in Excel format into RDF format and visa versa.
We implemented a command line interface (CLI) using ComplexCLI, which means CLI in CLI to combine all interfaces in a single interface.
- Git 2.30+
- Python 3.8+
- Apache Jena Fuseki 4.1+
git clone https://github.com/DimakDev/HAZOP2RDF.git
cd hazop
python -m venv .\venv
venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install .
venv\Scripts\cli [cmd]
See API section for commands to runpytest
See Tests section for commands to rundeactivate
git clone https://github.com/DimakDev/HAZOP2RDF.git
cd hazop
python3 -m venv ./venv
source venv/bin/activate
pip install --upgrade pip
pip install .
cli [cmd]
See API section for commands to runpytest
See Tests section for commands to rundeactivate
To see the list of available commands, run cli
.
Usage: cli [OPTIONS] COMMAND [ARGS]...
Welcome to HAZOP CLI!
Options:
--help Show this message and exit.
Commands:
exporter Exporter interface
importer Importer interface
cli importer
- Importer APIcli exporter
- Exporter API
This API is an entry point for reading Excel data and building RDF-Graphs.
Command: cli importer
Usage: cli cli [OPTIONS] COMMAND [ARGS]...
Importer interface
Options:
--help Show this message and exit.
Commands:
cmd-build-hazop-graphs Build HAZOP graphs
cmd-read-excel-data Read excel data
cmd-read-hazop-data Read hazop data
cli importer cmd-read-excel-data
- to see the list of available Excel binary datacli importer cmd-read-hazop-data
- to read the HAZOP data if its config is availablecli importer cmd-build-hazop-graphs
- to build HAZOP graphs, save it locally and upload to Fuseki server, if the server is up
This API exports RDF-Graphs to Excel either from local directory or from Fuseki server, if it is available.
Command: cli exporter
Usage: cli cli [OPTIONS] COMMAND [ARGS]...
Exporter interface
Options:
--help Show this message and exit.
Commands:
cmd-export-graphs-from-fuseki-server
Export HAZOP graphs...
cmd-export-graphs-from-local-directory
Export HAZOP graphs...
cli exporter cmd-export-graphs-from-local-directory
- to convert graphs from Turtle in Excel format and save it locallycli exporter cmd-export-graphs-from-fuseki-server
- to get graphs from Fuseki server, if the server is running, convert it to Excel format and save it locally
You can use the following commands to get quick results or customize the tests' configuration using pytest and pytest-cov flags:
pytest
- to run quick testpytest --cov=src --cov-report term-missing
- to run a test with coverage report and missing statementspytest --cov=src --cov-report html
- to run a test with coverage report and missing statements in html format (by default open htmlcov/index.html to see the results)