Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos0000 committed Feb 3, 2025
1 parent 1bec53b commit c84e671
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/owl-core-lib/descriptors-owl-core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<xsl:param name="tagName"/>
<xsl:param name="tagValue"/>
<xsl:param name="elementUri"/>
<xsl:if test="not($tagName = ($statusProperty, $cvConstraintLevelProperty))">
<xsl:if test="not($tagName = $excludedTagNamesList)">
<rdf:Description rdf:about="{$elementUri}">
<xsl:choose>
<xsl:when test="fn:contains($tagName, '@')">
Expand Down
25 changes: 9 additions & 16 deletions src/shacl-shape-lib/elements-shacl-shape.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,8 @@
<!-- Get the enumeration's compact URI -->
<xsl:variable name="enumerationCompactURI" select="$enumeration/@name"/>

<!-- Retrieve all attributes -->
<xsl:variable name="enumerationItems" select="$enumeration/attributes/attribute"/>

<!-- Ensure there are more than one attribute before processing -->
<xsl:if test="count($enumerationItems) > 0 and $enumerationCompactURI and $enableGenerationOfConceptSchemes">
<xsl:for-each select="$enumerationItems">
<xsl:variable name="enumerationItemCompactURI" select="./@name"/>
<xsl:variable name="shapeURI" select="f:buildPropertyShapeURI($enumerationCompactURI, $enumerationItemCompactURI)"/>
<xsl:if test="$enumerationCompactURI and $enableGenerationOfConceptSchemes">
<xsl:variable name="shapeURI" select="f:buildPropertyShapeURI($enumerationCompactURI, 'itemShape')"/>
<xsl:variable name="inSchemeURI" select="f:buildURIfromLexicalQName($enumerationCompactURI)"/>

<rdf:Description rdf:about="{$shapeURI}">
Expand All @@ -399,7 +393,6 @@
<sh:hasValue rdf:resource="{$inSchemeURI}"/>
</sh:property>
</rdf:Description>
</xsl:for-each>
</xsl:if>
</xsl:template>

Expand Down Expand Up @@ -433,16 +426,16 @@
else 'permissive'
"/>

<!-- Retrieve all attributes and dependency IDs -->
<xsl:variable name="enumerationItems" select="$enumeration/attributes/attribute"/>
<!-- Retrieve all dependency IDs -->

<xsl:variable name="dependenciesIds" select="$enumeration/links/Dependency/@xmi:id"/>

<!-- Generate RDF descriptions based on the constraint level -->
<xsl:choose>
<xsl:when test="$enumerationConstraintLevel = 'restrictive' and fn:count($enumerationItems) > 0 and $enableGenerationOfConceptSchemes">
<!-- Iterate over enumeration items and dependencies -->
<xsl:for-each select="$enumerationItems">
<xsl:variable name="nodeUri" select="f:buildPropertyShapeURI($enumerationCompactURI, ./@name)"/>
<xsl:when test="$enumerationConstraintLevel = 'restrictive' and $enableGenerationOfConceptSchemes">
<!-- Iterate over dependencies -->

<xsl:variable name="nodeUri" select="f:buildPropertyShapeURI($enumerationCompactURI, 'itemShape')"/>
<xsl:for-each select="$dependenciesIds">
<xsl:variable name="dependencyConnector" select="f:getConnectorByIdRef(., $root)"/>
<xsl:variable name="dependencyName" select="$dependencyConnector/target/role/@name"/>
Expand All @@ -456,7 +449,7 @@
<sh:node rdf:resource="{$nodeUri}"/>
</rdf:Description>
</xsl:for-each>
</xsl:for-each>

</xsl:when>
<xsl:when test="$enumerationConstraintLevel = 'permissive' and $enableGenerationOfSkosConcept">
<!-- Generate shapes for permissive or default cases -->
Expand Down
3 changes: 3 additions & 0 deletions test/ePO-default-config/config-parameters.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
<xsl:variable name="commentsGeneration" select="fn:true()"/>
<xsl:variable name="commentProperty" select="'skos:editorialNote'"/>

<!-- Tag names/keys that are excluded from output -->
<xsl:variable name="excludedTagNamesList" select="($statusProperty, $cvConstraintLevelProperty)"/>

