Skip to content

Commit

Permalink
Merge pull request #206 from meaningfy-ws/master
Browse files Browse the repository at this point in the history
SEMIC model2owl features from meaningfy fork
  • Loading branch information
Dragos0000 authored Aug 27, 2024
2 parents cd46f15 + 669989e commit d1eafd0
Show file tree
Hide file tree
Showing 38 changed files with 1,611 additions and 521 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/model-2owl-validator-refresh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Update github model2owl-validator repo

on:
push:
branches:
- master

jobs:
copy-and-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout model2owl repository
uses: actions/checkout@v2


- name: Copy folder to destination repository
run: |
cd ..
pwd
ls -la
mkdir copied-src-folder
ls -la
echo "directory to copy src folder was created"
cp -r model2owl/src copied-src-folder
ls -la copied-src-folder
ls -la copied-src-folder/src
- name: Configure Git
run: |
git config --global user.email "action@github.com"
git config --global user.name "github-actions"
- name: Checkout model2owl validator repository
uses: actions/checkout@v2
with:
repository: meaningfy-ws/model2owl-validator
token: ${{ secrets.GIT_USER }}
- name: second clone
run: |
ls -la
- name: Copy folder to destination repository
run: |
pwd
ls -la
cd ..
ls -la
cp -r copied-src-folder/src model2owl/resources/
cd model2owl/resources
ls -la
- name: Commit and Push to destination repository
run: |
git add .
git commit -m "Copy src folder from model2owl repository"
git status
git remote -v
git push -f https://${{ secrets.GIT_USER }}@github.com/meaningfy-ws/model2owl-validator.git main
30 changes: 26 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ get-jena-cli-tools:
@cd ${MODEL2OWL_FOLDER}/jena && curl -L -o jena.zip "https://dlcdn.apache.org/jena/binaries/apache-jena-4.10.0.zip" && unzip jena.zip && rm -rf jena.zip
@echo 'Jena riot tool path is ${JENA_RIOT_TOOL}'

# install rdflib
get-rdflib:
@echo Installing rdflib
@source model2owl-venv/bin/activate && pip install rdflib

get-widoco:
@echo Installing widoco
@mkdir -p ${MODEL2OWL_FOLDER}/widoco
Expand All @@ -63,6 +68,9 @@ install: get-saxon get-rdflib get-widoco
unit-tests:
@mvn install

create-virtual-env:
@python -m venv model2owl-venv


# Generate the glossary from an input file
# Example when not using the default variables
Expand All @@ -89,6 +97,16 @@ generate-convention-report:
@ls -lh ${OUTPUT_CONVENTION_REPORT_PATH}/${XMI_INPUT_FILENAME_WITHOUT_EXTENSION}_convention_report.html
@echo

