/** * Get sub-concepts of an ontology * @param ont Ontology * @param sc Set of subconcepts * @return Updated set of subconcepts */ protected Set<OWLClassExpression> getSubConcepts(OWLOntology ont, Set<OWLClassExpression> sc) { Set<OWLLogicalAxiom> axs = ont.getLogicalAxioms(); for(OWLAxiom ax : axs) { Set<OWLClassExpression> ax_sc = ax.getNestedClassExpressions(); for(OWLClassExpression ce : ax_sc) { if(!sc.contains(ce) && !ce.isOWLThing() && !ce.isOWLNothing()) { if(ce.isAnonymous() && sigma.containsAll(ce.getClassesInSignature())) { sc.add(ce); getSubConcepts(ce, sc); } } } } return sc; }
/** * Get sub-concepts of an ontology * @param ont Ontology * @param sc Set of subconcepts * @return Updated set of subconcepts */ private Set<OWLClassExpression> getSubConcepts(OWLOntology ont, Set<OWLClassExpression> sc) { Set<OWLLogicalAxiom> axs = ont.getLogicalAxioms(); for(OWLAxiom ax : axs) { Set<OWLClassExpression> ax_sc = ax.getNestedClassExpressions(); for(OWLClassExpression ce : ax_sc) { if(!sc.contains(ce) && !ce.isOWLThing() && !ce.isOWLNothing()) { if(ce.isAnonymous()) { sc.add(ce); getSubConcepts(ce, sc); } } } } return sc; }
private void applyToReasoner(Set<OWLLogicalAxiom> axioms, boolean add) { List<OWLOntologyChange> changes = add ? manager.addAxioms(initial, axioms) : manager.removeAxioms(initial, axioms); manager.applyChanges(changes); reasoner.flush(); }
private static void printLogicalAxioms(Set<OWLLogicalAxiom> logicalAxioms) { System.out.println("ALL LOGICAL AXIOMS (" + logicalAxioms.size() + ")"); }