-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (174 loc) · 7.89 KB
/
transform_with_model2owl.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#TODO:add src_ap after re-exporting with correct version of XMI
name: transform UML model
on:
push:
branches:
- "**"
paths:
- "implementation/src_ap/xmi_conceptual_model/src_ap_CM.xml"
- "implementation/cob_src_ap/xmi_conceptual_model/cob_src_ap_CM.xml"
- "implementation/site_src_ap/xmi_conceptual_model/site_src_ap_CM.xml"
- "implementation/place_src_ap/xmi_conceptual_model/place_src_ap_CM.xml"
- "implementation/language_src_ap/xmi_conceptual_model/language_src_ap_CM.xml"
- "implementation/currency_src_ap/xmi_conceptual_model/currency_src_ap_CM.xml"
- "implementation/common_src_ap/xmi_conceptual_model/common_src_ap_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 --branch 2.2.0 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=(cob_src_ap site_src_ap place_src_ap language_src_ap currency_src_ap common_src_ap)
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=(src_ap cob_src_ap site_src_ap place_src_ap language_src_ap currency_src_ap)
# 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 "action@github.com"
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=(cob_src_ap site_src_ap place_src_ap language_src_ap currency_src_ap common_src_ap)
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 "action@github.com"
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 }}