Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature epo 614 #117

Merged
merged 11 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ TSWLatexianTemp*
glossary
test/test-multi-xmi/combined
workspace.code-workspace
frameworks.zip
lib.zip
frameworks
lib
.ant-targets-build.xml
xspec
transform/*.jar
transform/doc
64 changes: 45 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,50 @@
#curBranch := $(shell git branch --show-current)
curBranch := $(shell git rev-parse --abbrev-ref HEAD)
export curBranch
# Number of file under .git repo (to test if the git repo was already cloned)
gitRepoFiles := $(shell ls -l transform/model2owl/.git >/dev/null 2>&1 | wc -l )
secrets.GITHUB_TOKEN := *******
# One of the xmi input file
FIRST_INPUT_XMI_FILE := "transform/model2owl/test/test-multi-xmi/ePO_CM.xml"
# Output directory containing combined file from multiple xmi / xml UML models
OUTPUT_COMBINED_XMI_PATH := "transform/output/combined-xmi/"
# Glossary output directory
OUTPUT_GLOSSARY_PATH := "transform/output/glossary/"
# download saxon library
get-saxon:
mkdir -p transform
cd transform && curl -L -o saxon.zip "https://kumisystems.dl.sourceforge.net/project/saxon/Saxon-HE/10/Java/SaxonHE10-6J.zip" && unzip saxon.zip && rm -rf saxon.zip

# Clone model2owl if the directory model2owl does not exist
get-model2owl-repo:
@mkdir -p transform
@cd transform && git clone https://github.com/OP-TED/model2owl.git

# download xspec framework to run unit tests
get-xspec:
cd transform && rm -rf xspec && curl -L -o xspec.zip https://github.com/xspec/xspec/archive/refs/tags/v2.2.4.zip && unzip xspec.zip -d model2owl && rm -rf xspec.zip && cd model2owl && ln -s xspec-* xspec

list:
ls -l
install:
echo Your current branch is: ${curBranch}
git checkout utilities -- frameworks.zip lib.zip
cp frameworks.zip /tmp/
cp lib.zip /tmp/
git checkout ${curBranch}
# Initialize the project, download model2owl repo, install saxon and dependencies
init: get-saxon get-model2owl-repo get-xspec

# Run unit_tests
unit-tests:
@cd transform/model2owl && ant -lib ../saxon-he-10.6.jar unit_tests

# Unzip
unzip /tmp/frameworks.zip -d .
unzip /tmp/lib.zip -d .
# Combine xmi UML files
merge-xmi:
@mkdir -p transform/output/combined-xmi/
@java -jar transform/saxon-he-10.6.jar -s:${FIRST_INPUT_XMI_FILE} -xsl:transform/model2owl/src/xml/merge-multi-xmi.xsl -o:${OUTPUT_COMBINED_XMI_PATH}/ePO-combined.xml
@echo The combined document is located at "${OUTPUT_COMBINED_XMI_PATH}/ePO-combined.xml"
@ls -lh ${OUTPUT_COMBINED_XMI_PATH}/ePO-combined.xml

# Clean up
rm -rf /tmp/frameworks.zip
rm -rf /tmp/lib.zip
git rm -rf frameworks.zip
git rm -rf lib.zip
tests:
ant -lib lib/saxon*.jar unit_tests
# Generate the glossary
generate-glossary:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@mkdir -p "${OUTPUT_GLOSSARY_PATH}"
@java -jar transform/saxon-he-10.6.jar -s:${OUTPUT_COMBINED_XMI_PATH}/ePO-combined.xml -xsl:transform/model2owl/src/html-model-glossary.xsl -o:${OUTPUT_GLOSSARY_PATH}/glossary.html
@echo The combined glossary is located at ${OUTPUT_GLOSSARY_PATH}/glossary.html
@echo
@ls -lh ${OUTPUT_GLOSSARY_PATH}/glossary.html
@echo
@head ${OUTPUT_GLOSSARY_PATH}/glossary.html
@echo ...
@tail ${OUTPUT_GLOSSARY_PATH}/glossary.html
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ The input eProcurement conceptual model is available in the [eProcurement Ontolo

We assume that the users of this project are familiar with XML, UML and XSLT technologies and know how to perform an XSLT transformation.

## Combine multiple XMI / XML UML documents
make merge-xmi

This will merge multiple input XMI / XML UML documents into a single one. The output is located under ./output/combined-xmi/ and will be used to generate a single glossary.

## Generate the glossary from the merged document
make generate-glossary

The glossary will generated and located in the ./output/glossary/

## Repository Structure

* /src - source code of the XSLT scripts generating the HTML conventions report.
Expand Down
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Run unit tests
</description>
<property name="xspec.properties" location="system.properties" />
<property name="xspec.project.dir" location="frameworks/xspec" />
<property name="xspec.project.dir" location="xspec" />
<property name="lib.dir" location="${basedir}/lib" />

<include file="${basedir}/frameworks/xspec/build.xml" />
<include file="${basedir}/xspec/build.xml" />

<!-- include foreach -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
Expand Down
47 changes: 16 additions & 31 deletions config/ePO-default/config-parameters.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:fn="http://www.w3.org/2005/xpath-functions"
exclude-result-prefixes="xs math xd xsl uml xmi umldi dc fn"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:functx="http://www.functx.com"
exclude-result-prefixes="xs math xd xsl uml xmi umldi dc fn"
xmlns:uml="http://www.omg.org/spec/UML/20131001"
xmlns:xmi="http://www.omg.org/spec/XMI/20131001"
xmlns:umldi="http://www.omg.org/spec/UML/20131001/UMLDI"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:functx="http://www.functx.com"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dct="http://purl.org/dc/terms/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#" version="3.0">
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
version="3.0">

<xd:doc scope="stylesheet">
<xd:desc>
Expand All @@ -21,6 +25,9 @@
</xd:desc>
</xd:doc>

<!-- some advanced xpath functions -->
<xsl:import href="../../src/common/functx-1.0.1-doc.xsl"/>

<!-- a set of prefix-baseURI definitions -->
<xsl:variable name="namespacePrefixes" select="fn:doc('namespaces.xml')"/>

Expand Down Expand Up @@ -81,35 +88,13 @@
<xsl:variable name="restrictionsModuleURI" select="$base-rule-uri"/>
<!-- Core Module URI-->
<xsl:variable name="coreModuleURI" select="$base-ontology-uri"/>
<!-- title and description for each ontology module-->
<xsl:variable name="title-shape-module">eProcurement datashapes</xsl:variable>
<xsl:variable name="description-shape-module">This module provides the datashape definitions for the eProcurement ontology.</xsl:variable>

<xsl:variable name="title-core-module">eProcurement core ontology</xsl:variable>
<xsl:variable name="description-core-module">
This module provides the definitions for the core eProcurement ontology.

Procurement data has been identified as data with a
high-reuse potential. Given the increasing importance of data standards for
eProcurement, a number of initiatives driven by the public sector, the industry and
academia have been kick-started in recent years. Some have grown organically, while
others are the result of standardisation work. The vocabularies and the semantics that
they are introducing, the phases of public procurement that they are covering, and the
technologies that they are using all differ. These differences hamper data
interoperability and thus its reuse by them or by the wider public. This creates the
need for a common data standard for publishing procurement data, hence allowing data
from different sources to be easily accessed and linked, and consequently
reused.</xsl:variable>

<xsl:variable name="title-restriction-module">eProcurement extended ontology</xsl:variable>
<xsl:variable name="description-restriction-module">This module provides the inference-related definitions for
the eProcurement ontology.</xsl:variable>

<xsl:variable name="reference-to-external-classes-in-glossary" select="fn:false()"/>

<xsl:variable name="license-core-module" select="'http://creativecommons.org/licenses/by-sa/4.0/'"/>

<!-- The metadata.xml is used to define the metadata for each input xmi file -->
<xsl:variable name="metadata" select="document(concat(base-uri(),'/../','metadata.xml'))" />
<!-- The metadata.xml is used to define the metadata for each input xmi file. The metadata.xml is found next to the input file. -->
<xsl:variable name="metadata" select="document(concat(functx:substring-before-last(base-uri(), '/'), '/', 'metadata.xml'))" />
<!-- ontology title, version to be inserted in the ontology header below -->
<xsl:variable name="ontologyTitle" select="$metadata//title"/>
<xsl:variable name="ontologyVersion" select="$metadata//version"/>
Expand Down
8 changes: 5 additions & 3 deletions config/ePO-default/namespaces.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
<prefix name="skos" value="http://www.w3.org/2004/02/skos/core#"/>

<prefix name="epo" value="http://data.europa.eu/a4g/ontology#"/>
<prefix name="epo-not" value="http://data.europa.eu/a4g/ontology#"/>
<prefix name="epo-cat" value="http://data.europa.eu/a4g/ontology#"/>
<prefix name="epo-ord" value="http://data.europa.eu/a4g/ontology#"/>
<prefix name="epo-not" value="http://data.europa.eu/a4g/ontology#"/>
<prefix name="epo-ful" value="http://data.europa.eu/a4g/ontology#"/>

<prefix name="nuts" value="http://data.europa.eu/nuts/"/>
<prefix name="reg2015" value="http://data.europa.eu/a4g/extension/ontology#"/>
<prefix name="espd" value="https://github.com/ESPD/ESPD-EDM/"/>
Expand All @@ -29,8 +32,7 @@
<prefix name="cpov" value="http://data.europa.eu/m8g/"/>
<prefix name="cccev" value="http://data.europa.eu/m8g/"/>
<prefix name="geosparql" value="http://www.opengis.net/ont/geosparql#"/>
<prefix name="dul" value="http://www.loa-cnr.it/ontologies/DUL.owl#"/>

<prefix name="dul" value="http://www.loa-cnr.it/ontologies/DUL.owl#"/>
<prefix name="person" value="http://www.w3.org/ns/person#"/>

</prefixes>
21 changes: 21 additions & 0 deletions config/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="windows-1252"?>
<metadata>
<title>eProcurement core ontology</title>
<!-- Ontology version -->
<version>3.0.1</version>
<!-- Description for the CORE module -->
<description>
This module provides the definitions for the core eProcurement ontology.
Procurement data has been identified as data with a high-reuse potential.
Given the increasing importance of data standards for eProcurement, a number of initiatives
driven by the public sector, the industry and academia have been kick-started in recent years.
Some have grown organically, while others are the result of standardisation work.
The vocabularies and the semantics that they are introducing, the phases of public procurement that they are covering,
and the technologies that they are using all differ. These differences hamper data interoperability and thus its reuse by them or by the wider public.
This creates the need for a common data standard for publishing procurement data, hence allowing data
from different sources to be easily accessed and linked, and consequently reused.
</description>
<!-- default imports for each module -->
<imports resource="http://purl.org/dc/terms/"/>
<imports resource="http://www.w3.org/2004/02/skos/core"/>
</metadata>
8 changes: 6 additions & 2 deletions src/reasoning-layer-lib/connectors-reasoning-layer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@


<xd:doc>
<xd:desc>Rule 12 (Association source in reasnoning layer) .Specify object property domain
<xd:desc>Rule 12 (Association source in reasnoning layer). Specify object property domain
for the target end of the association.</xd:desc>
<xd:param name="connectorName"/>
<xd:param name="root"/>
Expand All @@ -114,8 +114,12 @@
<xsl:variable name="targetRoleURI"
select="f:buildURIfromLexicalQName($targetRole, fn:false(), fn:true())"/>
<!-- This will filter out all Dependencies that are from a Class to an Enumeration-->
<xsl:variable name="filteredConnectorsWithSameName"
<!--<xsl:variable name="filteredConnectorsWithSameName"
select="$connectorsWithSameName[not(./properties/@ea_type = 'Dependency' and ./source/model/@type = 'Class' and ./target/model/@type = 'Enumeration')]"
/>-->
<!-- We need to provide Domain for Dependencies relations also (cf. EPO-620)-->
<xsl:variable name="filteredConnectorsWithSameName"
select="$connectorsWithSameName"
/>

<xsl:if test="fn:count($filteredConnectorsWithSameName) = 1">
Expand Down
22 changes: 14 additions & 8 deletions src/xml/merge-multi-xmi.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:functx="http://www.functx.com"
exclude-result-prefixes="xs math xd xsl uml xmi umldi dc fn"
xmlns:uml="http://www.omg.org/spec/UML/20131001"
xmlns:xmi="http://www.omg.org/spec/XMI/20131001"
xmlns:umldi="http://www.omg.org/spec/UML/20131001/UMLDI"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dct="http://purl.org/dc/terms/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#" version="3.0">
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
version="3.0">

<xsl:output version="1.0" encoding="windows-1252" indent="yes" />

<xsl:import href="../../config/config-proxy.xsl"/>

<!-- List of xmi files to be merged into a single xmi file-->
<xsl:variable name="xmiFileList" select="collection('../../test/test-multi-xmi?select=*.xml')"/>
<!-- List of xmi/xml UML files to be merged into a single file -->
<!--<xsl:import href="../../src/common/functx-1.0.1-doc.xsl"/>-->
<xsl:variable name="inputFolder" select="functx:substring-before-last(base-uri(), '/')"/>
<xsl:variable name="xmiFileList" select="collection(concat($inputFolder, '/', '?select=*.xml'))"/>

<xsl:template match="/">

Expand All @@ -27,7 +33,7 @@
<!-- Merge elements under uml:Model -->
<uml:Model xmi:type="uml:Model" name="EA_Model">
<xsl:for-each select="$xmiFileList" >
<xsl:variable name="doc" select="document(document-uri(.))" />
<xsl:variable name="doc" select="." />
<xsl:copy-of select="$doc//uml:Model/packagedElement"></xsl:copy-of>
<xsl:copy-of select="$doc//uml:Model/umldi:Diagram"></xsl:copy-of>
<xsl:copy-of select="$doc//uml:Model/profileApplication"></xsl:copy-of>
Expand All @@ -36,7 +42,7 @@
<!-- Merge elements under xmi:Extension -->
<xmi:Extension extender="Enterprise Architect" extenderID="6.5">
<xsl:for-each select="$xmiFileList" >
<xsl:variable name="doc" select="document(document-uri(.))" />
<xsl:variable name="doc" select="." />
<xsl:copy-of select="$doc//xmi:XMI/xmi:Extension/elements"></xsl:copy-of>
<xsl:copy-of select="$doc//xmi:XMI/xmi:Extension/connectors"></xsl:copy-of>
<xsl:copy-of select="$doc//xmi:XMI/xmi:Extension/primitivetypes/profiles"></xsl:copy-of>
Expand All @@ -46,7 +52,7 @@

<!-- Merge other elements-->
<xsl:for-each select="$xmiFileList" >
<xsl:variable name="doc" select="document(document-uri(.))" />
<xsl:variable name="doc" select="." />
<xsl:copy-of select="$doc//thecustomprofile:subproperty"></xsl:copy-of>
<xsl:copy-of select="$doc//thecustomprofile:disjoint"></xsl:copy-of>
<xsl:copy-of select="$doc//thecustomprofile:extends"></xsl:copy-of>
Expand Down
21 changes: 21 additions & 0 deletions test/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="windows-1252"?>
<metadata>
<title>eProcurement core ontology</title>
<!-- Ontology version -->
<version>3.0.1</version>
<!-- Description for the CORE module -->
<description>
This module provides the definitions for the core eProcurement ontology.
Procurement data has been identified as data with a high-reuse potential.
Given the increasing importance of data standards for eProcurement, a number of initiatives
driven by the public sector, the industry and academia have been kick-started in recent years.
Some have grown organically, while others are the result of standardisation work.
The vocabularies and the semantics that they are introducing, the phases of public procurement that they are covering,
and the technologies that they are using all differ. These differences hamper data interoperability and thus its reuse by them or by the wider public.
This creates the need for a common data standard for publishing procurement data, hence allowing data
from different sources to be easily accessed and linked, and consequently reused.
</description>
<!-- default imports for each module -->
<imports resource="http://purl.org/dc/terms/"/>
<imports resource="http://www.w3.org/2004/02/skos/core"/>
</metadata>
Loading