Fix repair --merge-axiom-annotations
#1240
Open
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.
Resolves [#1239]
docs/
have been added/updatedmvn verify
says all tests passmvn site
says all JavaDocs correctCHANGELOG.md
has been updatedThe
RepairOperation::mergeAxiomAnnotations()
method only ever looks at annotated axioms. As a result, it misses the case where the ontology contains both an unannotated axiom and one (or more) annotated version(s) of that same axiom. For example:The last two axioms would be merged into a single one carrying the two comments, but the first axiom would remain distinct:
This PR fixes the issue by rewriting the method to look at all axioms, whether they are annotated or not.
Theoretically, this is slightly inefficient as axioms that are not annotated and that do not have any annotated duplicate (which probably represent the majority of axioms in most ontologies) would still be forcibly removed and then added back. However I do not think that a more elaborated approach would yield enough performance gain to be worth the increased complexity. For what it’s worth, on my machine and with Uberon, the rewritten method is about 20% slower than the original (incorrect) one (running in ~5 seconds instead of ~4 seconds).
Importantly, the test file for this feature had to be converted from RDF/XML to OFN in order to add an instance of an unannotated axiom alongside annotated duplicates of the same axiom -- something the RDF/XML format does not allow to represent).