Skip to content

Commit

Permalink
updated from main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos0000 committed Feb 9, 2024
2 parents 9b15e02 + c07385f commit 7adbcb3
Show file tree
Hide file tree
Showing 26 changed files with 9,631 additions and 35,372 deletions.
99 changes: 0 additions & 99 deletions .github/workflows/transform_ontology.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: generate conventions and glossary
name: transform UML model
on:
push:
branches:
Expand All @@ -9,7 +9,6 @@ on:
- "implementation/core_person/xmi_conceptual_model/core_person_CM.xml"
- "implementation/core_location/xmi_conceptual_model/core_location_CM.xml"
- "implementation/core_public_organisation/xmi_conceptual_model/core_public_organisation_CM.xml"

jobs:
report_and_glossary:
runs-on: ubuntu-latest
Expand All @@ -22,7 +21,7 @@ jobs:

- name: get model2owl
run: |
git clone https://github.com/OP-TED/model2owl.git
git clone --branch 2.2.0 https://github.com/OP-TED/model2owl.git
pwd
- name: get-saxon
Expand Down Expand Up @@ -73,7 +72,7 @@ jobs:
done
ls merge-xmis
make merge-xmi FIRST_XMI_TO_BE_MERGED_FILE_PATH=merge-xmis/core_person_CM.xml
make merge-xmi FIRST_XMI_TO_BE_MERGED_FILE_PATH=merge-xmis/demo_ontology_CM.xml
echo "merged XMI file"
ls output/combined-xmi
Expand All @@ -89,6 +88,93 @@ jobs:
sudo rm -rf model2owl
shell: bash

- name: commit files
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git pull
git status
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "::set-output name=push::false"
else
git commit -m "Adding convention report and glossary files"
echo "::set-output name=push::true"
fi
shell: bash

- name: Push changes
if: steps.commit.outputs.push == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
transform:
needs: report_and_glossary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}

- name: get model2owl
run: |
git clone --branch 2.2.0 https://github.com/OP-TED/model2owl.git
pwd
- name: get-saxon
run: pwd && cd model2owl && make get-saxon

- name: get-rdflib
run: cd model2owl && make create-virtual-env && make get-rdflib

- name: transform step
run: |
AVAILABLE_IMPLEMENTATIONS=(core_person core_location core_public_organisation)
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}"
do
echo "-------------------${implementation} transform---------------------------------"
sed -i "s/test\/ePO-default-config/..\/implementation\/${implementation}\/model2owl-config/g" model2owl/config-proxy.xsl
cat model2owl/config-proxy.xsl
CM_FILE_NAME=$(echo "${implementation}_CM.xml")
CM_FILE_PATH=$(echo "implementation/$implementation/xmi_conceptual_model/${CM_FILE_NAME}")
OUTPUT_PATH_OWL=$(echo "implementation/$implementation/owl_ontology/")
OUTPUT_PATH_SHACL=$(echo "implementation/$implementation/shacl_shapes/")
ls -la implementation/$implementation/xmi_conceptual_model/
echo "CM_FILE_PATH is $CM_FILE_PATH"
echo "OUTPUT_PATH_OWL is $OUTPUT_PATH_OWL"
echo "OUTPUT_PATH_SHACL is $OUTPUT_PATH_SHACL"
cd model2owl
ls -la
echo "+++++++++++++++++transform to rdf++++++++++++++++++++++++++++"
make owl-core XMI_INPUT_FILE_PATH=../$CM_FILE_PATH OUTPUT_FOLDER_PATH=../$OUTPUT_PATH_OWL
make owl-restrictions XMI_INPUT_FILE_PATH=../$CM_FILE_PATH OUTPUT_FOLDER_PATH=../$OUTPUT_PATH_OWL
make shacl XMI_INPUT_FILE_PATH=../$CM_FILE_PATH OUTPUT_FOLDER_PATH=../$OUTPUT_PATH_SHACL
echo "+++++++++++++++++transform to turtle++++++++++++++++++++++++++++"
echo $(ls ../${OUTPUT_PATH_OWL}*.rdf)
make convert-rdf-to-turtle ONTOLOGY_FOLDER_PATH=../$OUTPUT_PATH_OWL
echo $(ls ../${OUTPUT_PATH_SHACL}*.rdf)
make convert-rdf-to-turtle ONTOLOGY_FOLDER_PATH=../$OUTPUT_PATH_SHACL
echo "-------------------end transform---------------------------------"
sed -i "s/..\/implementation\/${implementation}\/model2owl-config/test\/ePO-default-config/g" config-proxy.xsl
cd ..
done
shell: bash

