Skip to content

Commit

Permalink
Update to GEMET 4.1.2 and remove INSPIRE related thesaurus which are …
Browse files Browse the repository at this point in the history
…now available through the INSPIRE Registry.
  • Loading branch information
fxprunayre committed Jan 11, 2019
1 parent b145c8d commit 74409eb
Show file tree
Hide file tree
Showing 14 changed files with 139,911 additions and 14,918 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ format usable in GeoNetwork opensource.

## Scripts

2 scripts are provided:
* GEMET thesaurus conversion https://www.eionet.europa.eu/gemet/
* INSPIRE themes conversion
A script is provided to convert GEMET thesaurus https://www.eionet.europa.eu/gemet/


Use the following to generate a GEMET SKOS file with many languages:
```
Expand All @@ -20,7 +19,9 @@ Note: Update GEONETWORK_HOME variable before running any scripts.
## Thesaurus

Some thesaurus are already available in the [thesauri](thesauri) folder:
* GEMET - Concepts, version 3.1, 2012-07-20 (Generated 2016-04-01)
* INSPIRE Themes
* GEMET - Concepts, version 4.1.2


**For INSPIRE related thesaurus**, use the import from Registry function in the admin console > Classification system.


2 changes: 1 addition & 1 deletion gemet-to-simpleskos.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
export GEONETWORK_HOME=../develop/web/target/geonetwork
export GEONETWORK_HOME=../dev/web/target/geonetwork
export CLASSPATH=.:$GEONETWORK_HOME/WEB-INF/lib/saxon-9.1.0.8b-patch.jar

if [ $1 ]
Expand Down
135 changes: 97 additions & 38 deletions gemet-to-simpleskos.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
<xsl:variable name="maxStringLength" select="254"/>
<xsl:variable select="document('locales.xml')" name="locales"/>
<xsl:variable select="document('gemet-skoscore.rdf')" name="skoscore"/>
<xsl:variable name="root" select="/"/>


<!-- Disabled by default as the thesaurus would be too big-->
<xsl:variable name="withGroup" select="false()"/>

<xsl:variable name="withThemes" select="true()"/>

<!-- Concept, group and supergroup descriptions -->
<xsl:variable name="lang">
<lang>
Expand All @@ -37,17 +42,16 @@
<!-- Scheme -->
<skos:ConceptScheme rdf:about="http://geonetwork-opensource.org/gemet">
<dc:title>GEMET</dc:title>
<dc:description>GEMET thesaurus for GeoNetwork opensource.
</dc:description>
<dc:description>GEMET version 4.1.2 thesaurus for GeoNetwork opensource.</dc:description>
<dc:creator>
<foaf:Organization>
<foaf:name>EEA</foaf:name>
</foaf:Organization>
</dc:creator>
<dc:uri>http://www.eionet.europa.eu/gemet/about?langcode=en</dc:uri>
<dc:rights>http://www.eionet.europa.eu/gemet/about?langcode=en</dc:rights>
<dcterms:issued>2012-07-20</dcterms:issued>
<dcterms:modified>2012-07-20</dcterms:modified>
<dc:uri>https://www.eionet.europa.eu/gemet/about?langcode=en</dc:uri>
<dc:rights>https://www.eionet.europa.eu/gemet/about?langcode=en</dc:rights>
<dcterms:issued>2018-08-16</dcterms:issued>
<dcterms:modified>2018-08-16</dcterms:modified>

<xsl:comment>Generated <xsl:value-of select="current-dateTime()"/>.
</xsl:comment>
Expand All @@ -56,12 +60,29 @@

<xsl:choose>
<xsl:when test="$withGroup">
<xsl:for-each
select="//skos:Collection[matches(@rdf:about, 'supergroup/[0-9]+$')]">
<skos:hasTopConcept
rdf:resource="http://www.eionet.europa.eu/gemet/supergroups"/>

<xsl:for-each-group
select="//rdf:Description[matches(@rdf:about, 'supergroup/[0-9]+$')]"
group-by="@rdf:about">
<xsl:sort select="@rdf:about"/>
<skos:hasTopConcept
rdf:resource="http://www.eionet.europa.eu/gemet/{@rdf:about}"/>
</xsl:for-each>
</xsl:for-each-group>

</xsl:when>
<xsl:when test="$withThemes">
<skos:hasTopConcept
rdf:resource="http://www.eionet.europa.eu/gemet/themes"/>

<xsl:for-each-group
select="//rdf:Description[matches(@rdf:about, 'theme/[0-9]+$')]"
group-by="@rdf:about">
<xsl:sort select="@rdf:about"/>
<skos:hasTopConcept
rdf:resource="http://www.eionet.europa.eu/gemet/{@rdf:about}"/>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise>
<!-- All concept with no broader term -->
Expand All @@ -87,8 +108,16 @@
<xsl:comment>GEMET supergroups</xsl:comment>
<xsl:text>
</xsl:text>

<skos:Concept rdf:about="http://www.eionet.europa.eu/gemet/supergroups">
<xsl:for-each select="$locales//locale">
<skos:prefLabel xml:lang="{{.}}">GEMET super groups</skos:prefLabel>
</xsl:for-each>
</skos:Concept>


<xsl:for-each
select="//skos:Collection[matches(@rdf:about, 'supergroup/[0-9]+$')]">
select="//rdf:Description[matches(@rdf:about, 'supergroup/[0-9]+$')]">
<xsl:sort select="@rdf:about"/>
<xsl:variable name="id" select="@rdf:about"/>

Expand All @@ -114,14 +143,17 @@
<skos:narrower
rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>

<skos:broader rdf:resource="http://www.eionet.europa.eu/gemet/supergroups"/>
</skos:Concept>
</xsl:for-each>

<xsl:comment>GEMET groups</xsl:comment>
<xsl:text>
</xsl:text>
<xsl:for-each
select="//skos:Collection[matches(@rdf:about, 'group/[0-9]+$')]">
<xsl:for-each-group
select="//rdf:Description[matches(@rdf:about, 'group/[0-9]+$')]"
group-by="@rdf:about">
<xsl:sort select="@rdf:about"/>
<xsl:variable name="id" select="@rdf:about"/>

Expand All @@ -143,48 +175,68 @@

<!-- Search groups -->
<xsl:for-each
select="//skos:Collection[@rdf:about = $id]/gemet:subGroupOf/rdf:Description/@rdf:about">
select="//rdf:Description[@rdf:about = $id]/gemet:subGroupOf/rdf:Description/@rdf:about">
<skos:broader
rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
<!-- Search theme -->
<!-- Search term -->
<xsl:for-each
select="//gemet:group/rdf:Description[@rdf:about = $id]/skos:member/@rdf:resource[starts-with(., 'concept')]">
<skos:narrower
rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
</skos:Concept>
</xsl:for-each>
</xsl:for-each-group>
</xsl:if>

<!--<xsl:comment>GEMET themes</xsl:comment>
<xsl:for-each select="//skos:Collection[matches(@rdf:about, 'theme/[0-9]+$')]">
<xsl:sort select="@rdf:about"/>
<xsl:variable name="id" select="@rdf:about"/>
<skos:Concept rdf:about="http://www.eionet.europa.eu/gemet/{$id}">
<xsl:for-each
select="$lang//rdf:Description[@rdf:about = $id]">
<xsl:variable name="l" select="../@xml:lang"/>
<xsl:if test="$withThemes">
<xsl:comment>GEMET themes</xsl:comment>

<xsl:if
test="normalize-space(rdfs:label) != ''">
<xsl:element name="skos:prefLabel">
<xsl:attribute name="xml:lang">
<xsl:value-of select="$l"/>
</xsl:attribute>
<xsl:value-of select="rdfs:label"/>
</xsl:element>
</xsl:if>
<skos:Concept rdf:about="http://www.eionet.europa.eu/gemet/themes">
<xsl:for-each select="$locales//locale">
<skos:prefLabel xml:lang="{.}">GEMET themes</skos:prefLabel>
</xsl:for-each>
</skos:Concept>

<xsl:for-each select="//gemet:subGroupOf/rdf:Description/@rdf:about">
<skos:broader rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
<xsl:for-each-group
select="//rdf:Description[matches(@rdf:about, 'theme/[0-9]+$')]"
group-by="@rdf:about">
<xsl:sort select="@rdf:about"/>
<xsl:variable name="id" select="@rdf:about"/>

</skos:Concept>
</xsl:for-each>-->
<skos:Concept rdf:about="http://www.eionet.europa.eu/gemet/{$id}">
<xsl:for-each
select="$lang//rdf:Description[@rdf:about = $id]">
<xsl:variable name="l" select="../@xml:lang"/>

<xsl:if
test="normalize-space(rdfs:label) != ''">
<xsl:element name="skos:prefLabel">
<xsl:attribute name="xml:lang">
<xsl:value-of select="$l"/>
</xsl:attribute>
<xsl:value-of select="rdfs:label"/>
</xsl:element>
</xsl:if>
</xsl:for-each>

<xsl:if test="$withGroup">
<xsl:for-each select="//gemet:subGroupOf/rdf:Description/@rdf:about">
<skos:broader rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
</xsl:if>

<skos:broader rdf:resource="http://www.eionet.europa.eu/gemet/themes"/>

<!-- Search term -->
<xsl:for-each
select="$root//rdf:Description[gemet:theme/rdf:Description/@rdf:about = $id][starts-with(@rdf:about, 'concept')]">
<skos:narrower
rdf:resource="http://www.eionet.europa.eu/gemet/{@rdf:about}"/>
</xsl:for-each>
</skos:Concept>
</xsl:for-each-group>
</xsl:if>

<xsl:comment>GEMET concepts</xsl:comment>
<xsl:text>
Expand Down Expand Up @@ -227,6 +279,13 @@
rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
</xsl:if>

<xsl:if test="$withThemes">
<xsl:for-each select="gemet:theme/rdf:Description/@rdf:about">
<skos:broader
rdf:resource="http://www.eionet.europa.eu/gemet/{.}"/>
</xsl:for-each>
</xsl:if>
<xsl:for-each select="$skoscore//skos:Concept[@rdf:about = $id]/
*[local-name() = 'narrower' or
local-name() = 'broader' or
Expand Down
7 changes: 7 additions & 0 deletions gemet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
./gemet-to-simpleskos.sh en
./gemet-to-simpleskos.sh fr
./gemet-to-simpleskos.sh it
./gemet-to-simpleskos.sh nl
./gemet-to-simpleskos.sh de
./gemet-to-simpleskos.sh en fr it nl de
13 changes: 0 additions & 13 deletions inspire-theme.sh

This file was deleted.

70 changes: 0 additions & 70 deletions inspire-theme.xsl

This file was deleted.

Loading

0 comments on commit 74409eb

Please sign in to comment.