ontodev / robot

ROBOT is an OBO Tool
http://robot.obolibrary.org
BSD 3-Clause "New" or "Revised" License
264 stars 74 forks source link

robot remove --axioms external is removing an internal axiom #1197

Closed Clare72 closed 6 months ago

Clare72 commented 6 months ago

We have the following object property in FBdv:

[Typedef]
id: FBdv:00018001
name: substage of
namespace: relationship
def: "A relation between a developmental stage and another, larger developmental stage during which it happens." [FBC:DPG]
comment: Creating this relation as a temporary fix, pending adding the axiom occurrent_part_of subproperty of happens_during to RO.
is_transitive: true
is_a: RO:0002012 ! occurrent part of
is_a: RO:0002092 ! happens during

The command (from ODK) for making the -base artefact of FBdv is currently the following:

robot --catalog catalog-v001.xml merge --input tmp/fbdv-preprocess.owl  \
reason --reasoner ELK --equivalent-classes-allowed none --exclude-tautologies structural --annotate-inferred-axioms False \
relax \
reduce -r ELK \
remove --base-iri http://purl.obolibrary.org/obo/FBdv_ --base-iri http://purl.obolibrary.org/obo/fbdv_ --axioms external --preserve-structure false --trim false \
 \
annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
    --ontology-iri http://purl.obolibrary.org/obo/fbdv/fbdv-base.owl annotate -V http://purl.obolibrary.org/obo/fbdv/releases/2024-04-25/fbdv-base.owl --annotation owl:versionInfo 2024-04-25 \
    --annotation oboInOwl:date "25:04:2024 13:31" --output fbdv-base.owl.tmp.owl && mv fbdv-base.owl.tmp.owl fbdv-base.owl

If I run this as-is, the transitivity axiom is lost in FBdv-base.owl:

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

    <owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/FBdv_00018001">
        <rdfs:subPropertyOf rdf:resource="http://purl.obolibrary.org/obo/RO_0002012"/>
        <rdfs:subPropertyOf rdf:resource="http://purl.obolibrary.org/obo/RO_0002092"/>
        <obo:IAO_0000115>A relation between a developmental stage and another, larger developmental stage during which it happens.</obo:IAO_0000115>
        <oboInOwl:hasOBONamespace>relationship</oboInOwl:hasOBONamespace>
        <oboInOwl:id>FBdv:00018001</oboInOwl:id>
        <rdfs:comment>Creating this relation as a temporary fix, pending adding the axiom occurrent_part_of subproperty of happens_during to RO.</rdfs:comment>
        <rdfs:label>substage of</rdfs:label>
    </owl:ObjectProperty>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/FBdv_00018001"/>
        <owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
        <owl:annotatedTarget>A relation between a developmental stage and another, larger developmental stage during which it happens.</owl:annotatedTarget>
        <oboInOwl:hasDbXref>FBC:DPG</oboInOwl:hasDbXref>
    </owl:Axiom>

I can restore the transitivity axiom by deleting the remove step from the command chain:

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

    <owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/FBdv_00018001">
        <rdfs:subPropertyOf rdf:resource="http://purl.obolibrary.org/obo/RO_0002012"/>
        <rdfs:subPropertyOf rdf:resource="http://purl.obolibrary.org/obo/RO_0002092"/>
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/>
        <obo:IAO_0000115>A relation between a developmental stage and another, larger developmental stage during which it happens.</obo:IAO_0000115>
        <oboInOwl:hasOBONamespace>relationship</oboInOwl:hasOBONamespace>
        <oboInOwl:id>FBdv:00018001</oboInOwl:id>
        <rdfs:comment>Creating this relation as a temporary fix, pending adding the axiom occurrent_part_of subproperty of happens_during to RO.</rdfs:comment>
        <rdfs:label>substage of</rdfs:label>
    </owl:ObjectProperty>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/FBdv_00018001"/>
        <owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
        <owl:annotatedTarget>A relation between a developmental stage and another, larger developmental stage during which it happens.</owl:annotatedTarget>
        <oboInOwl:hasDbXref>FBC:DPG</oboInOwl:hasDbXref>
    </owl:Axiom>

From the remove documentation:

The --base-iri <namespace> is a special option for use with internal and external axioms. It allows you to specify one or more “base namespaces” (e.g., --base-iri http://purl.obolibrary.org/obo/OBI_). You can also use any defined prefix (e.g., --base-iri OBI) An axiom is considered internal if the subject is in one of the base namespaces.

I think that the <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#TransitiveProperty"/> axiom should be considered internal, since its subject is http://purl.obolibrary.org/obo/FBdv_00018001 and we are using --base-iri http://purl.obolibrary.org/obo/FBdv_, so should not be removed when using --axioms external

CC @matentzn @gouttegd

matentzn commented 6 months ago

Already fixed here: https://github.com/ontodev/robot/pull/1187

Clare72 commented 6 months ago

Great that it is fixed, but a shame I spent so much time troubleshooting and making this ticket! Do you know when this update will make it through into ODK?

matentzn commented 6 months ago

I think soon. We will make a ROBOT release as soon as @jamesaoverton have had enough air to power through the open PRs, and one day later a ODK minor release

gouttegd commented 6 months ago

@matentzn It’d be nice to have a OWLAPI release before we got a ROBOT release. There are a couple of important bug fixes in the yet-to-be-released 4.5.27.