-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
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 processingI don't think we need to worry about inner ANDs, so no need for conversion to NNF or anything
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels