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

Robot header #1154

Merged
merged 10 commits into from
Mar 29, 2024
Merged

Robot header #1154

merged 10 commits into from
Mar 29, 2024

Conversation

pk-mitre
Copy link
Contributor

@pk-mitre pk-mitre commented Sep 29, 2023

Resolves #1152

  • docs/ have been added/updated
  • tests have been added/updated
  • mvn verify says all tests pass
  • mvn site says all JavaDocs correct
  • CHANGELOG.md has been updated

Adds option to input template strings via an external file as described in Issue #1152

@jamesaoverton
Copy link
Member

My first thought when I see the details of this implementation is that the row numbers in our error messages will be off by one, which will be confusing.

CHANGELOG.md Outdated
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
-- Added option to input template strings from external file [##1152]
Copy link
Member

Choose a reason for hiding this comment

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

##1152 should be just #1152

This link needs an expansion at the bottom of the file.

CURIE Label Parent Comment
ID LABEL SC % A rdfs:comment
obo:0000001 animal Any animal in the world.
0000002 canine animal A member of the genus Canis.
Copy link
Member

Choose a reason for hiding this comment

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

Is this combined file supposed to include this error? The file doesn't seem to be used anywhere, so I would not include it.

Copy link
Member

Choose a reason for hiding this comment

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

To answer my own question: Yes, I think this file is included to compare row numbers for errors. So I suggest naming this file animals_template_error.tsv to match animals_ext_template_error.tsv.

@@ -158,7 +159,7 @@ public static OWLOntology template(
* Given an OWLOntology, an IOHelper, a map of table names to table contents, and a map of
* template options, use the tables as templates to generate a merged output ontology.
*
* @param inputOntology OWLOntology to use to get existing entities
* @param inputOntology OWLOntology to use to get existing entitfies
Copy link
Member

Choose a reason for hiding this comment

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

Should be "entities"

@@ -487,6 +492,8 @@ public static OWLOntology template(
int idColumn = idColumns.get(tableName);
int labelColumn = labelColumns.get(tableName);
List<List<String>> rows = tables.get(tableName);
// TODO The starting row has to be controlled by the approach used, ie, internal or external
Copy link
Member

Choose a reason for hiding this comment

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

Is this TODO now done? If so the comment should be removed.

@jamesaoverton
Copy link
Member

@pk-mitre I apologize for taking so long to review this PR. This is a good feature, and we really do appreciate your contribution! The problem is simply that nobody on the core ROBOT team has dedicated hours for this work.

I made a few specific suggestions. If you have time to reply or make those changes, it would be appreciated. If you don't have time, let me know and I'll try to find time to finish the PR myself.

The only major question I have at this point is: What to do if the template and the ext-template do not match? Eventually someone will add new columns to one and forget to add them to the other, then file a bug report here.

I think that that best approach might be to check that the first row of the template and the ext-template are identical. What do you think?

Thanks again!

@pk-mitre
Copy link
Contributor Author

pk-mitre commented Jan 9, 2024

James:
I have addressed the code comments and updated the pull request code.
I will follow up on the mismatch issue between the template and the ext-template
Thanks

@jamesaoverton
Copy link
Member

@pk-mitre Thank you for your continued work on this PR. I'm sorry that our schedules never seem to be in sync.

Do you still plan to follow up on the case of a mismatch between the template and the ext-template? Please let me know either way. Thanks again!

@pk-mitre
Copy link
Contributor Author

pk-mitre commented Feb 7, 2024

@jamesaoverton Yes, sorry I was working on a few other things. I will be following up on this mismatch issue and check things in.
Thanks !

@pk-mitre
Copy link
Contributor Author

pk-mitre commented Mar 6, 2024

@jamesaoverton Am working through any potential additional error handling. With reference to your suggestion about checking the first row of the template file against the external template,I assume you mean the column count ? Since the first row in the template file is the header information, so it wouldn't be identical with the externalized template strings even in a correct case. For example:

Template file:

CURIE Label Parent Comment
obo:0000001 animal Any animal in the world.
obo:0000002 canine animal A member of the genus Canis.
obo:0000003 feline animal A member of the genus Felis.

external template file:

ID LABEL SC % A rdfs:comment

@jamesaoverton
Copy link
Member

jamesaoverton commented Mar 7, 2024

@pk-mitre You're right, my request was confused.

I'm worried about users changing the column structure of the template without changing the structure of the external template, or the other way around. I'm also worried that it's hard to tell which ROBOT template strings apply to which columns in the external template file.

So now I suggest that the external template file has two rows: the first for header strings and the second for ROBOT template strings. ROBOT should then check that the first row of the two files is the same: the headers in the template file match the headers in the external template file. If the first rows of the two files are not exactly the same, ROBOT should quit with an error message.

Template file:

CURIE Label Parent Comment
obo:0000001 animal Any animal in the world.
obo:0000002 canine animal A member of the genus Canis.
obo:0000003 feline animal A member of the genus Felis.

external template file:

CURIE Label Parent Comment
ID LABEL SC % A rdfs:comment

docs/template.md Outdated
ROBOT template data read from separate external file

robot template --template animals_ext_template.tsv \
--ext-template animals_template.tsv \
Copy link
Member

Choose a reason for hiding this comment

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

I think it's confusing that --template uses animals_ext_template.tsv while --ext-template uses animals_template.tsv. The names of these files should be swapped.

@@ -49,6 +53,7 @@ public TemplateCommand() {
"A", "include-annotations", true, "if true, include ontology annotations from merge input");
o.addOption("f", "force", true, "if true, do not exit on error");
o.addOption("e", "errors", true, "write errors to this path (TSV or CSV)");
o.addOption("E", "ext-template", true, "external robot template data file");
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to call this external-template without abbreviating the name of the option.

@pk-mitre
Copy link
Contributor Author

@jamesaoverton I have made the changes for the external template header error checking and also the file name changes to make it clearer as indicated in your comment on the naming.

@jamesaoverton
Copy link
Member

Thanks @pk-mitre! I skimmed the changes and they look good. I have a big deadline tomorrow, but I'll plan to finish reviewing on Friday.

@jamesaoverton jamesaoverton mentioned this pull request Mar 29, 2024
5 tasks
@jamesaoverton
Copy link
Member

I'm going to merge this and make a new PR with a few changes.

Sorry that this one took so long. Thanks for hanging in there and getting it done!

@jamesaoverton jamesaoverton merged commit 7173c55 into ontodev:master Mar 29, 2024
3 checks passed
@dlutz2
Copy link
Contributor

dlutz2 commented Mar 30, 2024

@jamesaoverton Thanks for the merge, appreciate the work and the time.

@pk-mitre
Copy link
Contributor Author

@jamesaoverton Thanks ! Glad it all merged in smoothly.

@pk-mitre
Copy link
Contributor Author

@jamesaoverton This one line has to be updated to take into account the changed flag name:
if (options.get("external-template") != null) { template.setRowNum(1); }
File: TemplateOperation.java

@jamesaoverton
Copy link
Member

You're right. I fixed that in dc04a3c. I really wish we had a test to catch that, but I ran into a bunch of problems verifying this, and used up more time than I could afford.

@pk-mitre
Copy link
Contributor Author

@jamesaoverton Thanks for all your help on this ticket !

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.

Add option to read in template information from a separate external file
3 participants