Skip to content

Commit

Permalink
Merge pull request #100 from OP-TED/feature/EPO-279
Browse files Browse the repository at this point in the history
model glossary
  • Loading branch information
costezki authored May 18, 2022
2 parents 6abeaf0 + a557690 commit 657490d
Show file tree
Hide file tree
Showing 6 changed files with 546 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/ePO-default/config-parameters.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,6 @@
<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:stylesheet>
71 changes: 67 additions & 4 deletions src/common/utils.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@
xs:anyURI(fn:concat(fn:namespace-uri-from-QName($qname), fn:local-name-from-QName($qname)))
else
xs:anyURI(fn:concat(fn:namespace-uri-from-QName($qname), $defaultDelimiter, fn:local-name-from-QName($qname)))
"/>
"
/>
</xsl:function>

<xd:doc>
Expand Down Expand Up @@ -269,7 +270,7 @@
$localName
"/>
<xsl:sequence
select="f:buildURIFromNode($attribute, fn:concat($prefix,':',$expandedLocalName), $isPascalCase, $isDefaultNamespaceContextualised)"
select="f:buildURIFromNode($attribute, fn:concat($prefix, ':', $expandedLocalName), $isPascalCase, $isDefaultNamespaceContextualised)"
/>
</xsl:function>

Expand Down Expand Up @@ -301,7 +302,8 @@
else
concat($defaultNamespacePrefix, ':', $elementName)"/>

<xsl:sequence select="f:buildURIfromLexicalQName($normalisedElementName, $isPascalCase, fn:true())"/>
<xsl:sequence
select="f:buildURIfromLexicalQName($normalisedElementName, $isPascalCase, fn:true())"/>
</xsl:function>


Expand Down Expand Up @@ -435,7 +437,7 @@
$attributeMultiplicityValue"
/>
</xsl:function>

<xd:doc>
<xd:desc>Check if connector target and source are in the model</xd:desc>
<xd:param name="connector"/>
Expand All @@ -454,4 +456,65 @@
/>
</xsl:function>

<xd:doc>
<xd:desc>Check if the connector is used to or from external classes</xd:desc>
<xd:param name="connectorName"/>
</xd:doc>

<xsl:function name="f:connector-to-or-from-external-class">
<xsl:param name="connectorName"/>
<xsl:param name="root"/>
<xsl:variable name="connectorElements" select="f:getConnectorByName($connectorName, $root)"/>
<xsl:choose>
<xsl:when test="fn:count($connectorElements) > 1">
<xsl:variable name="targetClasses"
select="
for $connector in $connectorElements
return
if (f:getElementByIdRef($connector/target/@xmi:idref, $root)/@name) then
fn:true()
else
fn:false()"/>
<xsl:variable name="sourceClasses"
select="
for $connector in $connectorElements
return
if (f:getElementByIdRef($connector/source/@xmi:idref, $root)/@name) then
fn:true()
else
fn:false()"/>
<xsl:variable name="externalTargetClasses"
select="
every $i in $targetClasses
satisfies $i = fn:false()"/>
<xsl:variable name="externalSourceClasses"
select="
every $i in $sourceClasses
satisfies $i = fn:false()"/>
<xsl:sequence
select="
if ($externalSourceClasses or $externalTargetClasses) then
fn:true()
else
fn:false()"/>

</xsl:when>
<xsl:otherwise>
<xsl:variable name="targetClass"
select="f:getElementByIdRef($connectorElements/target/@xmi:idref, $root)/@name"/>
<xsl:variable name="sourceClass"
select="f:getElementByIdRef($connectorElements/source/@xmi:idref, $root)/@name"/>
<xsl:sequence
select="
if ($targetClass and $sourceClass) then
fn:false()
else
fn:true()"
/>
</xsl:otherwise>
</xsl:choose>


</xsl:function>

</xsl:stylesheet>
65 changes: 65 additions & 0 deletions src/html-model-glossary.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<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: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://www.omg.org/spec/UML/20131001/UMLDC" xmlns:owl="http://www.w3.org/2002/07/owl#"
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">
<xsl:output method="html" indent="yes"/>



<xsl:import href="html-model-glossary/fragments/header.xsl"/>
<xsl:import href="html-model-glossary/fragments/footer.xsl"/>
<xsl:import href="html-model-glossary/glossary.xsl"/>


