robot icon indicating copy to clipboard operation
robot copied to clipboard

Robot diff labels are not appearing correctly

Open allenbaron opened this issue 3 years ago • 3 comments

For some reason when I do a diff of two OWL files created from NCBITaxon, the labels appear to be replaced by IDs when the newer ontology is set as --right.

Command:

robot diff \
 --left ncbitaxon_import.owl \
 --right ncbitaxon_import.new.owl \
 --output ncbitaxon_diff.html \
 --format html

Results: image

image

If I run the diff in reverse the labels appear as expected without error.

Command:

robot diff \
 --right ncbitaxon_import.owl \
 --left ncbitaxon_import.new.owl \
 --output ncbitaxon_diff-rev.html \
 --format html

Results: image

image

This behavior is not limited to html output. I get the same results for other formats that use labels (e.g. markdown, pretty) and --labels TRUE with no format set. It's also not limited to Robot 1.9.0; I get the same results with 1.8.3.

Any idea what's going on?

Files
Software Setup
ROBOT version 1.9.0
java 17.0.3.1 2022-04-22 LTS
Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

MacOS 12.4, ARM processor

allenbaron avatar Jul 12 '22 21:07 allenbaron

@allenbaron I think only the left ontology is being used for labels. I'll fix it.

balhoff avatar Jul 12 '22 21:07 balhoff

I was wrong, we are actually providing both ontologies as label sources: https://github.com/ontodev/robot/blob/c7071a76178967639af30d2f56d5ca05644230b7/robot-core/src/main/java/org/obolibrary/robot/DiffOperation.java#L119-L121

But this isn't working as expected, because it turns out that OWL API has a flawed implementation of equals for OWLOntology: https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLImmutableOntologyImpl.java#L1058-L1068

So putting two ontologies which have the same ontology ID into a set doesn't add both, even if they have different axioms.

balhoff avatar Jul 13 '22 15:07 balhoff

You're right. I didn't notice that the reverse diff is also using IDs instead of labels for terms that are "added". Changing the ontology IRI of either file fixes the problem and makes the diff much easier to read.

Now I know I can change the IRI in one of the files before I do a diff as a workaround.

Thanks @balhoff.

allenbaron avatar Jul 13 '22 15:07 allenbaron