generate-convention-SVRL-report:
@mkdir -p "${OUTPUT_CONVENTION_REPORT_PATH}"
@echo Input file path: ${XMI_INPUT_FILE_PATH}
@echo Input file name: ${XMI_INPUT_FILENAME_WITHOUT_EXTENSION}
@cp -rf ./src/static "${OUTPUT_CONVENTION_REPORT_PATH}"
@java -jar ${SAXON} -s:${XMI_INPUT_FILE_PATH} -xsl:${MODEL2OWL_FOLDER}/src/svrl-conventions-report.xsl -o:${OUTPUT_CONVENTION_REPORT_PATH}/${XMI_INPUT_FILENAME_WITHOUT_EXTENSION}_convention_svrl_report.xml
@echo The convention report is located at the following location:
@echo
@ls -lh ${OUTPUT_CONVENTION_REPORT_PATH}/${XMI_INPUT_FILENAME_WITHOUT_EXTENSION}_convention_svrl_report.xml
@echo
#Example how to run transformation commands :
# make owl-core XMI_INPUT_FILE_PATH=/home/mypc/work/model2owl/eNotice_CM.xml OUTPUT_FOLDER_PATH=./my-folder
owl-core:
Expand Down Expand Up @@ -125,7 +143,8 @@ merge-xmi:
convert-rdf-to-turtle:
@for FILE_PATH in ${RDF_FILELIST}; do \
echo Converting $${FILE_PATH} into Turtle; \
${JENA_RIOT_TOOL} --output=ttl $${FILE_PATH} > $${FILE_PATH%.*}.ttl; \
source model2owl-venv/bin/activate; \
rdfpipe -i application/rdf+xml -o turtle $${FILE_PATH} > $${FILE_PATH%.*}.ttl; \
echo Input in RDF/XML format; \
echo $${FILE_PATH}; \
echo " ==> Output in Turtle format"; \
Expand All @@ -134,7 +153,8 @@ convert-rdf-to-turtle:
convert-turtle-to-rdf:
@for FILE_PATH in ${TURTLE_FILELIST}; do \
echo Converting $${FILE_PATH} into RDF/XML; \
${JENA_RIOT_TOOL} --output=rdfxml $${FILE_PATH} > $${FILE_PATH%.*}.rdf; \
source model2owl-venv/bin/activate; \
rdfpipe -i turtle -o application/rdf+xml $${FILE_PATH} > $${FILE_PATH%.*}.rdf; \
echo Input in Turtle format; \
ls -lh $${FILE_PATH}; \
echo " ==> Output in RDF/XML format"; \
Expand All @@ -144,7 +164,8 @@ convert-turtle-to-rdf:
convert-rdf-to-jsonld:
@for FILE_PATH in ${RDF_FILELIST}; do \
echo Converting $${FILE_PATH} into JSON-LD; \
${JENA_RIOT_TOOL} --output=jsonld $${FILE_PATH} > $${FILE_PATH%.*}.json; \
source model2owl-venv/bin/activate; \
rdfpipe -i application/rdf+xml -o json-ld $${FILE_PATH} > $${FILE_PATH%.*}.json; \
echo Input in RDF/XML format; \
echo $${FILE_PATH}; \
echo " ==> Output in JSON-LD format"; \
Expand All @@ -153,7 +174,8 @@ convert-rdf-to-jsonld:
convert-rdf-to-rdf:
@for FILE_PATH in ${RDF_FILELIST}; do \
echo Converting $${FILE_PATH} into RDF/XML; \
${JENA_RIOT_TOOL} --output=rdfxml $${FILE_PATH} > $${FILE_PATH%.*}.rdf2; \
source model2owl-venv/bin/activate; \
rdfpipe -i application/rdf+xml -o application/rdf+xml $${FILE_PATH} > $${FILE_PATH%.*}.rdf2; \
mv -v $${FILE_PATH%.*}.rdf2 $${FILE_PATH%.*}.rdf; \
echo Input in RDF/XML format; \
ls -lh $${FILE_PATH}; \
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ _Transform a UML model into a formal OWL ontology, and a SHACL shape based on es

## About

