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

realisation rule and convention report config variables #172

Merged
merged 2 commits into from
Jul 18, 2023
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
1 change: 1 addition & 0 deletions src/common/selectors.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<xsl:apply-templates select="connector[./properties/@ea_type = 'Generalization']"/>
<xsl:apply-templates select="connector[./properties/@ea_type = 'Association']"/>
<xsl:apply-templates select="connector[./properties/@ea_type = 'Dependency']"/>
<xsl:apply-templates select="connector[./properties/@ea_type = 'Realisation']"/>
</xsl:template>

<xd:doc>
Expand Down
2 changes: 1 addition & 1 deletion src/html-conventions-lib/fragments/footer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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, 2020</p>
<p>&#169; <xsl:value-of select="$conventionReportCopyrightText"/></p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

Expand Down
17 changes: 8 additions & 9 deletions src/html-conventions-lib/fragments/introduction.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,34 @@
'[D01]/[M01]/[Y0001]')"/> ]</h2>
<!--<h2>[ <xsl:value-of select="tokenize(base-uri(.), '/')[last()]"/> ]</h2>-->

<!-- begin hardcoded author -->
<div class="authors col-span">
<div class="author">
<div>Publications Office of the European Union</div>
<div>Luxembourg</div>
<div><a href="https://op.europa.eu">https://op.europa.eu</a></div>
<div><xsl:value-of select="$conventionReportAuthor"/></div>
<div><xsl:value-of select="$conventionReportAuthorLocation"/></div>
<div><a href="{$conventionReportAuthorWebsite}"><xsl:value-of select="$conventionReportAuthorWebsite"/></a></div>
</div>
</div>
<!-- end hardcoded author -->

</header>
</xsl:template>

<xd:doc>
<xd:desc>The static abstract of teh report. This should act the introduction</xd:desc>
<xd:desc>The static abstract of the report. This should act the introduction</xd:desc>
</xd:doc>
<xsl:template name="abstract">
<div class="abstract counter-skip">
<h1>Abstract</h1>
<p>eProcurement UML model needs to conform to a set of UML conventions described
<p><xsl:value-of select="$conventionReportUMLModelName"/> UML model needs to conform to a set of UML conventions described
<a href="https://meaningfy-ws.github.io/model2owl-docs/public-review/uml/conceptual-model-conventions.html" target="_blank">elsewhere</a>. A conformance checking script was developed to execute tests to the UML
model and generate errors or warnings when encountered. </p>

<p>This document was automatically generated by the conformance checking script and
comprises the UML conformance violations.</p>

<p>The organisation of this document is based on major types of UML elements and
connectors that are employed in the eProcurement conceptual model. They are as
connectors that are employed in the <xsl:value-of select="$conventionReportUMLModelName"/> conceptual model. They are as
follows:
<em>Classes, Enumerations, Datatypes, Packages, Associations, Dependencies and
<em>Classes, Enumerations, Datatypes, Packages, Objects, Associations, Dependencies, Realisations and
Generalisations</em>. Each major section lists model items that need correction of errors
or consideration of warnings.</p>

Expand Down
2 changes: 1 addition & 1 deletion src/html-model-glossary/fragments/footer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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>
<p>&#169; <xsl:value-of select="$conventionReportCopyrightText"/></p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

Expand Down
40 changes: 39 additions & 1 deletion src/owl-core-lib/connectors-owl-core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@
</xd:doc>
<xsl:template match="connector[./properties/@ea_type = 'Dependency']"/>


<xd:doc>
<xd:desc>This will apply transformation rules to Realisations</xd:desc>
</xd:doc>
<xsl:template match="connector[./properties/@ea_type = 'Realisation']">
<xsl:if test="$generateObjectsAndRealisations">
<xsl:call-template name="classRealisation">
<xsl:with-param name="realisation" select="."/>
</xsl:call-template>
</xsl:if>
</xsl:template>


<xd:doc>
Expand Down Expand Up @@ -213,5 +222,34 @@

</xsl:if>
</xsl:template>

