protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }
protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }
protected void amalgamate(OWLOntology ont, OWLClass cls) { List<OWLSubClassOfAxiom> axioms = asList(ont.subClassAxiomsForSubClass(cls)); if (axioms.size() < 2) { return; } axioms.forEach(ax -> addChange(new RemoveAxiom(ont, ax))); Stream<OWLClassExpression> superclasses = axioms.stream() .map(OWLSubClassOfAxiom::getSuperClass); OWLObjectIntersectionOf intersection = df.getOWLObjectIntersectionOf(superclasses); addChange(new AddAxiom(ont, df.getOWLSubClassOfAxiom(cls, intersection))); } }