Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 4.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Aug 20, 2021
2 parents 035c9a7 + 5f0ff19 commit 458600c
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ private void checkIndexResponse(BulkResponse bulkItemResponses,
.add("resourceVerticalRange")
.add("resourceTemporalDateRange")
.add("resourceTemporalExtentDateRange")
.add("resourceTemporalExtentDetails")
.build();
booleanFields = ImmutableSet.<String>builder()
.add("hasxlinks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,19 +868,24 @@
<xsl:if test="$start &lt; $end and not($end/@indeterminatePosition = 'now')">
,"lte": "<xsl:value-of select="$zuluEndDate"/>"
</xsl:if>
}</resourceTemporalExtentDateRange>
}</resourceTemporalExtentDateRange>
</xsl:when>
<xsl:otherwise>
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower and upper bounds empty. Date range not indexed.</indexingErrorMsg>
</xsl:otherwise>
</xsl:choose>


<xsl:if test="$zuluStartDate != ''
and $zuluEndDate != ''
and $start &gt; $end">
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower range bound '<xsl:value-of select="$start"/>' can not be greater than upper bound '<xsl:value-of select="$end"/>'.</indexingErrorMsg>
</xsl:if>


<xsl:call-template name="build-range-details">
<xsl:with-param name="start" select="$start"/>
<xsl:with-param name="end" select="$end"/>
</xsl:call-template>
</xsl:for-each>

