Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
ianwallen opened this issue Mar 1, 2023 · 7 comments
Open
3 tasks
Labels
bug Something isn't working
Milestone

Comments

@ianwallen
Copy link
Contributor

ianwallen commented Mar 1, 2023

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.

@ianwallen ianwallen added the bug Something isn't working label Mar 1, 2023
@ianwallen ianwallen added this to the 3.12.10 milestone Mar 20, 2023
@jodygarnett
Copy link
Member

jodygarnett commented Mar 23, 2023

@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
Copy link
Contributor Author

@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
Copy link
Contributor

wangf1122 commented Mar 31, 2023

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

<xsl:variable name="thesaurusDate"
select="normalize-space($thesauri/thesaurus[key = $currentThesaurus]/date)"/>

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
Copy link
Contributor

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
Copy link
Contributor Author

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

@josegar74
Copy link
Contributor

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
Copy link
Contributor

@josegar74 @ianwallen

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

This PR geonetwork/core-geonetwork#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. #327

@josegar74 josegar74 modified the milestones: 3.12.10, 3.12.11 May 10, 2023
@josegar74 josegar74 modified the milestones: 3.12.11, 3.12.12 Oct 4, 2023
@josegar74 josegar74 modified the milestones: 3.12.12, 3.12.13 Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants