robot icon indicating copy to clipboard operation
robot copied to clipboard

diff feature request: sort axioms in Added and Removed sections in Markdown output

Open jclerman opened this issue 1 year ago • 4 comments
trafficstars

Currently the Markdown output of robot diff ... -f markdown seems to randomly order the lines under "Added" or "Removed" for each changed entity (e.g., class).

I think the output would be much easier to read (and compare, when needed) if it had a canonical sort-order for those lines. I'd prefer an order like:

  • declaration axiom
  • equivalency axiom(s)
  • subclass axiom(s)
  • annotation axioms, themselves sorted by
    • annotation property label
    • value

jclerman avatar Apr 05 '24 01:04 jclerman

I believe that https://github.com/balhoff/owl-diff is doing the work for ROBOT here. Do you have suggestions @balhoff ?

jamesaoverton avatar Apr 05 '24 14:04 jamesaoverton

I agree that a standard ordering would make sense. I'm not sure how quickly I can get to that—PRs are definitely welcome.

balhoff avatar Apr 08 '24 15:04 balhoff

I was looking at this over the weekend. If I understand the code correctly, the lines that govern the sort-order within each altered OWL entity (for MarkDown output, anyway) are https://github.com/balhoff/owl-diff/blob/master/src/main/scala/org/geneontology/owl/differ/render/MarkdownGroupedDiffRenderer.scala#L41-L43. I'm not sure if I'm getting that right though, since in my hands, the sort seems to be random, whereas that code suggests that some ordering is expected.

@balhoff, should I open an issue against https://github.com/balhoff/owl-diff to track this request?

jclerman avatar Jun 10 '24 16:06 jclerman

@balhoff, should I open an issue against https://github.com/balhoff/owl-diff to track this request?

@jclerman that sounds good. Looking at it, I think the lines are "mostly sorted". It looks like annotations should be in alphabetical order by their toString representation, and overall axioms are in alphabetical order by their axiom type (but things like subclass axioms may not be reliably sorted against each other). I think your ordering makes sense except that I would prefer the annotation axioms to come after the declaration axiom.

balhoff avatar Jun 10 '24 17:06 balhoff