From fb9b449014cc939413d50163467e041affb2dab2 Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Mon, 30 Sep 2024 09:40:22 +0200 Subject: [PATCH 1/4] Thesaurus / Date parsing fix. https://github.com/geonetwork/core-geonetwork/pull/6972/files#diff-c7548d94bdb4268915f50f66df5a90f1f7868e4fb1de2f3d2938397e202aaf2fR1057 added month and year format support. This was resolving thesaurus date to the last matching format ie. 1st January for the default date. This can be tested using regions thesaurus which will contains 2 dates for the thesaurus block. --- .../main/java/org/fao/geonet/kernel/Thesaurus.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java b/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java index efaeaf60a89..91a506b57ab 100644 --- a/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java +++ b/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java @@ -1064,12 +1064,11 @@ private Date parseThesaurusDate(Element dateEl) { StringBuffer errorMsg = new StringBuffer("Error parsing the thesaurus date value: "); errorMsg.append(dateVal); - boolean success = false; for (SimpleDateFormat df : dfList) { try { thesaurusDate = df.parse(dateVal); - success = true; + return thesaurusDate; } catch (Exception ex) { // Ignore the exception and try next format errorMsg.append("\n * with format: "); @@ -1079,11 +1078,9 @@ private Date parseThesaurusDate(Element dateEl) { } } // Report error if no success - if (!success) { - errorMsg.append("\nCheck thesaurus date in "); - errorMsg.append(this.fname); - Log.error(Geonet.THESAURUS_MAN, errorMsg.toString()); - } + errorMsg.append("\nCheck thesaurus date in "); + errorMsg.append(this.fname); + Log.error(Geonet.THESAURUS_MAN, errorMsg.toString()); return thesaurusDate; } From 42ec50ac70e56d1935e2bb88ca4109295159997c Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Mon, 30 Sep 2024 09:47:14 +0200 Subject: [PATCH 2/4] Thesaurus / Avoid having multiple dates with same type code https://github.com/geonetwork/core-geonetwork/pull/6972 adds retrieval of `dct:issued|modified|created` dates but multiple dates could be added more than one time with same date type code. Improve the mapping. --- .../convert/thesaurus-transformation.xsl | 135 ++++-------------- .../convert/thesaurus-transformation.xsl | 102 +++---------- 2 files changed, 48 insertions(+), 189 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/thesaurus-transformation.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/thesaurus-transformation.xsl index 40e13cd3e65..59a02c55f4d 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/thesaurus-transformation.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/thesaurus-transformation.xsl @@ -82,6 +82,12 @@ + + + + + + + + + else $thesaurus/title"/> - + @@ -282,121 +290,30 @@ - - - - + + + + + + - + + - - - - - - - - - - - - + + + + codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode" + codeListValue="{name(current-group()[1])}"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/schemas/iso19139/src/main/plugin/iso19139/convert/thesaurus-transformation.xsl b/schemas/iso19139/src/main/plugin/iso19139/convert/thesaurus-transformation.xsl index a27b85bcb18..9e3103d71c4 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/convert/thesaurus-transformation.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/convert/thesaurus-transformation.xsl @@ -136,6 +136,10 @@ + + + + + + else $thesaurus/title"/> - + @@ -341,95 +347,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - + + - - - - - - - - - - - - + + + + codeListValue="{name(current-group()[1])}"/> - + From 0337db4c4f111949fbd5374e6b92e7ab4e58feb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Thu, 3 Oct 2024 07:52:23 +0200 Subject: [PATCH 4/4] Thesaurus / LD registry registry / Only keep one date No need for duplicated date --- .../main/webapp/xslt/services/thesaurus/ldregistry-to-skos.xsl | 1 - 1 file changed, 1 deletion(-) diff --git a/web/src/main/webapp/xslt/services/thesaurus/ldregistry-to-skos.xsl b/web/src/main/webapp/xslt/services/thesaurus/ldregistry-to-skos.xsl index 1cec16ae730..02cdb7aa395 100644 --- a/web/src/main/webapp/xslt/services/thesaurus/ldregistry-to-skos.xsl +++ b/web/src/main/webapp/xslt/services/thesaurus/ldregistry-to-skos.xsl @@ -71,7 +71,6 @@ -