<xd:doc>
<xd:desc>Rule R.19. - Declare an individual with a specified class as its type,
for a UML Realization connector between a UML Object and a UML Class. </xd:desc>
<xd:param name="realisation"/>
</xd:doc>

<xsl:template name="classRealisation">
<xsl:param name="realisation" as="node()*"/>
<xsl:variable name="sourceRole" select="$realisation/source/model/@name"/>
<xsl:variable name="sourceRoleURI" select="f:buildURIfromLexicalQName($sourceRole)"/>
<xsl:variable name="targetRole" select="$realisation/target/model/@name"/>
<xsl:variable name="targetRoleURI" select="f:buildURIfromLexicalQName($targetRole)"/>
<xsl:choose>
<xsl:when test="$realisation/target/model/@type = 'Enumeration'">
<skos:Concept rdf:about = "{$sourceRoleURI}">
<skos:inScheme rdf:resource = "{$targetRoleURI}"/>
</skos:Concept>
</xsl:when>
<xsl:otherwise>
<owl:NamedIndividual rdf:about="{$sourceRoleURI}">
<rdf:type rdf:resource="{$targetRoleURI}"/>
</owl:NamedIndividual>
</xsl:otherwise>
</xsl:choose>



</xsl:template>

</xsl:stylesheet>
5 changes: 5 additions & 0 deletions src/reasoning-layer-lib/connectors-reasoning-layer.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@

</xsl:if>
</xsl:template>

<xd:doc>
<xd:desc>This will override the common selector when applying templates</xd:desc>
</xd:doc>
<xsl:template match="connector[./properties/@ea_type = 'Realisation']"/>

</xsl:stylesheet>

Expand Down
5 changes: 5 additions & 0 deletions src/shacl-shape-lib/connectors-shacl-shape.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@

</xsl:if>
</xsl:template>

<xd:doc>
<xd:desc>This will override the common selector when applying templates</xd:desc>
</xd:doc>
<xsl:template match="connector[./properties/@ea_type = 'Realisation']"/>


</xsl:stylesheet>
8 changes: 8 additions & 0 deletions test/ePO-default-config/config-parameters.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@


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

<xsl:variable name="conventionReportCopyrightText" select="'Publications Office of the European Union, 2023'"/>
<xsl:variable name="conventionReportAuthor" select="'Publications Office of the European Union'"/>
<xsl:variable name="conventionReportAuthorLocation" select="'Luxembourg'"/>
<xsl:variable name="conventionReportAuthorWebsite" select="'https://op.europa.eu'"/>
<xsl:variable name="conventionReportUMLModelName" select="'eProcurement'"/>

<!-- _______________________________________________________________________ -->
<!-- METADATA SECTION -->
<!-- _______________________________________________________________________ -->
Expand Down
2 changes: 1 addition & 1 deletion test/testData/ePO_core_with_tags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37210,7 +37210,7 @@
</connector>
<connector xmi:idref="EAID_48528BAE_46A8_4718_8763_FC7CE1AE3572">
<source xmi:idref="EAID_FD652F49_B5E1_4a29_B59C_B38E907B03B5">
<model ea_localid="1994" type="Object" name="result"/>
<model ea_localid="1994" type="Object" name="epo:result"/>
<role visibility="Public" targetScope="instance"/>
<type aggregation="none" containment="Unspecified"/>
<constraints/>
Expand Down
11 changes: 11 additions & 0 deletions test/unitTests/test-owl-core-lib/test-connectors-owl-core.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,16 @@
<x:expect label="result" test="boolean(/owl:Class)"/>
<x:expect label="result" test="boolean(/owl:Class/rdfs:subClassOf)"/>
</x:scenario>


<x:scenario
label="Scenario for testing class realisation">
<x:call template="classRealisation">
<x:param name="realisation" href="../../testData/ePO_core_with_tags.xml" select="/xmi:XMI/xmi:Extension[1]/connectors[1]/connector[433]"/>
</x:call>

<x:expect label="skos:Concept" test="boolean(/skos:Concept)"/>
<x:expect label="skos:inScheme" test="boolean(/skos:Concept/skos:inScheme)"/>
</x:scenario>

</x:description>