- name: remove unnecessary files
run: |
sudo rm -rf model2owl
shell: bash

- name: commit files
id: commit
run: |
Expand All @@ -101,7 +187,7 @@ jobs:
if [ -z "$(git status --porcelain)" ]; then
echo "::set-output name=push::false"
else
git commit -m "Adding convention report and glossary files"
git commit -m "Adding transformation files"
echo "::set-output name=push::true"
fi
shell: bash
Expand Down
56 changes: 13 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Main steps:
* Fork this repository
* Put your UML model/models export (XML file) in the implementation folder
* Configure model2owl using config folder
* Change GitHub action scripts available to include your ontologies
* Change GitHub action script available to include your ontologies

# Usage
## Naming conventions
Expand All @@ -31,10 +31,10 @@ implementation
* Copy model2owl-config folder into UML model implementation folder created at the previous step
* Configure model2owl using the files inside model2owl-config folder
## Adjust GitHub actions
In the folder .GitHub from this repository are 2 action scripts that will transform the UML model/models.
### Generate convention report and glossary
In the folder .GitHub from this repository there is one action script that will transform the UML model/models.
### Transform with model2owl

**File name:** generate_conventions_and_glossary.yml
**File name:** transform_with_model2owl.yml

Configure the trigger for this action changing the following lines
```yaml
Expand Down Expand Up @@ -63,37 +63,7 @@ implementation
To include both models for generating the convention report and glossary the variable should be
AVAILABLE_IMPLEMENTATIONS=(modelOne modelTwo)
```
### Transform UML model

**File name:** transform_ontology.yml

Configure the trigger for this action changing the following lines
```yaml
paths:
- "implementation/demo_ontology/xmi_conceptual_model/demo_ontology_CM.xml"
- "implementation/demo_ontology/xmi_conceptual_model/demo_ontology_module_CM.xml"
```
If any change is detected in the files that are included in the paths config will trigger this GitHub action.
The paths should be to the UML model export file.

Configure which of the implementation should be included by changing the AVAILABLE_IMPLEMENTATIONS variable
inside the action script.
```shell
AVAILABLE_IMPLEMENTATIONS=(demo_ontology demo_ontology_module)
```
Search in the script for this variable declaration as it has multiple usage and change the value accordingly.
The values in the list should be the folder names created for the UML model under the implementation folder.

```
Example:
implementation
|___modelOne
|___modelTwo
To include both models to transform into a formal OWL ontology and a SHACL shape the variable should be
AVAILABLE_IMPLEMENTATIONS=(modelOne modelTwo)
```
## Output
The output is automatically generated by the GitHub action scripts described previously. Each of the scripts will
do an automatic commit on the branch that was executed from. To see the output executing a git pull after the GitHub
Expand All @@ -112,9 +82,9 @@ be processed by GitHub action scripts
.github
glossary
|__static -> folder to hold css and js neccesary for the glossary
|__modelOne_CM-glossary.html
|__modelTwo_CM-glossary.html
|__ontologies-combined-glossary.html -> combined glossary
|__modelOne_CM_glossary.html
|__modelTwo_CM_glossary.html
|__ontologies_combined_glossary.html -> combined glossary
implementation
model2owl-config
```
Expand All @@ -127,13 +97,13 @@ below.
| |__static -> folder to hold css and js neccesary for the convention report
| |__modelOne_CM-convention-report.html
|__owl_ontology
| |__modelOne_CM-core.rdf
| |__modelOne_CM-core.ttl
| |__modelOne_CM-restrictions.rdf
| |__modelOne_CM-restrictions.ttl
| |__modelOne_CM_core.rdf
| |__modelOne_CM_core.ttl
| |__modelOne_CM_restrictions.rdf
| |__modelOne_CM_restrictions.ttl
|__shacl_shapes
| |__modelOne_CM-shacl.rdf
| |__modelOne_CM-shacl.rdf
| |__modelOne_CM_shapes.rdf
| |__modelOne_CM_shapes.rdf
|___model2owl-config
|___xmi_conceptual_model
|___modelTwo
Expand Down
Loading

0 comments on commit 7adbcb3

Please sign in to comment.