<xsl:template match="/">

<html lang="en">
<xsl:call-template name="head"/>
<xsl:choose>
<xsl:when
test="fn:namespace-uri(//*:Model) = 'http://www.omg.org/spec/UML/20131001' and
fn:namespace-uri(//*:XMI) = 'http://www.omg.org/spec/XMI/20131001'">
<body>
<main class="container-fluid">
<div id="toc" class="tocify">
<div class="text-center">
<p>
<strong>Table of contents</strong>
</p>
</div>
</div>
<div class="container">
<xsl:call-template name="glossary"/>
</div>
</main>
<xsl:call-template name="footer"/>
</body>
</xsl:when>
<xsl:otherwise>
<div class="alert alert-danger text-center">
<i class="fa fa-times-circle error" style="font-size: 60px;"/>
<h1 class="counter-skip">Wrong model version detected. </h1>
<br/>
<p>Please make sure that the XMI file uses XMI version 2.5.1 and UML version 2.5.1.</p>
<p>The namespaces to check:</p>
<ul>
<li>xmi="http://www.omg.org/spec/XMI/20131001"</li>
<li>uml="http://www.omg.org/spec/UML/20131001"</li>
</ul>
</div>
</xsl:otherwise>
</xsl:choose>
</html>
</xsl:template>
</xsl:stylesheet>


66 changes: 66 additions & 0 deletions src/html-model-glossary/fragments/footer.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
exclude-result-prefixes="xs math xd"
version="3.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> May 17, 2020</xd:p>
<xd:p><xd:b>Author:</xd:b> Dragos</xd:p>
<xd:p></xd:p>
</xd:desc>
</xd:doc>


<xsl:template name="footer">
<footer class="text-center">
<br/><br/>
<p> This document is generated automatically by the <a
href="https://github.com/costezki/model2owl" target="_blank">model2owl tool</a>
developed in the context of <a
href="https://joinup.ec.europa.eu/solution/eprocurement-ontology">the
eProcurement Ontology initiative</a>.</p>
<p>The template of this report is based on the <a
href="https://github.com/thomaspark/pubcss">PubCSS library</a>.</p>
<p>&#169; Publications Office of the European Union, 2022</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

<script src="static/js/jquery-3.4.1.min.js"></script>
<script src="static/js/jquery-ui.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/jquery.tocify.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.print.min.js"></script>

<script>
$(function () {
//Calls the tocify method on your HTML div.
$("#toc").tocify({
selectors: "h2",
theme: "bootstrap",
hashGenerator: "pretty",
ignoreSelector: ".skip-toc"
});
});

</script>
<script>
$(document).ready(function () {

$("table.display").DataTable({
buttons: [],
"lengthMenu": [[-1], ["All"]],
responsive: {
details: true
}
});

});
</script>
</xsl:template>

</xsl:stylesheet>
45 changes: 45 additions & 0 deletions src/html-model-glossary/fragments/header.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
exclude-result-prefixes="xs math xd"
version="3.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> May 17, 2022</xd:p>
<xd:p><xd:b>Author:</xd:b> Dragos</xd:p>
<xd:p></xd:p>
</xd:desc>
</xd:doc>

<xsl:template name="head">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta charset="utf-8"/>
<meta name="description" content="Model glossary"/>
<meta name="author" content="Publications Office of the European Union"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>

<link rel="stylesheet" href="static/css/jquery-ui.min.css"/>
<link rel="stylesheet" href="static/css/bootstrap.min.css"/>
<link rel="stylesheet" href="static/css/pubcss-acm-sig.css"/>
<!-- <link rel="stylesheet" media="screen" href="static/css/screen.css"/>
<link rel="stylesheet" media="print" href="static/css/print.css"/>-->
<link rel="stylesheet" href="static/css/toc_adjustments.css"/>
<link href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css" rel="stylesheet"/>

<link rel="shortcut icon" href=""/>
<style>
#toc {
font-size: 1.2em;
width: 10%;
}
@media print{@page {size: landscape}}

</style>
<title>Model glossary</title>
</head>
</xsl:template>

</xsl:stylesheet>
Loading

0 comments on commit 657490d

Please sign in to comment.