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

Allow interpolation of placeholders in annotation values. #1242

Merged

Conversation

gouttegd
Copy link
Contributor

@gouttegd gouttegd commented Feb 7, 2025

Resolves [#1241]

  • 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

This PR implements the proposition outlined in #1241. It adds the possibility of using the annotate command to inject ontology annotations with values derived from the ontology itself, by substituting placeholders (of the form %{NAME}) within the values provided on the command line.

For now, only two placeholders are supported (%{ontology_iri} and %{version_iri}). For that reason, the implementation is very basic, and is merely a couple of search-and-replace operations.

This commit adds the possibility of using the `annotate` command to
inject ontology annotations with values derived from the ontology
itself, by substituting placeholders (of the form `%{NAME}`) within the
values provided on the command line.

For now, only two placeholders are supported (`%{ontology_iri}` and
`%{version_iri}`). For that reason, the implementation is very basic,
and is merely a couple of search-and-replace operations.
Copy link
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

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

Very nice code, good function (every ontology we have using ODK would make use of this), two considerations for the design (using flags instead of normal options; the need for the "interpolate" flag), which @jamesaoverton will have to decide / look over.

Most boolean-typed options in ROBOT take a true/false argument instead
of being simple flags (whose presence on the command line is enough to
enable the option), so we make the new `--interpolate` option of the
`annotate` command behave in the same way.
@jamesaoverton
Copy link
Member

Thanks for another nice improvement to ROBOT @gouttegd! I marked the two conversations as resolved. Ready for me to merge this?

@gouttegd
Copy link
Contributor Author

gouttegd commented Mar 5, 2025

@jamesaoverton Since you agree with the current behaviour of requesting the --interpolate true option to enable the feature, yes, it’s ready. :)

@jamesaoverton jamesaoverton merged commit 16cd26e into ontodev:master Mar 5, 2025
3 checks passed
@gouttegd gouttegd deleted the enable-annotation-interpolation branch March 5, 2025 17:32
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.

3 participants