<!-- Variables for status filtering -->
<xsl:variable name="statusProperty" select="'epo:status'"/>
<xsl:variable name="validStatusesList" select="('proposed', 'approved', 'implemented')"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,24 @@
<x:call template="enumerationItem">
<x:param name="enumeration" href="../../testData/ePO-core-4.2.0.xml" select="/xmi:XMI/xmi:Extension[1]/elements[1]/element[244]"/>
</x:call>
<x:expect label="there is a rdf:Description for each item" test="count(rdf:Description) = 3 "/>
<x:expect label="there is a rdf:Description " test="count(rdf:Description) = 1 "/>
<x:expect label="there is a rdf:type" test="boolean(rdf:Description/rdf:type)"/>
<x:expect label="there is sh:property" test="boolean(rdf:Description/sh:property)"/>
<x:expect label="there is sh:path" test="boolean(rdf:Description/sh:property/sh:path)"/>
<x:expect label="there is sh:hasValue" test="boolean(rdf:Description/sh:property/sh:hasValue)"/>
<x:expect label="there is correct value for sh:hasValue resource" test="rdf:Description[1]/sh:property/sh:hasValue/@rdf:resource = 'http://publications.europa.eu/resource/authority/accessibility'"/>
<x:expect label="there is correct value for sh:hasValue resource" test="rdf:Description/sh:property/sh:hasValue/@rdf:resource = 'http://publications.europa.eu/resource/authority/accessibility'"/>
</x:scenario>
<x:scenario label="enumeration without items">
<x:call template="enumerationItem">
<x:param name="enumeration" href="../../testData/ePO-core-4.2.0.xml" select="/xmi:XMI/xmi:Extension[1]/elements[1]/element[243]"/>
</x:call>
<x:expect label="there is no output" select="()"/>
<x:expect label="there is a rdf:Description " test="count(rdf:Description) = 1 "/>
<x:expect label="there is correct value for rdf:about " test="rdf:Description/@rdf:about = 'http://data.europa.eu/a4g/data-shape#at-voc-access-rights-itemShape' "/>
<x:expect label="there is a rdf:type" test="boolean(rdf:Description/rdf:type)"/>
<x:expect label="there is sh:property" test="boolean(rdf:Description/sh:property)"/>
<x:expect label="there is sh:path" test="boolean(rdf:Description/sh:property/sh:path)"/>
<x:expect label="there is sh:hasValue" test="boolean(rdf:Description/sh:property/sh:hasValue)"/>
<x:expect label="there is correct value for sh:hasValue resource" test="rdf:Description/sh:property/sh:hasValue/@rdf:resource = 'http://publications.europa.eu/resource/authority/access-rights'"/>
</x:scenario>

</x:scenario>
Expand Down Expand Up @@ -207,11 +213,11 @@
<x:call template="enumerationDependencyRangeShape">
<x:param name="enumeration" href="../../testData/ePO-core-4.2.0.xml" select="/xmi:XMI/xmi:Extension[1]/elements[1]/element[250]"/>
</x:call>
<x:expect label="there is a rdf:Description for each item" test="count(rdf:Description) = 8"/>
<x:expect label="there is a rdf:Description for each dependency" test="count(rdf:Description) = 2"/>
<x:expect label="there is a rdf:type" test="boolean(rdf:Description/rdf:type)"/>
<x:expect label="there is sh:node" test="boolean(rdf:Description/sh:node)"/>
<x:expect label="there is sh:path" test="boolean(rdf:Description/sh:path)"/>
<x:expect label="there is correct value for sh:node resource" test="rdf:Description[1]/sh:node/@rdf:resource = 'http://data.europa.eu/a4g/data-shape#at-voc-contract-nature-supplies'"/>
<x:expect label="there is correct value for sh:node resource" test="rdf:Description[1]/sh:node/@rdf:resource = 'http://data.europa.eu/a4g/data-shape#at-voc-contract-nature-itemShape'"/>
<x:expect label="there is correct value for sh:path resource" test="rdf:Description[1]/sh:path/@rdf:resource = 'http://data.europa.eu/a4g/ontology#hasContractNatureType'"/>
<x:expect label="there is correct value for rdf:type resource" test="rdf:Description[1]/rdf:type/@rdf:resource = 'http://www.w3.org/ns/shacl#PropertyShape'"/>
</x:scenario>
Expand Down Expand Up @@ -241,7 +247,13 @@
href="../../testData/ePO-core-4.2.0.xml"
select="/xmi:XMI/xmi:Extension[1]/elements[1]/element[280]"/>
</x:call>
<x:expect label="no output" select="()"/>
<x:expect label="there is a rdf:Description for each dependency" test="count(rdf:Description) = 4"/>
<x:expect label="there is a rdf:type" test="boolean(rdf:Description/rdf:type)"/>
<x:expect label="there is sh:node" test="boolean(rdf:Description/sh:node)"/>
<x:expect label="there is sh:path" test="boolean(rdf:Description/sh:path)"/>
<x:expect label="there is correct value for sh:node resource" test="rdf:Description[1]/sh:node/@rdf:resource = 'http://data.europa.eu/a4g/data-shape#at-voc-permission-itemShape'"/>
<x:expect label="there is correct value for sh:path resource" test="rdf:Description[1]/sh:path/@rdf:resource = 'http://data.europa.eu/a4g/ontology#hasVariantPermission'"/>
<x:expect label="there is correct value for rdf:type resource" test="rdf:Description[1]/rdf:type/@rdf:resource = 'http://www.w3.org/ns/shacl#PropertyShape'"/>
</x:scenario>

</x:scenario>
Expand Down

0 comments on commit c84e671

Please sign in to comment.