Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relax is currently incomplete #1183

Open
cmungall opened this issue Feb 9, 2024 · 4 comments
Open

relax is currently incomplete #1183

cmungall opened this issue Feb 9, 2024 · 4 comments
Assignees

Comments

@cmungall
Copy link
Contributor

cmungall commented Feb 9, 2024

A subClassOf B and R some C is currently shielded from relax.

This has a long chain of unintended consequences...

chatgpt suggests the following which I think is correct:

// Assuming ontology is already loaded into an OWLOntology object named 'ontology'
OWLDataFactory factory = OWLManager.getOWLDataFactory();

for (OWLSubClassOfAxiom axiom : ontology.getAxioms(AxiomType.SUBCLASS_OF)) {
    // Check if the RHS is an ObjectIntersectionOf
    if (axiom.getSuperClass() instanceof OWLObjectIntersectionOf) {
        OWLObjectIntersectionOf intersection = (OWLObjectIntersectionOf) axiom.getSuperClass();
        OWLClassExpression subclass = axiom.getSubClass();
        
        // Remove the original axiom
        ontology.removeAxiom(axiom);
        
        // Create and add new axioms for each part of the intersection
        for (OWLClassExpression part : intersection.getOperands()) {
            OWLSubClassOfAxiom newAxiom = factory.getOWLSubClassOfAxiom(subclass, part);
            ontology.addAxiom(newAxiom);
        }
    }
}

// Save the ontology or perform further processing

I don't think we need to worry about inner ANDs, so no need for conversion to NNF or anything

@cmungall
Copy link
Contributor Author

cmungall commented Feb 9, 2024

For now I am relaxing in place using this

(perl, functional syntax, and ChatGPT... what could go wrong?)

@matentzn matentzn self-assigned this Feb 10, 2024
@cmungall
Copy link
Contributor Author

cmungall commented Mar 7, 2024

Additionally it would be useful to do relaxation of cardinality constraints too.

E.g.

id: UPa:UCR00783
name: H(2)O + ferricytochrome c + nitric oxide = H(+) + ferrocytochrome c + nitrite
namespace: reaction
xref: KEGG:R00783 "KEGG reaction"
xref: RHEA:15236 "Rhea reaction"
xref: METACYC:NITRITE-REDUCTASE-CYTOCHROME-RXN "MetaCyc REACTION" {source=Rhea,source=MetaCyc}
relationship: has_input_compound UPa:UPC00001 {cardinality="1"} ! UPa:UPC00001 ! H(2)O
relationship: has_input_compound UPa:UPC00125 {cardinality="1"} ! UPa:UPC00125 ! ferricytochrome c
relationship: has_input_compound UPa:UPC00533 {cardinality="1"} ! UPa:UPC00533 ! nitric oxide
relationship: has_output_compound UPa:UPC00080 {cardinality="1"} ! UPa:UPC00080 ! H(+)
relationship: has_output_compound UPa:UPC00088 {cardinality="1"} ! UPa:UPC00088 ! nitrite
relationship: has_output_compound UPa:UPC00126 {cardinality="1"} ! UPa:UPC00126 ! ferrocytochrome c
relationship: part_of UPa:UER00707 {cardinality="1", order="1", direction="RL"}

Should generate someValuesFrom on relaxation

cmungall added a commit to geneontology/unipathway that referenced this issue Mar 7, 2024
@gouttegd
Copy link
Contributor

Is that really within the scope of relax though?

ROBOT currently defines the relax operation as being solely about removing equivalence axioms:

Robot can be used to relax Equivalence Axioms to weaker SubClassOf axioms.
[…]
Many ontology make use of OWL EquivalenceAxioms, particularly during the development cycle. These are required for being able to use the reason command to classify an ontology. However, many downstream applications are not equipped to use these. […] The relax command allows us to capture some of the information in a form that is accessible to basic downstream applications.

matentzn added a commit that referenced this issue Mar 10, 2024
@matentzn matentzn mentioned this issue Mar 10, 2024
5 tasks
@matentzn
Copy link
Contributor

Relax is doing two things:

  1. Relaxing EquivalentClasses to SubClassOf
  2. Relaxing complex conjunctive expressions to individual SubClassOf axioms

So I think this is in scope.

I have now implemented some of this in #1188:

  • A subClassOf B and R some C can now optionally be processed the same way as A EquivalentTo B and R some C

Note: cardinality constraints of the type you mention where always processed the way @cmungall is saying; I didnt touch this code, but added a test that illustrates this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants