updated xml files #125
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: transform ePO and ePO modules XMIs | |
on: | |
push: | |
branches: | |
- "**" | |
- "!demo" | |
paths: | |
- "implementation/ePO/xmi_conceptual_model/ePO_CM.xml" | |
- "implementation/eCatalogue/xmi_conceptual_model/eCatalogue_CM.xml" | |
- "implementation/eNotice/xmi_conceptual_model/eNotice_CM.xml" | |
- "implementation/eOrdering/xmi_conceptual_model/eOrdering_CM.xml" | |
- "implementation/eFulfilment/xmi_conceptual_model/eFulfilment_CM.xml" | |
- "implementation/eFulfilment/xmi_conceptual_model/eContract_CM.xml" | |
jobs: | |
transform: | |
runs-on: ubuntu-latest | |
env: | |
OUTPUT_GLOSSARY_PATH: glossary/ | |
OUTPUT_REPORT_FILE_NAME: conventions_report.html | |
steps: | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ github.ref }} | |
- name: make transform process directories | |
run: | | |
mkdir -p transform | |
mkdir -p transform/merge-xmis | |
- name: get model2owl | |
run: | | |
cd transform && git clone --branch 2.0.0 https://github.com/OP-TED/model2owl.git | |
pwd | |
cp ./model2owl/Makefile /home/runner/work/ePO/ePO/ | |
- name: get-saxon | |
run: pwd && make get-saxon PROJECT_DIR=transform | |
- name: get-rdflib | |
run: make get-rdflib | |
- name: transform step | |
run: | | |
AVAILABLE_IMPLEMENTATIONS=(eOrdering eFulfilment eCatalogue eNotice eContract ePO) | |
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}" | |
do | |
echo "-------------------${implementation}---------------------------------" | |
sed -i "s/test\/ePO-default-config/..\/..\/implementation\/${implementation}\/model2owl-config/g" transform/model2owl/config-proxy.xsl | |
cat transform/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/") | |
OUTPUT_REPORT_PATH=$(echo "implementation/$implementation/conventions_report/") | |
OUTPUT_CORE_FILE_NAME=$(echo "${implementation}_owl_core.rdf") | |
OUTPUT_CORE_FILE_NAME_TTL=$(echo "${implementation}_owl_core.ttl") | |
OUTPUT_RESTRICTIONS_FILE_NAME=$(echo "${implementation}_restrictions.rdf") | |
OUTPUT_RESTRICTIONS_FILE_NAME_TTL=$(echo "${implementation}_restrictions.ttl") | |
OUTPUT_SHACL_SHAPES_FILE_NAME=$(echo "${implementation}_shacl_shapes.rdf") | |
OUTPUT_SHACL_SHAPES_FILE_NAME_TTL=$(echo "${implementation}_shacl_shapes.ttl") | |
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_PATH_OWL is $OUTPUT_PATH_OWL" | |
echo "OUTPUT_PATH_SHACL is $OUTPUT_PATH_SHACL" | |
echo "OUTPUT_REPORT_PATH is $OUTPUT_REPORT_PATH" | |
echo "OUTPUT_CORE_FILE_NAME is $OUTPUT_CORE_FILE_NAME" | |
echo "OUTPUT_RESTRICTIONS_FILE_NAME is $OUTPUT_RESTRICTIONS_FILE_NAME" | |
echo "OUTPUT_SHACL_SHAPES_FILE_NAME is $OUTPUT_SHACL_SHAPES_FILE_NAME" | |
echo "OUTPUT_GLOSSARY_FILE_NAME is $OUTPUT_GLOSSARY_FILE_NAME" | |
mkdir -p $OUTPUT_REPORT_PATH | |
rm -f $OUTPUT_REPORT_PATH*.html || true | |
rm -f $OUTPUT_PATH*.rdf || true | |
rm -f $OUTPUT_PATH*.ttl || true | |
java -jar transform/saxon-he-10.6.jar -s:$CM_FILE_PATH -xsl:transform/model2owl/src/owl-core.xsl -o:$OUTPUT_PATH_OWL$OUTPUT_CORE_FILE_NAME | |
java -jar transform/saxon-he-10.6.jar -s:$CM_FILE_PATH -xsl:transform/model2owl/src/owl-restrictions.xsl -o:$OUTPUT_PATH_OWL$OUTPUT_RESTRICTIONS_FILE_NAME | |
java -jar transform/saxon-he-10.6.jar -s:$CM_FILE_PATH -xsl:transform/model2owl/src/shacl-shapes.xsl -o:$OUTPUT_PATH_SHACL$OUTPUT_SHACL_SHAPES_FILE_NAME | |
java -jar transform/saxon-he-10.6.jar -s:$CM_FILE_PATH -xsl:transform/model2owl/src/html-conventions-report.xsl -o:$OUTPUT_REPORT_PATH$OUTPUT_REPORT_FILE_NAME | |
java -jar transform/saxon-he-10.6.jar -s:$CM_FILE_PATH -xsl:transform/model2owl/src/html-model-glossary.xsl -o:$OUTPUT_GLOSSARY_PATH$OUTPUT_GLOSSARY_FILE_NAME | |
echo "+++++++++++++++++transform to turtle++++++++++++++++++++++++++++" | |
echo $(ls ${OUTPUT_PATH_OWL}/*.rdf) | |
rdfpipe -i application/rdf+xml -o turtle $OUTPUT_PATH_OWL$OUTPUT_CORE_FILE_NAME > $OUTPUT_PATH_OWL$OUTPUT_CORE_FILE_NAME_TTL | |
rdfpipe -i application/rdf+xml -o turtle $OUTPUT_PATH_OWL$OUTPUT_RESTRICTIONS_FILE_NAME > $OUTPUT_PATH_OWL$OUTPUT_RESTRICTIONS_FILE_NAME_TTL | |
echo $(ls ${OUTPUT_PATH_SHACL}/*.rdf) | |
rdfpipe -i application/rdf+xml -o turtle $OUTPUT_PATH_SHACL$OUTPUT_SHACL_SHAPES_FILE_NAME > $OUTPUT_PATH_SHACL$OUTPUT_SHACL_SHAPES_FILE_NAME_TTL | |
echo "-------------------end transform---------------------------------" | |
sed -i "s/..\/..\/implementation\/${implementation}\/model2owl-config/test\/ePO-default-config/g" transform/model2owl/config-proxy.xsl | |
done | |
shell: bash | |
- name: merge implementations xmi files into one | |
run: | | |
AVAILABLE_IMPLEMENTATIONS=(eOrdering eNotice eCatalogue eFulfilment eContract ePO) | |
for implementation in "${AVAILABLE_IMPLEMENTATIONS[@]}" | |
do | |
cp implementation/$implementation/xmi_conceptual_model/*_CM.xml transform/merge-xmis | |
done | |
ls transform/merge-xmis | |
make merge-xmi COMBINED_XMI_DIRECTORY=transform/merged-xmis-result SAXON=transform/saxon-he-10.6.jar FIRST_INPUT_XMI_FILE=/home/runner/work/ePO/ePO/transform/merge-xmis/ePO_CM.xml MODEL2OWL_DIR=transform/model2owl | |
echo "merged XMI file" | |
ls transform/merged-xmis-result | |
shell: bash | |
- name: change config to core | |
run: | | |
sed -i "s/test\/ePO-default-config/..\/..\/implementation\/ePO\/model2owl-config/g" transform/model2owl/config-proxy.xsl | |
cat transform/model2owl/config-proxy.xsl | |
- name: generate combined glossary from the merged xmi | |
run: | | |
make generate-glossary OUTPUT_GLOSSARY_PATH=${OUTPUT_GLOSSARY_PATH} UML_INPUT_FILENAME=./transform/merged-xmis-result/ePO-combined.xmi SAXON=transform/saxon-he-10.6.jar MODEL2OWL_DIR=transform/model2owl | |
- name: remove unnecessary files | |
run: | | |
sudo rm -rf transform | |
sudo rm -rf Makefile | |
shell: bash | |
- name: commit files | |
id: commit | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "github-actions" | |
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 }} |