<xsl:for-each select=".//gex:verticalElement/*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,14 @@
<xsl:variable name="isTypePlace" select="count(mri:type/mri:MD_KeywordTypeCode[@codeListValue='place']) > 0"/>
<xsl:if test="$isTypePlace">
<xsl:call-template name="render-batch-process-button">
<xsl:with-param name="process-label-key" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-name" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-params">{"replace": true}</xsl:with-param>
<xsl:with-param name="process-params">{"replace": "true"}</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="render-batch-process-button">
<xsl:with-param name="process-label-key" select="'add-one-extent-from-geokeywords'"/>
<xsl:with-param name="process-name" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-params">{"replace": "true", "boundingAll": "true"}</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:when>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
the metadata identifier (eg.
http://www.organization.org/catalogue/5391bf69-44bc-4ea0-8cc0-6cf6c3bc81ae).
</add-resource-idHelp>
<add-extent-from-geokeywords>Compute extent from keyword
</add-extent-from-geokeywords>
<add-extent-from-geokeywords>Add extent for each keywords</add-extent-from-geokeywords>
<add-one-extent-from-geokeywords>Add one extent from all keywords</add-one-extent-from-geokeywords>
<add-extent-from-geokeywordsHelp>Analyze each keyword of type place and add
matching extent.
</add-extent-from-geokeywordsHelp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
et l'identifiant de la fiche (eg.
http://www.organization.org/catalogue/5391bf69-44bc-4ea0-8cc0-6cf6c3bc81ae).
</add-resource-idHelp>
<add-extent-from-geokeywords>Calculer les emprises à partir des mots clés
</add-extent-from-geokeywords>
<add-extent-from-geokeywords>Ajouter les emprises correspondantes</add-extent-from-geokeywords>
<add-one-extent-from-geokeywords>Ajouter une emprise globale</add-one-extent-from-geokeywords>
<add-extent-from-geokeywordsHelp>Analyse les mots clés de type géographique et
ajoute les emprises correspondantes.
</add-extent-from-geokeywordsHelp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:geonet="http://www.fao.org/geonetwork"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
xmlns:gex="http://standards.iso.org/iso/19115/-3/gex/1.0"
xmlns:srv="http://standards.iso.org/iso/19115/-3/srv/2.1"
xmlns:mdb="http://standards.iso.org/iso/19115/-3/mdb/2.0"
Expand All @@ -30,10 +30,14 @@

<!-- Replace or not existing extent -->
<xsl:param name="replace" select="'0'"/>
<xsl:param name="boundingAll" select="'0'"/>
<xsl:param name="addExtentFor" select="''"/>


<xsl:variable name="replaceMode"
select="geonet:parseBoolean($replace)"/>
<xsl:variable name="boundingAllMode"
select="geonet:parseBoolean($boundingAll)"/>
<xsl:variable name="serviceUrl"
select="concat(substring($gurl, 1, string-length($gurl)-4), 'api/registries/vocabularies/search?_content_type=xml&amp;q=')"/>

Expand All @@ -54,19 +58,22 @@
select="string-join($root//gex:EX_Extent/gex:description/gco:CharacterString, ' ')"/>

<xsl:variable name="geoKeywords"
select="$root//mri:descriptiveKeywords/mri:MD_Keywords/mri:keyword[
select="$root//mri:descriptiveKeywords/*/mri:keyword[
not(gco:CharacterString/@gco:nilReason)
and (not(contains($extentDescription, gco:CharacterString))
or not(contains($extentDescription, gmx:Anchor)))
and ../mri:type/mri:MD_KeywordTypeCode/@codeListValue='place']"/>
or not(contains($extentDescription, gcx:Anchor)))
and ../mri:type/*/@codeListValue='place']"/>
<xsl:if test="$geoKeywords">
<suggestion process="add-extent-from-geokeywords" id="{generate-id()}" category="keyword" target="extent">
<name><xsl:value-of select="geonet:i18n($add-extent-loc, 'a', $guiLang)"/><xsl:value-of select="string-join($geoKeywords/gco:CharacterString, ', ')"/>
<name><xsl:value-of select="geonet:i18n($add-extent-loc, 'a', $guiLang)"/><xsl:value-of select="string-join($geoKeywords/(gco:CharacterString|gcx:Anchor), ', ')"/>
<xsl:value-of select="geonet:i18n($add-extent-loc, 'b', $guiLang)"/></name>
<operational>true</operational>
<params>{"gurl":{"type":"string", "defaultValue":"<xsl:value-of select="$gurl"/>"},
"lang":{"type":"string", "defaultValue":"<xsl:value-of select="$lang"/>"},
"replace":{"type":"boolean", "defaultValue":"<xsl:value-of select="$replace"/>"}}</params>
"addExtentFor":{"type":"string", "defaultValue":""},
"boundingAll":{"type":"boolean", "defaultValue":"<xsl:value-of select="$boundingAll"/>"},
"replace":{"type":"boolean", "defaultValue":"<xsl:value-of select="$replace"/>"}}
</params>
</suggestion>
</xsl:if>

Expand Down Expand Up @@ -168,15 +175,37 @@
<xsl:template name="add-extent">
<!-- Only check keyword in main metadata language
TODO: support multilingual keyword -->
<xsl:for-each
select="mri:descriptiveKeywords/mri:MD_Keywords/mri:keyword[
normalize-space(gco:CharacterString) != '' and
not(gco:CharacterString/@gco:nilReason)]">
<xsl:call-template name="get-bbox">
<xsl:with-param name="word" select="gco:CharacterString"/>
</xsl:call-template>

</xsl:for-each>
<xsl:variable name="extentList">
<xsl:for-each
select="if ($addExtentFor = '')
then mri:descriptiveKeywords/*/mri:keyword[
normalize-space((gco:CharacterString|gcx:Anchor)) != ''
and not(gco:CharacterString/@gco:nilReason)
and ../mri:type/*/@codeListValue='place']
else mri:descriptiveKeywords/*/mri:keyword[
normalize-space((gco:CharacterString|gcx:Anchor)) = $addExtentFor]">
<xsl:call-template name="get-bbox">
<xsl:with-param name="word" select="gco:CharacterString"/>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>

<xsl:choose>
<xsl:when test="$boundingAllMode">
<mri:extent>
<xsl:copy-of
select="geonet:make-iso-extent(
string(min($extentList//gex:westBoundLongitude)),
string(min($extentList//gex:southBoundLatitude)),
string(max($extentList//gex:eastBoundLongitude)),
string(max($extentList//gex:northBoundLatitude)),
string-join($extentList//gex:description, ', '))"/>
</mri:extent>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$extentList"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


Expand All @@ -191,7 +220,7 @@
<!-- It should be one but if one keyword is found in more
thant one thesaurus, then each will be processed.-->
<xsl:for-each select="$keyword/response/keyword">
<xsl:if test="geo and geo/west != '' and geo/south != '' and geo/east != '' and geo/north != ''">
<xsl:if test="geo and geo/west != '' and geo/south != '' and geo/east != '' and geo/north != '' and count(value[text() = $word]) = 1">
<mri:extent>
<xsl:copy-of select="geonet:make-iso19115-3-extent(geo/west, geo/south, geo/east, geo/north, $word)"/>
</mri:extent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,11 @@
and $start &gt; $end">
<indexingErrorMsg>Warning / Field resourceTemporalDateRange / Lower range bound '<xsl:value-of select="$start"/>' can not be greater than upper bound '<xsl:value-of select="$end"/>'.</indexingErrorMsg>
</xsl:if>

<xsl:call-template name="build-range-details">
<xsl:with-param name="start" select="$start"/>
<xsl:with-param name="end" select="$end"/>
</xsl:call-template>
</xsl:for-each>

<xsl:for-each select=".//gmd:verticalElement/*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

<xsl:variable name="thesaurusTitleTranslated" select="$listOfThesaurus/thesaurus[title=$thesaurusTitle]/multilingualTitles/multilingualTitle[lang=$uiLang2code]/title" />
<xsl:variable name="thesaurusTitleForEditor" select="if (string($thesaurusTitleTranslated)) then $thesaurusTitleTranslated else $thesaurusTitle" />

<!-- The thesaurus key may be contained in the MD_Identifier field or
get it from the list of thesaurus based on its title.
-->
Expand Down Expand Up @@ -281,8 +281,14 @@
select="count(gmd:type/gmd:MD_KeywordTypeCode[@codeListValue='place']) > 0"/>
<xsl:if test="$isTypePlace">
<xsl:call-template name="render-batch-process-button">
<xsl:with-param name="process-label-key" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-name" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-params">{"replace": "true"}</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="render-batch-process-button">
<xsl:with-param name="process-label-key" select="'add-one-extent-from-geokeywords'"/>
<xsl:with-param name="process-name" select="'add-extent-from-geokeywords'"/>
<xsl:with-param name="process-params">{"replace": true}</xsl:with-param>
<xsl:with-param name="process-params">{"replace": "true", "boundingAll": "true"}</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:when>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
<add-resource-idHelp>Compose the resource identifier using the catalog URL and the metadata
identifier (eg. http://www.organization.org/catalogue/5391bf69-44bc-4ea0-8cc0-6cf6c3bc81ae).
</add-resource-idHelp>
<add-extent-from-geokeywords>Compute extent from keyword</add-extent-from-geokeywords>
<add-extent-from-geokeywords>Add extent for each keywords</add-extent-from-geokeywords>
<add-one-extent-from-geokeywords>Add one extent from all keywords</add-one-extent-from-geokeywords>
<add-extent-from-geokeywordsHelp>Analyze each keyword of type place and add matching extent.
</add-extent-from-geokeywordsHelp>
<classificationSection>Classification of data and services</classificationSection>
Expand Down
4 changes: 2 additions & 2 deletions schemas/iso19139/src/main/plugin/iso19139/loc/fre/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
du catalogue ou l'URL du catalogue et l'identifiant de la fiche (eg.
http://www.organization.org/catalogue/5391bf69-44bc-4ea0-8cc0-6cf6c3bc81ae).
</add-resource-idHelp>
<add-extent-from-geokeywords>Calculer les emprises à partir des mots clés
</add-extent-from-geokeywords>
<add-extent-from-geokeywords>Ajouter les emprises correspondantes</add-extent-from-geokeywords>
<add-one-extent-from-geokeywords>Ajouter une emprise globale</add-one-extent-from-geokeywords>
<add-extent-from-geokeywordsHelp>Analyse les mots clés de type géographique et ajoute les emprises
correspondantes.
</add-extent-from-geokeywordsHelp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@

<!-- Replace or not existing extent -->
<xsl:param name="replace" select="'0'"/>
<xsl:param name="boundingAll" select="'0'"/>
<xsl:param name="addExtentFor" select="''"/>


<xsl:variable name="replaceMode"
select="geonet:parseBoolean($replace)"/>
<xsl:variable name="boundingAllMode"
select="geonet:parseBoolean($boundingAll)"/>
<xsl:variable name="serviceUrl"
select="concat(substring($gurl, 1, string-length($gurl)-4), 'api/registries/vocabularies/search?_content_type=xml&amp;q=')"/>

Expand Down Expand Up @@ -86,12 +90,14 @@
target="extent">
<name>
<xsl:value-of select="geonet:i18n($add-extent-loc, 'a', $guiLang)"/><xsl:value-of
select="string-join($geoKeywords/gco:CharacterString, ', ')"/>
select="string-join($geoKeywords/(gco:CharacterString|gmx:Anchor), ', ')"/>
<xsl:value-of select="geonet:i18n($add-extent-loc, 'b', $guiLang)"/>
</name>
<operational>true</operational>
<params>{"gurl":{"type":"string", "defaultValue":"<xsl:value-of select="$gurl"/>"},
"lang":{"type":"string", "defaultValue":"<xsl:value-of select="$lang"/>"},
"addExtentFor":{"type":"string", "defaultValue":""},
"boundingAll":{"type":"boolean", "defaultValue":"<xsl:value-of select="$boundingAll"/>"},
"replace":{"type":"boolean", "defaultValue":"<xsl:value-of select="$replace"/>"}}
</params>
</suggestion>
Expand Down Expand Up @@ -170,8 +176,9 @@
<xsl:when test="$replaceMode">
<xsl:for-each select="srv:extent|gmd:extent">
<xsl:if
test="gmd:EX_Extent/gmd:temporalElement or gmd:EX_Extent/gmd:verticalElement
or gmd:EX_Extent/gmd:geographicElement[gmd:EX_BoundingPolygon]">
test="gmd:EX_Extent/gmd:temporalElement
or gmd:EX_Extent/gmd:verticalElement
or gmd:EX_Extent/gmd:geographicElement[gmd:EX_BoundingPolygon]">
<xsl:copy>
<xsl:copy-of select="gmd:EX_Extent"/>
</xsl:copy>
Expand Down Expand Up @@ -216,16 +223,39 @@
<xsl:param name="srv" select="false()"/>
<!-- Only check keyword in main metadata language
TODO: support multilingual keyword -->
<xsl:for-each
select="gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword[
normalize-space(gco:CharacterString) != '' and
not(gco:CharacterString/@gco:nilReason)]">
<xsl:call-template name="get-bbox">
<xsl:with-param name="word" select="gco:CharacterString"/>
<xsl:with-param name="srv" select="$srv"/>
</xsl:call-template>

</xsl:for-each>
<xsl:variable name="extentList">
<xsl:for-each
select="if ($addExtentFor = '')
then gmd:descriptiveKeywords/*/gmd:keyword[
normalize-space((gco:CharacterString|gmx:Anchor)) != ''
and not(gco:CharacterString/@gco:nilReason)
and ../gmd:type/*/@codeListValue='place']
else gmd:descriptiveKeywords/*/gmd:keyword[
normalize-space((gco:CharacterString|gmx:Anchor)) = $addExtentFor]">
<xsl:call-template name="get-bbox">
<xsl:with-param name="word" select="gco:CharacterString|gmx:Anchor"/>
<xsl:with-param name="srv" select="$srv"/>
</xsl:call-template>
</xsl:for-each>
</xsl:variable>

<xsl:choose>
<xsl:when test="$boundingAllMode">
<xsl:element name="{if($srv) then 'srv:extent' else 'gmd:extent'}">
<xsl:copy-of
select="geonet:make-iso-extent(
string(min($extentList//gmd:westBoundLongitude)),
string(min($extentList//gmd:southBoundLatitude)),
string(max($extentList//gmd:eastBoundLongitude)),
string(max($extentList//gmd:northBoundLatitude)),
string-join($extentList//gmd:description, ', '))"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$extentList"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


Expand All @@ -236,25 +266,16 @@

<xsl:if test="normalize-space($word)!=''">
<!-- Get keyword information -->
<xsl:variable name="keyword" select="document(concat($serviceUrl, encode-for-uri($word)))"/>
<xsl:variable name="keyword"
select="document(concat($serviceUrl, encode-for-uri($word)))"/>
<!-- It should be one but if one keyword is found in more
thant one thesaurus, then each will be processed.-->
<xsl:for-each select="$keyword/response/keyword">
<xsl:if test="geo">
<xsl:choose>
<xsl:when test="$srv">
<srv:extent>
<xsl:copy-of
select="geonet:make-iso-extent(geo/west, geo/south, geo/east, geo/north, $word)"/>
</srv:extent>
</xsl:when>
<xsl:otherwise>
<gmd:extent>
<xsl:copy-of
select="geonet:make-iso-extent(geo/west, geo/south, geo/east, geo/north, $word)"/>
</gmd:extent>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="geo and geo/west != '' and geo/south != '' and geo/east != '' and geo/north != '' and count(value[text() = $word]) = 1">
<xsl:element name="{if($srv) then 'srv:extent' else 'gmd:extent'}">
<xsl:copy-of
select="geonet:make-iso-extent(geo/west, geo/south, geo/east, geo/north, $word)"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:if>
Expand Down
2 changes: 1 addition & 1 deletion services/src/main/resources/config-spring-geonetwork.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<value>json/core+search+v4</value>
<value>json/schemas</value>
<value>standards/iso19139/codelists/gmd:MD_TopicCategoryCode+gmd:MD_ScopeCode+gmd:MD_MaintenanceFrequencyCode+gmd:MD_ProgressCode+gmd:DS_InitiativeTypeCode+gmd:MD_SpatialRepresentationTypeCode</value>
<value>standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode</value>
<value>standards/iso19115-3.2018/codelists/cit:CI_DateTypeCode+indeterminatePosition</value>
<value>db/MetadataCategory+Operation+Group+StatusValue+Source</value>
</util:list>
</entry>
Expand Down
Loading

0 comments on commit 458600c

Please sign in to comment.