robot
robot copied to clipboard
Overlap command? It would be nice to compute overlap between two or more OWL files
It would be nice to compute overlap, where it would most easily be defined as shared IRIs. The basic overlap command would NOT be lexically driven (that gets complicated quickly).
The output could be configurable, but at a minimum, if two OWL files have the same IRI, output the IRI, the rdfs:label, and the type of object (owl:Class, owl:ObjectProperty, etc.). Of course that raises issues such as (1) what if the two OWL files have different labels (output them both vs. one vs. the other) and less likely but certainly worse (2) one OWL file says owl:Class and the other says owl:ObjectProperty (although you'd certainly want to know that too!).
There's almost certainly issues with imports. Probably need to just bring those in and merge and then overlap, although that might a configurable option at some point.
Obviously, many ontologies compared in this manner will show things that they both import like BFO or IAO, but right now I want to see that. The fact that they both have BFO as top level, or that they both import IAO, is interesting to me. I can see other use cases where some might like to see more concise results that exclude those things.
I thought about whether it's possible to do this with sequential diffs, but I am not sure (for starters, is the diff an OWL file?).
@hoganwr one way you could do this is with three applications of unmerge:
robot unmerge -i left.owl -i right.owl -o only-left.owl
robot unmerge -i right.owl -i left.owl -o only-right.owl
robot merge -i left.owl -i right.owl unmerge -i only-left.owl -i only-right.owl -o intersection.owl
This should give you an ontology that has only the axioms shared between the two.
I can see how this would be useful. I don't have time for ROBOT development at the moment, myself.
Another workaround: If you're focused on a table of ID,LABEL,TYPE, then you could robot export from the two ontologies (make sure they're sorted), then use a Unix utility such as comm, or something more like SQL join, to find the common rows.
Thanks for the suggestions. Both work, and in my use case, both produced slightly different results. These differences are quite interesting (to me at least LOL).
First, Jim's method: it leaves out one class, call it Class A, where the two OWL files that have completely different subClassOf axioms for it. Ontology X says Class A subClassOf Class B, whereas Ontology Y says Class A subClassOf Class C, and Class A subClassOf Class D. So that's what you would expect. None of the subClassOf axioms are shared between the two ontologies, so they are all omitted. There is a blob of RDF/XML in the intersection with the class IRI annotated with its label, but it doesn't show up in Protege for some reason (and even searching for a bit of the IRI and the label both return nothing)
Second, James' method: the intersection leaves out when the labels differ, which is expected. So if you leave out the label, you get a more complete, but somewhat harder to read, result. Of course, you can figure out a way to paste on the labels.
James O: since you don't have time for this, should we close it now?
On Wed, Dec 4, 2024 at 9:12 AM James A. Overton @.***> wrote:
I can see how this would be useful. I don't have time for ROBOT development at the moment, myself.
Another workaround: If you're focused on a table of ID,LABEL,TYPE, then you could robot export from the two ontologies (make sure they're sorted), then use a Unix utility such as comm, or something more like SQL join, to find the common rows.
— Reply to this email directly, view it on GitHub https://github.com/ontodev/robot/issues/1232#issuecomment-2517717701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR55U7AOVQEUWAUR4FTRL2D4LUTAVCNFSM6AAAAABS6WMVQ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJXG4YTONZQGE . You are receiving this because you were mentioned.Message ID: @.***>
There is a blob of RDF/XML in the intersection with the class IRI annotated with its label, but it doesn't show up in Protege for some reason (and even searching for a bit of the IRI and the label both return nothing)
Educated guess: the class declaration axiom is found in both and so removed. Then when ROBOT writes the label axiom, it's not attached to any entity; just a label axiom on a bare IRI. Protégé isn't able to show those annotations unfortunately. I think somebody should add a panel which can show these annotations.
Why not https://robot.obolibrary.org/diff? Just filter the output for declaration changes or label changes depending on use case. If the filtering is a bit janky then I would focus on adding axiom type filters to the existing diff than a new command
James O: since you don't have time for this, should we close it now?
I don't mind leaving the issue open. Your choice.
Here's another approach I did that I like: https://github.com/mcwdsi/onto-intersect