Skip to content

Commit

Permalink
Remove restriction on ROBOT repair to work only on annotation axioms
Browse files Browse the repository at this point in the history
For some reason, ROBOT repair --merge-axiom-annotations not only was restricted to annotation axioms (which is wrong), it also drops logical axioms with annotations as they are (1) first added to the heap of axioms that need to be processed, (2) dropped from the ontology because they are in that heap and finally (3) because of the wrong conditional we are fixing here, not added back.

Adding and example for axiom annotation merging on subclass axioms to our test case
  • Loading branch information
matentzn committed Nov 11, 2024
1 parent 0acc87e commit c4e9708
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
16 changes: 15 additions & 1 deletion docs/examples/uberon_axiom_annotation_merged.owl
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,16 @@



<!-- http://purl.obolibrary.org/obo/ROBOT_SuperClass -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>



<!-- http://purl.obolibrary.org/obo/UBERON_0000062 -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/UBERON_0000062">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/BFO_0000050"/>
Expand All @@ -268,6 +275,13 @@
<oboInOwl:id>UBERON:0000062</oboInOwl:id>
<rdfs:label>organ</rdfs:label>
</owl:Class>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
<owl:annotatedTarget rdf:resource="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>
<rdfs:comment>Comment A</rdfs:comment>
<rdfs:comment>Comment B</rdfs:comment>
</owl:Axiom>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
Expand All @@ -293,5 +307,5 @@



<!-- Generated by the OWL API (version 4.5.26) https://github.com/owlcs/owlapi -->
<!-- Generated by the OWL API (version 4.5.29) https://github.com/owlcs/owlapi -->

19 changes: 19 additions & 0 deletions docs/examples/uberon_axiom_annotation_merging.owl
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,16 @@



<!-- http://purl.obolibrary.org/obo/ROBOT_SuperClass -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>



<!-- http://purl.obolibrary.org/obo/UBERON_0000062 -->

<owl:Class rdf:about="http://purl.obolibrary.org/obo/UBERON_0000062">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/BFO_0000050"/>
Expand All @@ -268,6 +275,18 @@
<oboInOwl:id>UBERON:0000062</oboInOwl:id>
<rdfs:label>organ</rdfs:label>
</owl:Class>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
<owl:annotatedTarget rdf:resource="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>
<rdfs:comment>Comment A</rdfs:comment>
</owl:Axiom>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
<owl:annotatedTarget rdf:resource="http://purl.obolibrary.org/obo/ROBOT_SuperClass"/>
<rdfs:comment>Comment B</rdfs:comment>
</owl:Axiom>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ public static void mergeAxiomAnnotations(OWLOntology ontology) {
Set<OWLAxiom> newAxioms = new HashSet<>();
for (Map.Entry<OWLAxiom, Set<OWLAnnotation>> mergedAxiom : mergedAxioms.entrySet()) {
OWLAxiom axiom = mergedAxiom.getKey();
if (axiom.isAnnotationAxiom()) {
OWLAxiom newAxiom = axiom.getAnnotatedAxiom(mergedAxiom.getValue());
newAxioms.add(newAxiom);
}
OWLAxiom newAxiom = axiom.getAnnotatedAxiom(mergedAxiom.getValue());
newAxioms.add(newAxiom);
}
manager.addAxioms(ontology, newAxioms);
}
Expand Down

0 comments on commit c4e9708

Please sign in to comment.