Skip to content

Adding transformation files #150

Adding transformation files

Adding transformation files #150

Workflow file for this run

name: transform ePO and ePO modules XMIs
on:
push:
branches:
- "**"
- "!demo"
paths:
- "implementation/ePO_core/xmi_conceptual_model/ePO_core.xml"
- "implementation/eCatalogue/xmi_conceptual_model/eCatalogue.xml"
- "implementation/eNotice/xmi_conceptual_model/eNotice.xml"
- "implementation/eOrdering/xmi_conceptual_model/eOrdering.xml"
- "implementation/eFulfilment/xmi_conceptual_model/eFulfilment.xml"
- "implementation/eContract/xmi_conceptual_model/eContract.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 --branch 2.1.6 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=(eOrdering eFulfilment eCatalogue eNotice eContract ePO_core)
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}.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=(eOrdering eFulfilment eCatalogue eNotice eContract ePO_core)
cd model2owl
mkdir -p merge-xmis
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}"
do
cp ../implementation/$implementation/xmi_conceptual_model/e*.xml merge-xmis
done
ls merge-xmis
make merge-xmi FIRST_XMI_TO_BE_MERGED_FILE_PATH=merge-xmis/ePO_core.xml MERGED_XMIS_FILE_NAME=ePO_combined.xmi
echo "merged XMI file"
ls output/combined-xmi
shell: bash
- name: change config to core
run: |
sed -i "s/test\/ePO-default-config/..\/implementation\/ePO_core\/model2owl-config/g" model2owl/config-proxy.xsl
cat model2owl/config-proxy.xsl
- name: generate combined glossary from the merged xmi
run: |
cd model2owl
make generate-glossary XMI_INPUT_FILE_PATH=output/combined-xmi/ePO_combined.xmi OUTPUT_GLOSSARY_PATH=../$OUTPUT_GLOSSARY_PATH
# - name: generate widoco
# run: |
# cd model2owl
# make generate-html-docs-from-rdf WIDOCO_RDF_INPUT_FILE_PATH=../implementation/ePO/owl_ontology/ePO_CM-core.rdf WIDOCO_OUTPUT_FOLDER_PATH=../implementation/ePO/widoco
# 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 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.1.6 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=(eOrdering eFulfilment eCatalogue eNotice eContract ePO_core)
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}.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 }}