robot icon indicating copy to clipboard operation
robot copied to clipboard

Removing annotation properties can lead to duplicated axioms

Open gouttegd opened this issue 9 months ago • 2 comments

The remove command sometimes leads to duplicated axioms when producing OFN output.

This is best illustrated by an example. Let us consider the following minimal ontology:

Prefix(EX:=<http://example.org/EX_>)
Prefix(oboInOwl:=<http://www.geneontology.org/formats/oboInOwl#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)

Ontology(
Declaration(Class(EX:0001))
Declaration(Class(EX:0002))
Declaration(AnnotationProperty(oboInOwl:hasExactSynonym))
Declaration(AnnotationProperty(oboInOwl:is_inferred))

# Class: EX:0001
AnnotationAssertion(rdfs:label EX:0001 "my class")
AnnotationAssertion(oboInOwl:hasExactSynonym EX:0001 "my node")
SubClassOf(Annotation(oboInOwl:is_inferred "true"^^xsd:boolean) EX:0001 EX:0002)
)

Now let us remove all annotation properties except rdfs:label and oboInOwl:is_inferred:

$ robot remove --input ex1.ofn \
               --term rdfs:label --term oboInOwl:is_inferred --select complement \
               --select annotation-properties \
               --output ex1-filtered.ofn

This is the result (omitting prefix and entity declarations):

AnnotationAssertion(rdfs:label EX:0001 "my class")
SubClassOf(EX:0001 EX:0002)
SubClassOf(Annotation(oboInOwl:is_inferred "true"^^xsd:boolean) EX:0001 EX:0002)

The oboInOwl:hasExactSynonym annotation assertion axiom is removed as expected, but note how there are now two SubClassOf axioms: one with the oboInOwl:is_inferred annotation preserved (as expected), and one without that annotation.

gouttegd avatar Jan 14 '25 12:01 gouttegd