Skip to content

Commit

Permalink
model2owl boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos0000 committed Sep 5, 2024
1 parent bf9fa73 commit 9af5bb2
Show file tree
Hide file tree
Showing 68 changed files with 150,273 additions and 1 deletion.
197 changes: 197 additions & 0 deletions .github/workflows/transform_with_model2owl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: transform UML model
on:
push:
branches:
- "**"
paths:
- "implementation/demo_ontology/xmi_conceptual_model/demo_ontology_CM.xml"
- "implementation/demo_ontology_module/xmi_conceptual_model/demo_ontology_module_CM.xml"
jobs:
report_and_glossary:
runs-on: ubuntu-latest
env:
OUTPUT_GLOSSARY_PATH: glossary/
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.ref }}

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


- name: generate convention report and glossary
run: |
AVAILABLE_IMPLEMENTATIONS=(demo_ontology demo_ontology_module)
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}"
do
echo "-------------------${implementation}---------------------------------"
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_CONVENTION_REPORT_PATH=$(echo "implementation/$implementation/conventions_report/")
OUTPUT_GLOSSARY_FILE_NAME=$(echo "${implementation}_glossary.html")
ls -la implementation/$implementation/xmi_conceptual_model/
echo "CM_FILE_PATH is $CM_FILE_PATH"
echo "OUTPUT_REPORT_PATH is $OUTPUT_CONVENTION_REPORT_PATH"
echo "OUTPUT_GLOSSARY_FILE_NAME is $OUTPUT_GLOSSARY_FILE_NAME"
mkdir -p $OUTPUT_CONVENTION_REPORT_PATH
rm -f $OUTPUT_CONVENTION_REPORT_PATH*.html || true
ls -la
cd model2owl
ls -la
make generate-convention-report XMI_INPUT_FILE_PATH=../$CM_FILE_PATH OUTPUT_CONVENTION_REPORT_PATH=../$OUTPUT_CONVENTION_REPORT_PATH
make generate-glossary XMI_INPUT_FILE_PATH=../$CM_FILE_PATH OUTPUT_GLOSSARY_PATH=../$OUTPUT_GLOSSARY_PATH
sed -i "s/..\/implementation\/${implementation}\/model2owl-config/test\/ePO-default-config/g" config-proxy.xsl
cd ..
done
shell: bash

- name: merge implementations xmi files into one
run: |
AVAILABLE_IMPLEMENTATIONS=(demo_ontology demo_ontology_module)
cd model2owl
mkdir -p merge-xmis
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}"
do
cp ../implementation/$implementation/xmi_conceptual_model/*_CM.xml merge-xmis
done
ls merge-xmis
make merge-xmi FIRST_XMI_TO_BE_MERGED_FILE_PATH=merge-xmis/demo_ontology_CM.xml
echo "merged XMI file"
ls output/combined-xmi
shell: bash

- name: generate combined glossary from the merged xmi
run: |
cd model2owl
make generate-glossary XMI_INPUT_FILE_PATH=output/combined-xmi/ontologies-combined.xmi OUTPUT_GLOSSARY_PATH=../$OUTPUT_GLOSSARY_PATH
- name: remove unnecessary files
run: |
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 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=(demo_ontology demo_ontology_module)
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: |
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 transformation 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 }}
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Loading

0 comments on commit 9af5bb2

Please sign in to comment.