metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 19 forks source link

<gmd:thesaurusName> date is being updated when saving metadata record. #308

Open ianwallen opened 1 year ago

ianwallen commented 1 year ago

Here is a metadata record that I edited and just saved the changed. You can see that the data associated to the thesaurus was changes to the date in which the record was saved.

image

I believe the date of the thesaurus is not supposed to change when saving data as this is the date related to the thesaurus.

jodygarnett commented 1 year ago

@ianwallen I am not sure, can you tell me is the 2004 the result of change? And date that is handled as ISODate in core-geonework is suspect to timezone challenges around midnight at the end of the year. While these were fixed for GeoNetwork 4 the issue remains unpatched for geonetwork 3.12.x.

Update: Sorry I misunderstood your example, you changed the record on 2023-02-28 and this issue is three weeks old.

I still recommend adding some breakpoints to ISODate and seeing how 2023-02-28 was created.

ianwallen commented 1 year ago

@jodygarnett All I did was import a record that had the correct dates for the thesaurus. I verified the date by exporting xml. I then used the editor to edit and save the metadata (I did not make any changes - just load metadata in editor and clicked on save) All thesaurus dates were changed by the editor to be the last modified date.

My understanding is that the gmd:thesaurusName dates are related to the thesaurus and they should not be changed to the lastmodified date of the metadata record.

wangf1122 commented 1 year ago

The last modified date was embedder in the core Geonetwork

https://github.com/geonetwork/core-geonetwork/blob/d7a4b80c109da43a2b7a747c69f7c7fd481bdf3e/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java#L997-L998

Then been put to https://github.com/geonetwork/core-geonetwork/blob/d7a4b80c109da43a2b7a747c69f7c7fd481bdf3e/core/src/main/java/org/fao/geonet/kernel/ThesaurusManager.java#L294

Finally it passed to the xslt for the transformation

https://github.com/metadata101/iso19139.ca.HNAP/blob/14ead08ef492220fb5d7a6e8c22022807b941201/src/main/plugin/iso19139.ca.HNAP/convert/thesaurus-transformation.xsl#L352-L353

The question is where the change is supposed to be.

I am still looking at how the transformation side picked that date. Will give more details

wangf1122 commented 1 year ago

The question is if we really want to get rid of setting last modify date. We could just remove the logic in core Geonetwork about the last modify part.

https://github.com/geonetwork/core-geonetwork/blob/d7a4b80c109da43a2b7a747c69f7c7fd481bdf3e/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java#L982-L1000

ianwallen commented 1 year ago

It should only be setting dates if the dates are not already set.

josegar74 commented 1 year ago

The problem is that the xsl is rebuilding the complete section afaik, so needs to extract the values from somewhere.

An option, not optimal, would be to keep current behaviour, but add in update-fixed-info.xsl a rule to process that thesaurus section and fix the dates.

A better option, but will require some Java changes would be to store the dates in the thesaurus file and retrieve both. Currently, seems some logic for that, but only stores 1 value and applies a formatting to the date, that changes the original value also:

https://github.com/geonetwork/core-geonetwork/blob/d7a4b80c109da43a2b7a747c69f7c7fd481bdf3e/core/src/main/java/org/fao/geonet/kernel/Thesaurus.java#L968-L980

I'll try the update-fixed-info.xsl change for now.

wangf1122 commented 1 year ago

@josegar74 @ianwallen

I put two PR to fix this issue. I tested from my local and its fine.

This PR https://github.com/geonetwork/core-geonetwork/pull/6972 will add extra flag on Java side stating this date is file system date not the real thesaurus date.

This PR in HNAP is to parse the date or discard it. https://github.com/metadata101/iso19139.ca.HNAP/pull/327