Skip to content

Commit

Permalink
Harvester / Simple URL / ODS / Improve mapping
Browse files Browse the repository at this point in the history
Follow up of #7059

* Add elements taking into account the API version 1 or 2
* Do not put free text in an ISO field which is an enumeration (which avoids to mix facet icons and translations for topic category)
  *  Provide a mapping based on default ODS values for french and english
  * Add a dedicated keyword block with the free text values
  • Loading branch information
fxprunayre committed Sep 9, 2024
1 parent 39838a9 commit c2a3f5f
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
xmlns:java-xsl-util="java:org.fao.geonet.util.XslUtil"
exclude-result-prefixes="#all">

<xsl:import href="protocol-mapping.xsl"></xsl:import>
<xsl:import href="protocol-mapping.xsl"/>
<xsl:import href="odstheme-mapping.xsl"/>

<xsl:output method="xml" indent="yes"/>

Expand Down Expand Up @@ -130,26 +131,30 @@
</cit:CI_Responsibility>
</mdb:contact>

<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="(metas/modified|dataset/metas/default/metadata_processed)[1]"/></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="codeListLocation#CI_DateTypeCode" codeListValue="publication"/>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="metas/metadata_processed"/></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="codeListLocation#CI_DateTypeCode" codeListValue="revision"/>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
<xsl:for-each select="metas/modified">
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="."/></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="codeListLocation#CI_DateTypeCode" codeListValue="publication"/>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
</xsl:for-each>
<xsl:for-each select="metas/metadata_processed|dataset/metas/default/metadata_processed">
<mdb:dateInfo>
<cit:CI_Date>
<cit:date>
<gco:DateTime><xsl:value-of select="."/></gco:DateTime>
</cit:date>
<cit:dateType>
<cit:CI_DateTypeCode codeList="codeListLocation#CI_DateTypeCode" codeListValue="revision"/>
</cit:dateType>
</cit:CI_Date>
</mdb:dateInfo>
</xsl:for-each>
<mdb:metadataStandard>
<cit:CI_Citation>
<cit:title>
Expand Down Expand Up @@ -264,15 +269,33 @@
</mri:pointOfContact>
</xsl:for-each>

<!-- ODS themes copied as topicCategory -->
<xsl:if test="metas/theme">
<xsl:for-each select="metas/theme">
<mri:topicCategory>
<mri:MD_TopicCategoryCode>
<xsl:value-of select="."/>
</mri:MD_TopicCategoryCode>
</mri:topicCategory>
</xsl:for-each>

<xsl:variable name="odsThemes"
select="metas/theme|dataset/metas/default/theme"/>
<xsl:if test="count($odsThemes) > 0">
<xsl:for-each select="distinct-values($odsThemeToIsoTopic[theme = $odsThemes]/name())">
<mri:topicCategory>
<mri:MD_TopicCategoryCode>
<xsl:value-of select="."/>
</mri:MD_TopicCategoryCode>
</mri:topicCategory>
</xsl:for-each>

<mri:descriptiveKeywords>
<mri:MD_Keywords>
<xsl:for-each select="$odsThemes">
<mri:keyword>
<gco:CharacterString>
<xsl:value-of select="."/>
</gco:CharacterString>
</mri:keyword>
</xsl:for-each>
<mri:type>
<mri:MD_KeywordTypeCode codeListValue="theme"
codeList="./resources/codeList.xml#MD_KeywordTypeCode"/>
</mri:type>
</mri:MD_Keywords>
</mri:descriptiveKeywords>
</xsl:if>

<!-- ODS keywords copied without type -->
Expand All @@ -292,6 +315,7 @@
</mri:descriptiveKeywords>
</xsl:if>


<!--
license_url: "http://opendatacommons.org/licenses/odbl/",
-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="#all">

