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

validate all missing keyword #401

Open
wants to merge 2 commits into
base: 4.2.x
Choose a base branch
from

Conversation

wangf1122
Copy link
Contributor

The gmd:keyword is a list of nodes

image

The current validation only check the first index of the keyword. Some other keyword can be missing and causing issue among different system (i.e. FGP).

This pull request will fix the keyword missing logic to check all keyword nodes

@@ -31,7 +31,7 @@
<OpenLicense>An Open Goverment Licence is required. Accepted English values: Open Government Licence - Canada (http://open.canada.ca/en/open-government-licence-canada) or Open Government Licence – Newfoundland and Labrador (https://opendata.gov.nl.ca/public/opendata/page/?page-id=licence) or Open Government Licence – Nova Scotia (https://novascotia.ca/opendata/licence.asp) or Open Government Licence – Ontario (https://www.ontario.ca/page/open-government-licence-ontario) or Open Government Licence – Prince Edward Island (https://www.princeedwardisland.ca/en/information/finance/open-government-licence-prince-edward-island) or Open Government Licence - British Columbia (https://www2.gov.bc.ca/gov/content/data/open-data/open-government-licence-bc) or Open Government Licence - Alberta (https://open.alberta.ca/licence).
Accepted French values : Licence du gouvernement ouvert - Canada (http://ouvert.canada.ca/fr/licence-du-gouvernement-ouvert-canada) or Licence du gouvernement ouvert – Terre-Neuve-et-Labrador (https://opendata.gov.nl.ca/public/opendata/page/?page-id=licence) or Licence du gouvernement ouvert – Nouvelle-Écosse (https://novascotia.ca/opendata/licence.asp) or Licence du gouvernement ouvert – Ontario (https://www.ontario.ca/fr/page/licence-du-gouvernement-ouvert-ontario) or Licence du gouvernement ouvert – Île-du-Prince-Édouard (https://www.princeedwardisland.ca/fr/information/finances/licence-du-gouvernement-ouvert-ile-du-prince-edouard) or Licence du gouvernement ouvert - Colombie-Britannique (https://www2.gov.bc.ca/gov/content/data/open-data/open-government-licence-bc) or Licence du gouvernement ouvert - Alberta (https://open.alberta.ca/licence)</OpenLicense>
<SupplementalInfo>Supplemental Information should be empty or filled in both languages</SupplementalInfo>
<Keyword>Keyword is required in both languages</Keyword>
<Keyword>One of the Keyword(s) is(are) missing. Keyword is required in both languages</Keyword>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not combine 2 error messages in one otherwise it is difficult to understand what the error message is? I suggest creating 2 separate error message.

Also I believe the following is not correct.

One of the Keyword(s) is(are) missing

The value is not missing, the error is that it is not a valid keyword.

I get the following if I put an invalid value in the core subject thesaurus.

image

I tested an empty core subject thesaurus keywork and see the following

image

It is odd because it complains about the previous value and not the empty value - seems like another bug?

But when I validate there are no errors in the schematron. I would expect a similar error to be visible in the schematron validation.

The issue you are trying to fix is related to manual keywords but the error should be similar as an empty value is not a valid keyword.

Copy link
Contributor Author

@wangf1122 wangf1122 Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the hardcoded keyword[1] validation from the original schematron logic.

<sch:let name="missing" value="not(string(gmd:MD_Keywords/gmd:keyword[1]/gco:CharacterString))
or (@gco:nilReason)" />

It was a very general bold logic. This pull request is minor improvement as I am not amending any logic at all.

In order to fully understand the keyword issue, suggest if we open an issue and elaborate in that thread. So we can have full detailized "what need to be done" in the keyword section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have separated the error to two different error message within the schematron. @ianwallen Please review.

As for the error you are pointing out to hack the MD_KeywordTypeCode. It looks like a separated bug and we should deal in another pull request or issue to continue investigating.

@wangf1122 wangf1122 requested a review from ianwallen October 15, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants