-
-
Notifications
You must be signed in to change notification settings - Fork 504
Description
Describe the bug
When creating or modifying a local Thesaurus/Theme in GeoNetwork 4.2.14 (schema iso19139.ca.HNAP), GeoNetwork auto-generates invalid <gmd:CI_Citation> date elements in metadata records referencing that thesaurus.
Specifically:
- A
gmd:thesaurusName/gmd:CI_Citationblock is materialized in metadata. - GeoNetwork inserts two
<gmd:date>elements. - Each contains
<gco:Date/>(empty). - HNAP validation fails because empty dates are not permitted.
Attempts to manually remove these date elements in metadata do not persist. On save/reopen, GeoNetwork re-inserts the empty <gco:Date/> elements.
This behavior appears tied to thesaurus registry enrichment logic.
To Reproduce
- In GN 4.2.14, create a new local Theme (Thesaurus) under
config/codelist/local/thesauri/theme
using RDF similar to:
<rdf:Description rdf:about="https://registry.geonetwork-opensource.org/theme/Theme_name">
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme"/>
<dc:title xml:lang="en">Theme_name</dc:title>
<dc:title xml:lang="fr">Theme_name/dc:title>
<dc:description xml:lang="en">...</dc:description>
<dc:identifier>Theme_name.rdf</dc:identifier>
<dc:type>theme</dc:type>
</rdf:Description>- Restart GeoNetwork to load the new thesaurus.
- Add a keyword from this theme to an
iso19139.ca.HNAPmetadata record. - Save metadata.
- Open XML view.
GeoNetwork generates:
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date/>
</gmd:date>
...- Validate record.
Validation fails with:
Invalid or missing value. '' is not a valid value for Date (gco:Date)
Invalid or missing value. '' is not a valid value for (Date_Type)
- Manually delete the
<gmd:date>blocks. - Save metadata.
- Re-open metadata.
The <gmd:date> blocks reappear automatically.
Expected behavior
If a thesaurus does not define publication/creation dates, GeoNetwork should either:
- Not generate
<gmd:date>elements, or - Generate valid ISO date values, or
- Allow citation without date elements when schema permits.
GeoNetwork should not generate invalid ISO elements that immediately fail schema validation.
Additionally:
- Editing RDF thesaurus files should take effect without requiring a full server restart.
- UI editing of Thesaurus should not corrupt or rewrite RDF metadata unexpectedly.
- Metadata edits should not re-materialize invalid citation fragments.
Observed Workaround
The issue can be temporarily resolved by:
- Editing the RDF ConceptScheme to match minimal structure used by older (working) themes:
<rdf:Description rdf:about="https://registry.geonetwork-opensource.org/theme/Theme_name">
<dc:identifier>Theme_name.rdf</dc:identifier>
<dc:description xml:lang="fr">...</dc:description>
<dc:description xml:lang="en">...</dc:description>
<dc:title xml:lang="fr">...</dc:title>
<dc:title xml:lang="en">...</dc:title>
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme"/>
</rdf:Description>- Performing a full server restart.
Without restart, GeoNetwork continued using cached thesaurus metadata and kept generating invalid date elements.
- Re-editing affected metadata records.
- Saving and validating again.
- After restart and RDF normalization, new metadata saves no longer injected empty
<gco:Date/>.
Important Observations
- Thesaurus definitions appear to be cached at startup.
- Editing RDF files does not reliably refresh in-memory registry models.
- Editing thesauri via UI may re-write RDF in unexpected ways.
- Metadata referencing registry-linked themes triggers automatic citation enrichment.
- That enrichment can produce schema-invalid XML.
Impact
- Causes all affected metadata to fail HNAP validation.
- Batch edits do not persist because GN re-materializes invalid elements.
- Requires server restart to apply RDF corrections.
- Risk of metadata corruption if thesaurus edited in UI.
- Operationally significant in multi-environment deployments.
Desktop (please complete the following information):
- Browser: Edge
- GeoNetwork Version: 4.2.14
- Schema: iso19139.ca.HNAP 4.2.14
- Server:
- Tomcat 9.0.106
- Java Adoptium 8u462b08
- ElasticSearch 7.17.15
Additional context
This issue did not occur with themes created in GN <= 4.2.11.
It appears specific to:
- GN 4.2.14
- iso19139.ca.HNAP schema behavior
- Thesaurus registry materialization logic
It would be helpful if:
- Thesaurus reload could be triggered without full restart.
- Citation enrichment did not generate invalid empty ISO elements.
- Validation-aware generation logic was implemented.