/** * Gets axioms that have a LHS corresponding to the specified entity. * * @param lhs The entity that occurs on the left hand side of the axiom. * @return A set of axioms that have the specified entity as their left hand side. */ private Set<OWLAxiom> getAxiomsForLHS(OWLEntity lhs) { return getIndexedSet(lhs, lhs2AxiomMap, true); }
private List<OWLEntity> getRHSEntitiesSorted(OWLAxiom ax) { Collection<OWLEntity> entities = getRHSEntities(ax); List<OWLEntity> sortedEntities = new ArrayList<OWLEntity>(entities); Collections.sort(sortedEntities, new Comparator<OWLObject>() { public int compare(OWLObject o1, OWLObject o2) { if (o1 instanceof OWLProperty) { return -1; } else { return 1; } } }); return sortedEntities; }
continue; Set<OWLAxiom> mapped = getIndexedSet(entity, mappedAxioms, true); if (consumedAxioms.contains(ax) || mapped.contains(ax) || currentPath.contains(ax)) { continue; ExplanationTree child = new ExplanationTree(ax); tree.addChild(child); for (OWLEntity ent : getRHSEntitiesSorted(ax)) { insertChildren(ent, child); sortChildrenAxioms(tree);
public ExplanationTree getOrderedExplanation(OWLAxiom entailment, Set<OWLAxiom> axioms) { buildIndices(); insertChildren(currentSource, root); currentTarget = seedExtractor.getTarget(entailment);
private void buildIndices() { reset(); AxiomMapBuilder builder = new AxiomMapBuilder(); for (OWLAxiom ax : currentExplanation) { ax.accept(builder); } try { if (ont != null) { man.removeOntology(ont); } ont = man.createOntology(IRI.create("http://www.semanticweb.org/ontology" + System.currentTimeMillis())); List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLAxiom ax : currentExplanation) { changes.add(new AddAxiom(ont, ax)); ax.accept(builder); } man.applyChanges(changes); } catch (OWLOntologyCreationException e) { throw new OWLRuntimeException(e); } }
private Collection<OWLEntity> getRHSEntities(OWLAxiom axiom) { return getIndexedSet(axiom, entitiesByAxiomRHS, true); }
private void indexAxiomsByRHSEntities(OWLObject rhs, OWLAxiom axiom) { OWLEntityCollector collector = new OWLEntityCollector(); rhs.accept(collector); getIndexedSet(axiom, entitiesByAxiomRHS, true).addAll(collector.getObjects()); }