diff --git a/.gitignore b/.gitignore index d8a0d73..6ea222c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -C01V04-VER.EX01.xml -C01V04-VER.EX01.trig dexpi.properties pandid.xml pandid.trig @@ -7,19 +5,20 @@ rml/segments.trig client/.idea .vs client/Boundaries/Dexpi2Svg/test.svg -rml/C03V04.trig -www/C03V04.svg client/Boundaries/Dexpi2Svg/bin client/Boundaries/Dexpi2Svg/obj client/Boundaries/Boundaries/bin client/Boundaries/Boundaries/obj client/Boundaries/TestBoundaries/obj client/Boundaries/TestBoundaries/bin -aibel_dexpi/* -aibel_dexpi.xml output.svg local chex.egg-info __pycache__ /owl/boundary.properties /owl/catalog-v001.xml +/www/node_modules/ +/RDFox.lic +/.idea/ +/www/.idea +/www/index.html diff --git a/README.md b/README.md index 66ad45f..a63c24d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ A repository for SSI experiments with DEXPI. -[RML mappings](rml/README.md) +* To start up the demo, see [docker/README.md](docker/README.md) -[RDFox scripts](rdfox/README.md) \ No newline at end of file +* To use the demo, see [www/README.md](www/README.md) + +* For the mappings from Dexpi to IMF see the [RML mappings](rml/README.md) + +* For the backend setup of the triplestore, see the [RDFox scripts](rdfox/README.md) \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..2b8ff6d --- /dev/null +++ b/docker/README.md @@ -0,0 +1,17 @@ +# Docker-based demo setup + +## Prerequisites +* Install Docker and Docker-compose [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) + +* Copy the RDFox license file to [../RDFox.lic](../RDFox.lic) + +* Find a dexpi file, and copy it to [../rml_mappings/pandid.xml](../rml_mappings/pandid.xml) + +## Running + +* From the root folder in the project ([../](../)), run +``` +docker-compose -f docker/docker-compose.yml up --build +``` + +* Open [http://localhost:8080](http://localhost:8080) \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..55678bc --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,35 @@ + +services: + rdfox: + image: oxfordsemantic/rdfox:7.2a + command: -license.file /home/rdfox/.RDFox/RDFox.lic sandbox /home/rdfox/.RDFox/rdfox dexpi + stdin_open: true + tty: true + ports: + - 12110:12110 + volumes: + - type: bind + source: ../ + target: /home/rdfox/.RDFox/ + depends_on: + rml-mapper: + condition: service_completed_successfully + rml-mapper: + build: rml-mapper + tty: true + volumes: + - type: bind + source: ../ + target: /app/local/ + web: + build: web + tty: true + ports: + - 8080:80 + volumes: + - type: bind + source: ../www + target: /var/www/html/ + depends_on: + rml-mapper: + condition: service_completed_successfully \ No newline at end of file diff --git a/docker/rml-mapper/Dockerfile b/docker/rml-mapper/Dockerfile new file mode 100644 index 0000000..e8f50a9 --- /dev/null +++ b/docker/rml-mapper/Dockerfile @@ -0,0 +1,24 @@ +# Use official Java image as the base image +FROM eclipse-temurin:21 + +# Set the working directory +WORKDIR /app + +# Download the JAR file from the release URL and rename it to rmlmapper.jar +ADD https://github.com/RMLio/rmlmapper-java/releases/download/v7.1.2/rmlmapper-7.1.2-r374-all.jar /app/rmlmapper.jar + +# Install Git, xsltproc and apache +RUN apt-get update && \ + apt-get install -y git xsltproc dos2unix + +# Clone the NOAKADEXPI Git repo +RUN git clone https://github.com/equinor/NOAKADEXPI.git /app/NOAKADEXPI + +# Copy the demo bash script +COPY demo.sh /app/demo.sh +RUN dos2unix /app/demo.sh +RUN chmod +x /app/demo.sh + +# Run the rml mappings +ENTRYPOINT "/app/demo.sh" + diff --git a/docker/rml-mapper/demo.sh b/docker/rml-mapper/demo.sh new file mode 100644 index 0000000..a73b3b2 --- /dev/null +++ b/docker/rml-mapper/demo.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# This script is for use inside the docker container defined in the Dockerfile in this folder +# See README.md for instructions + +# Create rdf +cd local/rml_mappings +java -jar /app/rmlmapper.jar -m *map*ttl -s trig -o pandid.trig +cd /app/ + +# Copy the lacking Origo symbol +cp /app/local/xslt/PV001A_Origo.svg /app/NOAKADEXPI/Symbols/Origo + +# Create svg +xsltproc --novalid -o /app/dexpi.svg /app/local/xslt/dexpisvg.xslt /app/local/rml_mappings/pandid.xml + +## Copy svg into html +head -n 14 /app/local/www/dexpi.html > /app/local/www/index.html +cat /app/dexpi.svg >> /app/local/www/index.html +tail -n +14 /app/local/www/dexpi.html >> /app/local/www/index.html + + diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile new file mode 100644 index 0000000..aeb42e6 --- /dev/null +++ b/docker/web/Dockerfile @@ -0,0 +1,14 @@ +# Use official Java image as the base image +FROM eclipse-temurin:21 + +# Set the working directory +WORKDIR /app + +# apache +RUN apt-get update && \ + apt-get install -y apache2 + + +# Run the web server +ENTRYPOINT ["apache2ctl", "-D", "FOREGROUND"] + diff --git a/rml_mappings/README.md b/rml_mappings/README.md index 7dc5214..66fdeac 100644 --- a/rml_mappings/README.md +++ b/rml_mappings/README.md @@ -4,6 +4,10 @@ * Download a proteus xml file, for example [DISC_EXAMPLE-02-01.xml](https://github.com/equinor/NOAKADEXPI/blob/main/Blueprint/DISC_EXAMPLE-02/DISC_EXAMPLE-02-01.xml) to this folder and rename it to "pandid.xml" +## Running +You can either run the docker command documented in [../docker/README.md](../docker/README.md), which as a side-effect will run the mappings. +Or you can run it using java: + * Install java jdk version 17 or newer * *Use java jdk version 17 when building rml-mapper*. To check the java version used run `mvn -version`. If the version 17 is not used, install this and update the `JAVA_HOME` system variable to point to version 17. diff --git a/www/RunGuide.md b/www/RunGuide.md deleted file mode 100644 index ef477ab..0000000 --- a/www/RunGuide.md +++ /dev/null @@ -1,106 +0,0 @@ -# Running the NOAKADEXPI Program - -This guide will help you run the NOAKADEXPI program that converts DEPI XML files to SVG format using the DEXPI2SVG tool. - -## Prerequisites - -Before you start, ensure that you have the following repository structure on your local machine: - -- `NOAKADEXPI` repository located adjacent to the `SSI_DEXPI_TEMP` repository. - -## Steps to Run the Program - -1. **Navigate to the Tool Directory** - - Open a command prompt or terminal window and navigate to the `Client/boundaries/Dexpi2svg` directory within the `NOAKADEXPI` repository. - -2. **Run the Conversion Command** - - Use the following command to convert your DEPI XML file to SVG format: - - ```sh - dotnet run "" "" > output.svg - ``` - - Replace `` with the generic path to your DEPI XML file and `` with the generic path to your XSLT file. - -3. **Addressing Missing Symbol Error** - - If you encounter an error about a missing symbol `PV001A_Origio.svg`, you will need to create it by following these steps: - - a. Create a new file inside the `NOAKADEXPI/SYMBOL/Origo` directory. - - b. Paste the following SVG content into the new file: - - ```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ``` - - Name this file `PV001A_Origio.svg`. - -4. **Integrate the SVG Output** - - Once you have the `output.svg` file, you can integrate it into your `dexpi.html` file: - - a. Copy the full contents of `output.svg`. - - b. Paste the copied SVG content into `dexpi.html` after the line ``. - - Ensure that the end of your `dexpi.html` file only contains the following lines: - - ```html - - - - ``` - -5. **View the Result** - - Open `dexpi.html` in a web browser to view the SVG representation of your DEPI XML file. You should now be able to click on the components within the SVG as intended. - If you want to be able to create boundaries you must use RDFox aswell, to manage this see the README in client/boundaries. \ No newline at end of file diff --git a/xslt/PV001A_Origo.svg b/xslt/PV001A_Origo.svg new file mode 100644 index 0000000..c598c38 --- /dev/null +++ b/xslt/PV001A_Origo.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/www/dexpisvg.xslt b/xslt/dexpisvg.xslt similarity index 92% rename from www/dexpisvg.xslt rename to xslt/dexpisvg.xslt index 3cda4c5..c33d499 100644 --- a/www/dexpisvg.xslt +++ b/xslt/dexpisvg.xslt @@ -118,9 +118,42 @@ - - + + + + + + + + 270 + 0 + 180 + 90 + + This combination of reference values is not handled: + X: + Y: + Z: + + + + + + + + + + + + This combination of reference values is not handled: + + + + + + + + select="concat('../../NOAKADEXPI/Symbols/Origo/', $shapeValue, '_Origo.svg')" /> + test="not($path = '../../NOAKADEXPI/Symbols/Origo/BORDER_A1_Origo.svg')">