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

Improve the ID range policy feature #1179

Merged
merged 4 commits into from
Dec 18, 2023
Merged

Improve the ID range policy feature #1179

merged 4 commits into from
Dec 18, 2023

Conversation

gouttegd
Copy link
Collaborator

@gouttegd gouttegd commented Nov 1, 2023

This PR attempts to fix the problems caused by the incompatibility between the “remember last ID between Protégé sessions” feature and the support for ID range policy files, highlighted in #1108.

First, it adds a new option to the “New entities” settings dialog to disable the support for ID range policy files – that is, to make Protégé ignore such files completely, as it was doing prior to version 5.6.0. This allows users that are annoyed by that feature to be no longer affected by it if they so wish, without having to remove or rename the -idranges.owl files in their ontologies.

Second, when an ID range policy is in effect and the “remember last ID between Protégé sessions” feature is enabled, the last used ID will now be saved under a name that is dependent on the policy currently in use. This means that Protégé will “remember” not only one single last ID globally, but one last ID for each ID range policy. This fixes the #1108 issue proper.

Third, when an ontology is reloaded (e.g. with File > Reload), the ID range policy will be reloaded as well. This allows to make sure any changes to the policy file is taken into account without having to close Protégé and opening it again. This also allows, for example, users who have more than one range assigned to them (or users who mistakenly selected the wrong range when prompted) to switch to another range by having Protégé display the range selection dialog again, without having to close Protégé and opening it again.

Make the NoRangeForUserNameHandler::handleNoRangeForUserName method
accept an operation that will take care of updating the preferences with
the selected user ID range. This allows to reuse the existing method
in the IdPolicyEntityCreationPreferencesUpdater class and thus to avoid
duplicated code.
When using an automatically set up ID range policy, make sure it will
not prevent the "remember last ID between sessions" feature from working
as users would expect.

We do that by:

* storing in the preferences, under the name POLICY_RANGE_NAME, an
  unique name for the currently applied policy, if any;

* when a policy is in use (as indicated by POLICY_RANGE_NAME), make the
  iterative auto-ID generator store the next ID value under a preference
  key that is dependent on the policy name, so that it will be different
  for each policy.
Add an option to the Entity Creation Preferences panel to disable
completely the ID range policy feature. When that option is enabled,
Protege will ignore any -idranges.owl file.
When the ontology is reloaded for any reason, reload the ID range policy
as well. We do that for two reasons:

* if the ontology has changed externally, there is a chance the ID range
  policy has changed as well;

* it gives users a way of explicitly reloading the policy without having
  to close the ontology and open it again.
@gouttegd gouttegd self-assigned this Nov 1, 2023
@gouttegd gouttegd merged commit d8826be into protegeproject:master Dec 18, 2023
@gouttegd gouttegd deleted the improve-idrange-policy-feature branch December 18, 2023 19:18
@gouttegd
Copy link
Collaborator Author

Been working with that patch for the past 6 weeks now without issue.

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.

1 participant