Allow selecting punned entities in remove and filter command
#1251
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.
docs/have been added/updatedmvn verifysays all tests passmvn sitesays all JavaDocs correctCHANGELOG.mdhas been updatedCurrently, the
removeandfiltercommands completely ignore punned entities. That is, if the ontology contains, for example, both a class and an individual with the same IRIhttp://purl.obolibrary.org/obo/UO_0000039, thenrobot remove --term UO:0000039will fail to remove anything.This is because the
OntologyHelper#getEntities()method, and theOntologyHelper#getEntity()it calls in turn, does not expect any IRI to match more than exactly one entity (OntologyHelper#getEntity()explicitly throws an exception if it finds more than one entity).This PR adds a
--allow-punning(defaulting to false, preserving the default behaviour) to theremoveandfiltercommand. When set to true, whenever a term IRI matches several entities, all matching entities will be selected.This is particularly useful when dealing with the UO ontology, which makes intensive use of punning (most if not all units in that ontology are defined both as a class and as an individual).