Label language preferences + diff-pretty label-language prefs support#1287
Open
jclerman wants to merge 6 commits into
Open
Label language preferences + diff-pretty label-language prefs support#1287jclerman wants to merge 6 commits into
jclerman wants to merge 6 commits into
Conversation
…bot diff's "pretty" format
…nly for "pretty" format (for now). Also: - update README & diff-command documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does not resolve a filed issue (I can file one if that's preferred).
I posted a question about this capability in the OBO Slack last week; this PR stems from the ensuing conversation.
docs/have been added/updatedmvn verifysays all tests passmvn sitesays all JavaDocs correctCHANGELOG.mdhas been updatedSummary
Add initial support for specifying a language-preference when showing entity-labels. Use that support for the
diffcommand'sprettyformat. Solution is designed to be extensible for use with the otherdiffformats, and for other ROBOT commands that show entity-labels.Background
robotdid not previously have support for preferring a particular language when showing entity labels. For ontologies with max-1 label per entity, that doesn't matter - but some ontologies designed to support multi-language use may have multiple labels (one per each of several languages). Although multiple labels per entity violates an OBO principle, it may be worth revisiting that decision. Meantime, non-OBO ontologies can also use this tool and would benefit from the extension immediately.Details
Context/Plan: First of several PRs
With this PR, the first step in a 3 (or 4) step plan for adding language-preference support to ROBOT is delivered.
Steps:
diff(pretty): Add a reusableLanguagePreferencehelper andPreferredLanguageShortFormProvider, and wire a new--label-langs-priorityoption intodiffso the pretty format can select entity labels by an ordered language list (with en→en-GB cascade, deterministic tie-breaking, a none token for untagged literals). NO CHANGE to behavior when the option is omitted.renderWriteroverloads toMarkdownGroupedDiffRendererandHTMLDiffRendererthat accept a caller-suppliedShortFormProviderfor labels instead of building their own, so consumers can control label rendering (no ROBOT dependency added).diff(markdown/html): Once the owl-diff change is released, pass ROBOT'sPreferredLanguageShortFormProviderinto the markdown and html renderers so--label-langs-priorityworks for all diff formats consistently.LanguagePreference/provider to add--label-langs-priority(or equivalent) to the other label-displaying commands —export,explain, andreport.Ordering: PR3 depends on PR2 being merged and released (new owl-diff version bump in ROBOT); PRs 1, 2, and 4 are independent.
Note about language-preference cascade
As part of this implementation, label-language preferences follow a "specificity cascade": More-general tags (e.g. "en") can match to more-specific ones (e.g. "en-GB"). However, label-values match to the most-specific-possible position in the preference-list, and are prioritized with that in mind. So:
Future work
Remaining 3 steps (steps 2-4 as enumerated above). Note that the next step would be an update to
owl-diff- not this repo.