<xsl:variable name="odsThemeToIsoTopic" as="node()*">
<health>
<theme>Santé</theme>
<theme>Health</theme>
</health>
<environment>
<theme>Environnement</theme>
<theme>Environment</theme>
</environment>
<transportation>
<theme>Transports, Déplacements</theme>
<theme>Transport, Movements</theme>
</transportation>
<structure>
<theme>Aménagement du territoire, Urbanisme, Bâtiments, Equipements, Habitat</theme>
<theme>Spatial planning, Town planning, Buildings, Equipment, Housing</theme>
</structure>
<economy>
<theme>Economie, Entreprise, PME, Développement économique, Emploi</theme>
<theme>Economy, Business, SME, Economic development, Employment</theme>
</economy>
<society>
<theme>Patrimoine culturel</theme>
<theme>Culture, Heritage</theme>
<theme>Education, Formation, Recherche, Enseignement</theme>
<theme>Education, Training, Research, Teaching</theme>
<theme>Administration, Gouvernement, Finances publiques, Citoyenneté</theme>
<theme>Administration, Government, Public finances, Citizenship</theme>
<theme>Justice, Sécurité, Police, Criminalité</theme>
<theme>Justice, Safety, Police, Crime</theme>
<theme>Sports, Loisirs</theme>
<theme>Sports, Leisure</theme>
<theme>Hébergement, industrie hôtelière</theme>
<theme>Accommodation, Hospitality Industry</theme>
<theme>Services sociaux</theme>
<theme>Services, Social</theme>
</society>
</xsl:variable>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -1,71 +1,64 @@
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
exclude-result-prefixes="#all">

<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:variable name="format-protocol-mapping">
<entry>
<format>csv</format>
<protocol>WWW:DOWNLOAD:text/csv</protocol>
</entry>
<entry>
<format>geojson</format>
<protocol>WWW:DOWNLOAD:application/vnd.geo+json</protocol>
</entry>
<entry>
<format>kml</format>
<protocol>WWW:DOWNLOAD:application/vnd.google-earth.kml+xml</protocol>
</entry>
<entry>
<format>zip</format>
<protocol>WWW:DOWNLOAD:application/zip</protocol>
</entry>
<entry>
<format>shapefile</format>
<format>shp</format>
<protocol>WWW:DOWNLOAD:x-gis/x-shapefile</protocol>
</entry>
<entry>
<format>json</format>
<protocol>WWW:DOWNLOAD:application/json</protocol>
</entry>
<entry>
<format>pdf</format>
<protocol>WWW:DOWNLOAD:application/pdf</protocol>
</entry>
<entry>
<format>xls</format>
<protocol>WWW:DOWNLOAD:application/vnd.ms-excel</protocol>
</entry>
<entry>
<format>xlsx</format>
<format>excel</format>
<protocol>WWW:DOWNLOAD:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</protocol>
</entry>
<entry>
<format>rtf</format>
<protocol>WWW:DOWNLOAD:application/rtf</protocol>
</entry>
<entry>
<format>web page</format>
<format>html</format>
<format>arcgis</format>
<protocol>WWW:LINK-1.0-http--link</protocol>
</entry>
<entry>
<format>wms</format>
<protocol>OGC:WMS</protocol>
</entry>
<entry>
<format>wfs</format>
<protocol>OGC:WFS</protocol>
</entry>
</xsl:variable>
<xsl:variable name="format-protocol-mapping">
<entry>
<format>csv</format>
<protocol>WWW:DOWNLOAD:text/csv</protocol>
</entry>
<entry>
<format>geojson</format>
<protocol>WWW:DOWNLOAD:application/vnd.geo+json</protocol>
</entry>
<entry>
<format>kml</format>
<protocol>WWW:DOWNLOAD:application/vnd.google-earth.kml+xml</protocol>
</entry>
<entry>
<format>zip</format>
<protocol>WWW:DOWNLOAD:application/zip</protocol>
</entry>
<entry>
<format>shapefile</format>
<format>shp</format>
<protocol>WWW:DOWNLOAD:x-gis/x-shapefile</protocol>
</entry>
<entry>
<format>json</format>
<protocol>WWW:DOWNLOAD:application/json</protocol>
</entry>
<entry>
<format>pdf</format>
<protocol>WWW:DOWNLOAD:application/pdf</protocol>
</entry>
<entry>
<format>xls</format>
<protocol>WWW:DOWNLOAD:application/vnd.ms-excel</protocol>
</entry>
<entry>
<format>xlsx</format>
<format>excel</format>
<protocol>WWW:DOWNLOAD:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</protocol>
</entry>
<entry>
<format>rtf</format>
<protocol>WWW:DOWNLOAD:application/rtf</protocol>
</entry>
<entry>
<format>web page</format>
<format>html</format>
<format>arcgis</format>
<protocol>WWW:LINK-1.0-http--link</protocol>
</entry>
<entry>
<format>wms</format>
<protocol>OGC:WMS</protocol>
</entry>
<entry>
<format>wfs</format>
<protocol>OGC:WFS</protocol>
</entry>
</xsl:variable>

</xsl:stylesheet>

0 comments on commit c2a3f5f

Please sign in to comment.