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

Should `validate_units` be reworked to use the right version of the unitDictionary? #56

Closed
amoeba opened this issue Feb 13, 2020 · 2 comments

Comments

@amoeba
Copy link
Contributor

@amoeba amoeba commented Feb 13, 2020

@jeanetteclark ran into a situation earlier where she was working with an EML 2.1.1 doc but had her emld_db option set as eml-2.2.0.

As you can see below,

unit_valid <- validate_units(doc, encoding = encoding)

emld/R/validate_units.R

Lines 15 to 19 in 4e6db62

standard <- xml2::read_xml(system.file("tests",
getOption("emld_db"),
"eml-unitDictionary.xml",
package = "emld"
))

With the new machinery in place to automatically detect the appropriate EML schema to validate with from the input doc, this causes her 2.1.1 doc to have its units validated with the EML 2.2.0 unitDictionary.

I consider this just an oversight on my part and would be happy to change this behavior so that the version of the unitDictionary is dependent on the input document and not the global.

What do others think?

PS: eml_additional_validation is also not version-specific but I think the rules are backwards compatible so that's fine enough for now I think.

@mobb
Copy link

@mobb mobb commented Jun 16, 2020

I agree - if its creating EML 2.2, it should be validating against the 2.2 unitDictionary.
The one used today looks very much like EML 2.1

Current dictionary (EML 2.2):
This file: https://github.com/NCEAS/eml/blob/master/eml-unitDictionary.xml

related to EDIorg/EMLassemblyline#72 (comment)
AssemblyLine is a wrapper for the R EML package.

amoeba added a commit to amoeba/emld that referenced this issue Jun 16, 2020
The old version was out of sync with the released version so I've copied it in from upstream

Ref ropensci#56
amoeba added a commit to amoeba/emld that referenced this issue Jun 16, 2020
Ref ropensci#56

While `eml_validate` determines the root schema to use when validating, `validate_units` was still defaulting to the version set in `emld_db`. This changes `validate_units` so it uses the appropriate `eml-unitDictionary.xml` file for the root element.

I've also added two test files and a test to exercise this so we know validate_units is working correctly now.
@amoeba
Copy link
Contributor Author

@amoeba amoeba commented Jun 16, 2020

Thanks @mobb, and apologies about the outdated eml-unitDictionary. I've updated it in #60 to match the version we released with EML 2.2.0 and updated eml_validate to use the appropriate file when validating units. @cboettig could you please have a look?

@cboettig cboettig closed this in #60 Jun 16, 2020
amoeba added a commit to amoeba/EML that referenced this issue Jun 19, 2020
In ropensci/emld#56 we updated the eml-unitDictionary file to actually match the released EML 2.2.0 version and this test needed to be updated to match the new document
@laijasmine laijasmine mentioned this issue Jul 7, 2020
2 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.