This project comprises a set of tools for transforming an UML (v2.5) model from its XMI (v2.5.1) serialisation into a formal OWL ontology, and a SHACL shape. This approach is conformant to the [SEMIC Style Guide](https://OP-TED.github.io/style-guide/1.0.0/index.html) and with [eProcurement Ontology Architecture specification](https://github.com/meaningfy-ws/model2owl/blob/master/doc/ontology-architecture/ontology-architecture.pdf).
This project comprises a set of tools for transforming an UML (v2.5) model from its XMI (v2.5.1) serialisation into a formal OWL ontology, and a SHACL shape. This approach is conformant to the [SEMIC Style Guide](https://semiceu.github.io/style-guide/1.0.0/index.html) and with [eProcurement Ontology Architecture specification](https://github.com/meaningfy-ws/model2owl/blob/master/docs/ontology-architecture/ontology-architecture.pdf).

The UML transformation is performed using XSLT stylesheets under the assumption that the UML model conforms to the set of conventions outlined in the [EPO UML conventions documentation](https://meaningfy-ws.github.io/model2owl-docs/public-review/uml/conceptual-model-conventions.html). This set of UML conventions is an extension to the UML conventions specified in [SEMIC Style Guide](https://OP-TED.github.io/style-guide/1.0.0/index.html).
The UML transformation is performed using XSLT stylesheets under the assumption that the UML model conforms to the set of conventions outlined in the [EPO UML conventions documentation](https://meaningfy-ws.github.io/model2owl-docs/public-review/uml/conceptual-model-conventions.html). This set of UML conventions is an extension to the UML conventions specified in [SEMIC Style Guide](https://semiceu.github.io/style-guide/1.0.0/index.html).

The following capabilities are addressed:

Expand All @@ -32,7 +32,7 @@ The following capabilities are addressed:
This work is developed in the context of [eProcurement ontology project](https://github.com/eprocurementontology/eprocurementontology) financed by the Digital Europe Programme and led by the [Publications Office of the European Union](https://op.europa.eu/en/).

### Documents
* The **architectural design** and the formal specifications are provided in the [eProcurement Ontology Architecture specification](https://github.com/meaningfy-ws/model2owl/blob/master/doc/ontology-architecture/ontology-architecture.pdf).
* The **architectural design** and the formal specifications are provided in the [eProcurement Ontology Architecture specification](https://github.com/meaningfy-ws/model2owl/blob/master/docs/ontology-architecture/ontology-architecture.pdf).
* The technical **conventions** for the UML representation of the conceptual model are provided in [EPO UML conventions documentation](https://meaningfy-ws.github.io/model2owl-docs/public-review/uml/conceptual-model-conventions.html).
* An **inventory** of conformance tests derived from the UML conventions document are provided in the [EPO UML conventions checking specification](https://meaningfy-ws.github.io/model2owl-docs/public-review/checkers/model2owl-checkers.html).
* The **transformation rules** from UML into OWL and SHACL are provided in the [UML2OWL transformation rules](https://meaningfy-ws.github.io/model2owl-docs/public-review/transformation/uml2owl-transformation.html).
Expand All @@ -50,7 +50,7 @@ This work is developed in the context of [eProcurement ontology project](https:/
https://github.com/meaningfy-ws/model2owl/tree/master/test/unitTests/test-html-conventions-lib) is the location of the unit tests for the script checking the conformance to the technical conventions of the conceptual model are
* [test/unitTest/test-owl-core-lib](https://github.com/meaningfy-ws/model2owl/tree/master/test/unitTests/test-owl-core-lib) is the location of the unit tests for the transformation script for the core OWL ontology.
* [test/unitTest/test-shacl-shape-lib](https://github.com/meaningfy-ws/model2owl/tree/master/test/unitTests/test-shacl-shape-lib) is the location of the unit tests for the transformation script for the SHACL data shape constraints.
* [test/unitTest/reasoning-layer-lib](https://github.com/meaningfy-ws/model2owl/tree/master/test/unitTests/reasoning-layer-lib) is the location of the unit tests for the transformation script for the restrictions of OWL ontology (on classes and properties).
* [test/unitTest/test-reasoning-layer-lib](https://github.com/meaningfy-ws/model2owl/tree/master/test/unitTests/test-reasoning-layer-lib) is the location of the unit tests for the transformation script for the restrictions of OWL ontology (on classes and properties).

# How to use
This project can be used in 2 different ways as follows.
Expand Down
78 changes: 51 additions & 27 deletions src/html-conventions-lib/association-html-conventions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
</xsl:call-template>
<xsl:call-template name="connectorSourceTags">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
</xsl:call-template>
<xsl:call-template name="connectorTags">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
</xsl:call-template>
<xsl:call-template name="connectorGeneralNameProvided">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
Expand All @@ -98,41 +98,48 @@
</xsl:call-template>
<xsl:call-template name="connectorDirectionAndRolesOutOfSync">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
</xsl:call-template>

<!-- End of common connectors checkers rules -->

<!-- End of common connectors checkers rules -->
<!-- Start of specific checker rules-->
<xsl:if test="f:getConnectorDirection(.) = 'Bi-Directional'">

<xsl:call-template name="associationMissingSourceMultiplicity">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
<xsl:call-template name="associationInvalidSourceMultiplicityFormat">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
<xsl:call-template name="associationMissingSourceMultiplicity">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
<xsl:call-template name="associationInvalidSourceMultiplicityFormat">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="associationSourceTargetTypes">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
<xsl:call-template name="connectorUniqueName">
<xsl:with-param name="connector" select="."/>
</xsl:call-template>
</xsl:call-template>
<xsl:call-template name="connectorRoleCrossTypeReuseCheck">
<xsl:with-param name="connector" select="."/>
<xsl:with-param name="isDependency" select="fn:false()"/>
</xsl:call-template>
<!-- End of specific checker rules-->
</xsl:call-template>
<!-- End of specific checker rules-->
</xsl:if>
</xsl:variable>
<xsl:if test="boolean($associationChecks)">
<h2><xsl:value-of select="f:getConnectorName(.)"/></h2>
<dl>
<dt>
Unmet association conventions
</dt>
<xsl:copy-of select="$associationChecks"/>
</dl>
<xsl:choose>
<xsl:when test="$reportType = 'HTML'">
<h2>
<xsl:value-of select="f:getConnectorName(.)"/>
</h2>
<dl>
<dt> Unmet association conventions </dt>
<xsl:copy-of select="$associationChecks"/>
</dl>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$associationChecks"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>

Expand All @@ -148,8 +155,14 @@
<xsl:sequence
select="
if ($connector/source/type/not(@multiplicity)) then
f:generateHtmlError(fn:concat('The source role of ', f:getConnectorName($connector),
' has no multiplicity. Cardinality must be provided for each role.'))
f:generateErrorMessage(fn:concat('The source role of ', f:getConnectorName($connector),
' has no multiplicity. Cardinality must be provided for each role.'),
path($connector),
'association-multiplicity-1',
'CMC-R11',
'&lt;a href=&quot;https://semiceu.github.io/style-guide/1.0.0/gc-conceptual-model-conventions.html#sec:cmc-r11&quot; target=&quot;_blank&quot;&gt;CMC-R11&lt;/a&gt;
&lt;a href=&quot;https://semiceu.github.io/style-guide/1.0.0/gc-conceptual-model-conventions.html#sec:cmc-r12&quot; target=&quot;_blank&quot;&gt;CMC-R12&lt;/a&gt;'
)
else
()"
/>
Expand All @@ -171,8 +184,14 @@
if (fn:matches($multiplicityValue, '^[0-9]..[0-9]$') or fn:matches($multiplicityValue, '^[0-9]..\*$')) then
()
else
f:generateHtmlWarning(fn:concat('The connector ', f:getConnectorName($connector),
' has source multiplicity invalidly stated. Multiplicity must be specified in the form [min..max].'))
f:generateErrorMessage(fn:concat('The connector ', f:getConnectorName($connector),
' has source multiplicity invalidly stated. Multiplicity must be specified in the form [min..max].'),
path($connector),
'association-multiplicity-2',
'CMC-R11',
'&lt;a href=&quot;https://semiceu.github.io/style-guide/1.0.0/gc-conceptual-model-conventions.html#sec:cmc-r11&quot; target=&quot;_blank&quot;&gt;CMC-R11&lt;/a&gt;'
)
"
/>
</xsl:if>
Expand All @@ -181,7 +200,7 @@

<xd:doc>
<xd:desc>[association-source-target-types-3] - Associations can be
provided only between classes to classes and classes to objects..</xd:desc>
provided only between classes to classes and classes to objects.</xd:desc>
<xd:param name="connector"/>
</xd:doc>

Expand All @@ -194,7 +213,12 @@
if ($sourceType = 'Class' and $targetType = ('Class', 'Object')) then
()
else
f:generateHtmlError('Associations can be provided only between classes to classes and classes to objects.')"
f:generateErrorMessage('Associations can be provided only between classes to classes and classes to objects.',
path($connector),
'association-source-target-types-3',
'CMC-R12',
'&lt;a href=&quot;https://semiceu.github.io/style-guide/1.0.0/gc-conceptual-model-conventions.html#sec:cmc-r12&quot; target=&quot;_blank&quot;&gt;CMC-R12&lt;/a&gt;'
)"
/>
</xsl:template>

Expand Down
Loading

0 comments on commit d1eafd0

Please sign in to comment.