Skip to content

Commit

Permalink
Merge pull request #1223 from ontodev/fix-repair-merge-axiom-annotations
Browse files Browse the repository at this point in the history
Fix repair merge axiom annotations
  • Loading branch information
jamesaoverton authored Nov 12, 2024
2 parents 4eb86f5 + 1d3a6ba commit 82daac6
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Output inferred object property assertions using Whelk reasoner, by updating to Whelk 1.1.3. [#1121]
- Bug was fixed that caused logical axioms with axiom annotations not to be processed correctly when merging axiom annotations [#1223]

### Changed
- Update Whelk to 1.2.1 [#1221]
Expand Down
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 -->

95 changes: 59 additions & 36 deletions docs/examples/uberon_axiom_annotation_merging.owl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0"?>
<rdf:RDF xmlns="http://purl.obolibrary.org/obo/uberon.owl#"
xml:base="http://purl.obolibrary.org/obo/uberon.owl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:obo="http://purl.obolibrary.org/obo/"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:obo="http://purl.obolibrary.org/obo/"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#">
<owl:Ontology rdf:about="http://purl.obolibrary.org/obo/uberon.owl"/>


Expand Down Expand Up @@ -214,11 +214,11 @@
<owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/BFO_0000050">
<owl:inverseOf rdf:resource="http://purl.obolibrary.org/obo/BFO_0000051"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">BFO:0000050</oboInOwl:hasDbXref>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">uberon</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">part_of</oboInOwl:id>
<oboInOwl:shorthand rdf:datatype="http://www.w3.org/2001/XMLSchema#string">part_of</oboInOwl:shorthand>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">part_of</rdfs:label>
<oboInOwl:hasDbXref>BFO:0000050</oboInOwl:hasDbXref>
<oboInOwl:hasOBONamespace>uberon</oboInOwl:hasOBONamespace>
<oboInOwl:id>part_of</oboInOwl:id>
<oboInOwl:shorthand>part_of</oboInOwl:shorthand>
<rdfs:label>part_of</rdfs:label>
</owl:ObjectProperty>


Expand All @@ -227,11 +227,11 @@

<owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/BFO_0000051">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">BFO:0000051</oboInOwl:hasDbXref>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">uberon</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has_part</oboInOwl:id>
<oboInOwl:shorthand rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has_part</oboInOwl:shorthand>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has_part</rdfs:label>
<oboInOwl:hasDbXref>BFO:0000051</oboInOwl:hasDbXref>
<oboInOwl:hasOBONamespace>uberon</oboInOwl:hasOBONamespace>
<oboInOwl:id>has_part</oboInOwl:id>
<oboInOwl:shorthand>has_part</oboInOwl:shorthand>
<rdfs:label>has_part</rdfs:label>
</owl:ObjectProperty>


Expand All @@ -247,62 +247,85 @@



<!-- 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"/>
<owl:someValuesFrom rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000467"/>
</owl:Restriction>
</rdfs:subClassOf>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Anatomical structure that performs a specific function or group of functions [WP].</obo:IAO_0000115>
<obo:IAO_0000115>Anatomical structure that performs a specific function or group of functions [WP].</obo:IAO_0000115>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page1"/>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page2"/>
<oboInOwl:hasDbXref rdf:resource="http://linkedlifedata.com/resource/umls/id/C0178784"/>
<oboInOwl:hasDbXref rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Organ"/>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">WBbt:0003760</oboInOwl:hasDbXref>
<oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">anatomical unit</oboInOwl:hasRelatedSynonym>
<oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">body organ</oboInOwl:hasRelatedSynonym>
<oboInOwl:hasRelatedSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">element</oboInOwl:hasRelatedSynonym>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">UBERON:0000062</oboInOwl:id>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">organ</rdfs:label>
<oboInOwl:hasDbXref>WBbt:0003760</oboInOwl:hasDbXref>
<oboInOwl:hasRelatedSynonym>anatomical unit</oboInOwl:hasRelatedSynonym>
<oboInOwl:hasRelatedSynonym>body organ</oboInOwl:hasRelatedSynonym>
<oboInOwl:hasRelatedSynonym>element</oboInOwl:hasRelatedSynonym>
<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.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">body organ</owl:annotatedTarget>
<oboInOwl:source rdf:resource="http://en.wikipedia.org/wiki/page1"/>
<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.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">body organ</owl:annotatedTarget>
<oboInOwl:source rdf:resource="http://en.wikipedia.org/wiki/page2"/>
<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"/>
<owl:annotatedTarget>Anatomical structure that performs a specific function or group of functions [WP].</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page1"/>
</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"/>
<owl:annotatedTarget>Anatomical structure that performs a specific function or group of functions [WP].</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page2"/>
</owl:Axiom>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/UBERON_0000062"/>
<owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">body organ</owl:annotatedTarget>
<owl:annotatedTarget>body organ</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:resource="UBERON:123"/>
</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"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Anatomical structure that performs a specific function or group of functions [WP].</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page1"/>
<owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
<owl:annotatedTarget>body organ</owl:annotatedTarget>
<oboInOwl:source rdf:resource="http://en.wikipedia.org/wiki/page1"/>
</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"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Anatomical structure that performs a specific function or group of functions [WP].</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:resource="http://en.wikipedia.org/wiki/page2"/>
<owl:annotatedProperty rdf:resource="http://www.geneontology.org/formats/oboInOwl#hasRelatedSynonym"/>
<owl:annotatedTarget>body organ</owl:annotatedTarget>
<oboInOwl:source rdf:resource="http://en.wikipedia.org/wiki/page2"/>
</owl:Axiom>




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

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



<!-- Generated by the OWL API (version 0.0.1-SNAPSHOT) https://github.com/owlcs/owlapi -->
<!-- Generated by the OWL API (version 4.5.26.2023-07-17T20:34:13Z) https://github.com/owlcs/owlapi -->

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 82daac6

Please sign in to comment.