Skip to content

Commit

Permalink
Add support for High-Value Datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
seitenbau-govdata authored and jvanzadelhoff committed Jun 27, 2024
1 parent 47b6f7f commit a6dd406
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/resources/hvd-categories.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!-- refer to http://data.europa.eu/bna/asd487ae75 -->
<hvdCategories>
<hvdCategory name="georaum" url="http://data.europa.eu/bna/c_ac64a52d"/>
<hvdCategory name="erdbeobachtung und umwelt" url="http://data.europa.eu/bna/c_dd313021"/>
<hvdCategory name="meteorologie" url="http://data.europa.eu/bna/c_164e0bf5"/>
<hvdCategory name="statistik" url="http://data.europa.eu/bna/c_e1da4e07"/>
<hvdCategory name="unternehmen und eigentümerschaft von unternehmen" url="http://data.europa.eu/bna/c_a9135398"/>
<hvdCategory name="mobilität" url="http://data.europa.eu/bna/c_b79e35eb"/>
</hvdCategories>
</rdf:RDF>
21 changes: 21 additions & 0 deletions src/main/resources/iso2dcat.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:dcatap="http://data.europa.eu/r5r/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
Expand Down Expand Up @@ -51,6 +52,7 @@
<xsl:variable name="languageCodes" select="document('languageCodes.rdf')"/>
<xsl:variable name="inspireThemes" select="document('themes.rdf')"/>
<xsl:variable name="dcatThemes" select="document('dcat-themes.rdf')"/>
<xsl:variable name="hvdCategories" select="document('hvd-categories.rdf')"/>

<xsl:variable name="inspire_md_codelist">http://inspire.ec.europa.eu/metadata-codelist/</xsl:variable>

Expand Down Expand Up @@ -165,6 +167,16 @@
<xsl:call-template name="dataDistribution"/>

<xsl:call-template name="dcatTheme"/>

<!--dcatap:applicableLegislation dcatap:hvdCategory-->
<xsl:variable name="hvdKeywords" select="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords[
(gmd:thesaurusName/gmd:CI_Citation/gmd:title/gco:CharacterString = 'High-value dataset categories' or
gmd:thesaurusName/gmd:CI_Citation/gmd:title/gmx:Anchor/@xlink:href = 'http://data.europa.eu/bna/asd487ae75') and
gmd:thesaurusName/gmd:CI_Citation/gmd:date/*[gmd:dateType/*/@codeListValue='publication']/gmd:date/*[text() castable as xs:date and xs:date(text()) >= xs:date('2023-09-27')]]"/>
<xsl:if test="$hvdKeywords">
<dcatap:applicableLegislation rdf:resource="http://data.europa.eu/eli/reg_impl/2023/138/oj"/>
<xsl:apply-templates select="$hvdKeywords" mode="hvd"/>
</xsl:if>
</dcat:Dataset>
</xsl:template>

Expand Down Expand Up @@ -1291,6 +1303,15 @@
</xsl:if>
</xsl:template>

<xsl:template match="gmd:identificationInfo/*/gmd:descriptiveKeywords/gmd:MD_Keywords" mode="hvd">
<xsl:variable name="hvdCategoryKeywords" select="gmd:keyword/gco:CharacterString/lower-case(text())"/>
<xsl:variable name="hvdCategoryUrls" select="gmd:keyword/gmx:Anchor/@xlink:href"/>
<xsl:for-each select="$hvdCategories/rdf:RDF/hvdCategories/hvdCategory[@name=$hvdCategoryKeywords or @url=$hvdCategoryUrls]">
<xsl:variable name="hvdUrlString" select="string(@url)"/>
<dcatap:hvdCategory rdf:resource="{$hvdUrlString}"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="gmd:language/*[@codeListValue]|gmd:language/gco:CharacterString">
<xsl:variable name="code">
<xsl:choose>
Expand Down

0 comments on commit a6dd406

Please sign in to comment.