Skip to content

Commit

Permalink
Formatter / EU-DCAT-AP / Improve shacl validation status - 1 format, …
Browse files Browse the repository at this point in the history
…1 accrualPeriodicity.
  • Loading branch information
fxprunayre committed Dec 14, 2023
1 parent eccaf59 commit 0fbd299
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@
Range: dcterms:MediaType
Usage note: This property to be used when the files in the distribution are packaged, e.g., in a TAR file, a ZIP file, a Frictionless Data Package or a Bagit file. The format SHOULD be expressed using a media type as defined by IANA [IANA-MEDIA-TYPES], if available.
See also: 6.8.18 Property: compression format.
Rule:
* Use mimetype if any
* Use WWW:DOWNLOAD:(.*=format) if any
* fallback to ancestor::mrd:MD_DigitalTransferOptions/mrd:distributionFormat/*/mrd:formatSpecificationCitation
-->
<xsl:choose>
<xsl:when test="$mimeType">
Expand All @@ -273,29 +278,22 @@
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="starts-with($protocol, 'WWW:DOWNLOAD:')">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="format" select="substring-after($protocol, 'WWW:DOWNLOAD:')"/>
</xsl:call-template>
</xsl:if>
<xsl:choose>
<xsl:when test="starts-with($protocol, 'WWW:DOWNLOAD:')">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="format" select="substring-after($protocol, 'WWW:DOWNLOAD:')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="iso19115-3-to-dcat-distribution"
select="ancestor::mrd:MD_DigitalTransferOptions/mrd:distributionFormat/*/mrd:formatSpecificationCitation"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

<xsl:for-each select="ancestor::mrd:MD_DigitalTransferOptions/mrd:distributionFormat/*">
<xsl:for-each select="mrd:formatSpecificationCitation/*/cit:title/*/text()">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="format" select="."/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="mrd:fileDecompressionTechnique/*/text()">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="elementName" select="'dcat:compressFormat'"/>
<xsl:with-param name="format" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>


<xsl:apply-templates mode="iso19115-3-to-dcat-distribution"
select="ancestor::mrd:MD_DigitalTransferOptions/mrd:distributionFormat/*/mrd:fileDecompressionTechnique"/>


<xsl:if test="$isCopyingDatasetInfoToDistribution">
Expand Down Expand Up @@ -370,6 +368,24 @@
</xsl:choose>
</xsl:template>


<xsl:template mode="iso19115-3-to-dcat-distribution"
match="mrd:distributionFormat/*/mrd:formatSpecificationCitation">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="format" select="*/cit:title/*/text()"/>
</xsl:call-template>
</xsl:template>


<xsl:template mode="iso19115-3-to-dcat-distribution"
match="mrd:distributionFormat/*/mrd:fileDecompressionTechnique">
<xsl:call-template name="rdf-format-as-mediatype">
<xsl:with-param name="elementName" select="'dcat:compressFormat'"/>
<xsl:with-param name="format" select="*/text()"/>
</xsl:call-template>
</xsl:template>


<xsl:template name="rdf-format-as-mediatype">
<xsl:param name="elementName" as="xs:string" select="'dct:format'"/>
<xsl:param name="format" as="xs:string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:mmi="http://standards.iso.org/iso/19115/-3/mmi/1.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:dcat="http://www.w3.org/ns/dcat#"
Expand Down Expand Up @@ -217,4 +218,12 @@
<dcat:theme rdf:resource="{.}"/>
</xsl:for-each>
</xsl:template>

<!--
sh:resultMessage "maxCount[1]: Invalid cardinality: expected max 1: Got count = 2" ;
sh:resultPath dc:accrualPeriodicity ;
-->
<xsl:template mode="iso19115-3-to-dcat"
match="mdb:identificationInfo/*/mri:resourceMaintenance/*/mmi:maintenanceAndUpdateFrequency[position() > 1]"/>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@
<rdfs:label>ESRI Shapefile (.shp)</rdfs:label>
</dct:MediaType>
</dct:format>
<dct:format>
<dct:MediaType rdf:about="https://publications.europa.eu/resource/authority/file-type/GPKG"/>
</dct:format>
<dcat:compressFormat>
<dct:MediaType rdf:about="https://publications.europa.eu/resource/authority/file-type/ZIP"/>
</dcat:compressFormat>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,6 @@
<dct:accrualPeriodicity>
<dct:Frequency rdf:about="http://publications.europa.eu/resource/authority/frequency/MONTHLY"/>
</dct:accrualPeriodicity>
<dct:accrualPeriodicity>
<dct:Frequency rdf:about="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#asNeeded"/>
</dct:accrualPeriodicity>
<dcat:distribution>
<dcat:Distribution>
<dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2023-12-08T00:00:00</dct:issued>
Expand All @@ -382,9 +379,6 @@
<rdfs:label>ESRI Shapefile (.shp)</rdfs:label>
</dct:MediaType>
</dct:format>
<dct:format>
<dct:MediaType rdf:about="https://publications.europa.eu/resource/authority/file-type/GPKG"/>
</dct:format>
<dcat:compressFormat>
<dct:MediaType rdf:about="https://publications.europa.eu/resource/authority/file-type/ZIP"/>
</dcat:compressFormat>
Expand Down

0 comments on commit 0fbd299

Please sign in to comment.