Skip to content

Commit

Permalink
Add themes from keywords as well
Browse files Browse the repository at this point in the history
  • Loading branch information
seitenbau-govdata authored and jvanzadelhoff committed Jul 17, 2020
1 parent a9f96b0 commit d4a0103
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/main/resources/dcat-themes.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http:https://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!-- refer to https://publications.europa.eu/en/web/eu-vocabularies/at-dataset/-/resource/dataset/data-theme/
The following names are extracted from data-theme-skos.rdf vocabulary. -->
<dcatThemes>
<dcatTheme name="AGRI"/>
<dcatTheme name="EDUC"/>
<dcatTheme name="ENVI"/>
<dcatTheme name="ENER"/>
<dcatTheme name="TRAN"/>
<dcatTheme name="TECH"/>
<dcatTheme name="ECON"/>
<dcatTheme name="SOCI"/>
<dcatTheme name="HEAL"/>
<dcatTheme name="GOVE"/>
<dcatTheme name="REGI"/>
<dcatTheme name="JUST"/>
<dcatTheme name="INTR"/>
</dcatThemes>
</rdf:RDF>
12 changes: 11 additions & 1 deletion src/main/resources/iso2dcat.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<xsl:variable name="ianaMediaTypes" select="document('iana-media-types.xml')"/>
<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="inspire_md_codelist">http:https://inspire.ec.europa.eu/metadata-codelist/</xsl:variable>

Expand Down Expand Up @@ -993,7 +994,16 @@
</xsl:template>

<xsl:template match="gmd:identificationInfo/*/gmd:descriptiveKeywords/*[not(gmd:thesaurusName)]/gmd:keyword/gco:CharacterString">
<xsl:call-template name="dcatKeyword"/>
<xsl:variable name="kwString" select="translate(text(),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
<xsl:variable name="listTheme" select="$dcatThemes/rdf:RDF/dcatThemes/dcatTheme[@name=$kwString]"/>
<xsl:choose>
<xsl:when test="$listTheme">
<dcat:theme rdf:resource="{concat('http:https://publications.europa.eu/resource/authority/data-theme/', $kwString)}"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="dcatKeyword"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="gmd:identificationInfo/*/gmd:descriptiveKeywords/*[starts-with(gmd:thesaurusName/gmd:CI_Citation/gmd:title/*, 'GEMET - INSPIRE themes')]/gmd:keyword[position() &gt; 1]/gco:CharacterString">
Expand Down

0 comments on commit d4a0103

Please sign in to comment.