public void rebuild(OWLSubClassAxiom axiom) { axiom.getSubClass().accept(this); OWLDescription subClass = this.getRelevantDescription(); axiom.getSuperClass().accept(this); OWLDescription superClass = this.getRelevantDescription(); this.rebuiltAxioms.add(this.factory.getOWLSubClassAxiom(subClass, superClass)); }
@Override public void visit(OWLSubClassAxiom owlSubClassAxiom) { // get the complex description out of the axiom List<OWLDescription> descriptions = new ArrayList<OWLDescription>(owlSubClassAxiom.getDescriptions()); for (OWLDescription description : descriptions) { // visit the description and record replacment description.accept(descriptionVisitor); } // construct new Axiom OWLDescription subReplace = descriptionVisitor.getReplacements().get(owlSubClassAxiom.getSubClass()); OWLDescription superReplace = descriptionVisitor.getReplacements().get(owlSubClassAxiom.getSuperClass()); if (subReplace == null) { subReplace = owlSubClassAxiom.getSubClass(); } if (superReplace == null) { superReplace = owlSubClassAxiom.getSuperClass(); } OWLSubClassAxiom replacementAxiom = owlDataFactory.getOWLSubClassAxiom(subReplace, superReplace); // create the changeevents that have to be performed on the ontology try { List<OWLAxiomChange> replaceEvent = OWLUtils.createReplaceAxiomEvents(owlOntology, owlSubClassAxiom, replacementAxiom); axiomChanges.addAll(replaceEvent); } catch (OWLOntologyChangeException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } // clear the description visitor descriptionVisitor.clear(); super.visit(owlSubClassAxiom); }