Skip to content

relax is currently incomplete #1183

@cmungall

Description

@cmungall

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions