/** * Compute explanations for an entailed axiom. * * @param axiom entailed axiom to explain * @param ontology ontology to search for explanation * @param reasonerFactory reasoner factory used to create reasoners to test entailments * @param maxExplanations maximum number of explanations to compute * @return explanations */ public static Set<Explanation<OWLAxiom>> explain( OWLAxiom axiom, OWLOntology ontology, OWLReasonerFactory reasonerFactory, int maxExplanations) { logger.debug("Explaining: " + axiom); ExplanationGeneratorFactory<OWLAxiom> genFac = ExplanationManager.createExplanationGeneratorFactory(reasonerFactory); ExplanationGenerator<OWLAxiom> gen = genFac.createExplanationGenerator(ontology); return gen.getExplanations(axiom, maxExplanations); }
/** * Checks to see if a justification for a given entailment is laconic. * @param justification The justification to be checked * @return <code>true</code> if the justification is laconic, otherwise <code>false</code> * @throws ExplanationException If there was a problem. The details of this are implementation specific. */ public boolean isLaconic(Explanation<E> justification) throws ExplanationException { // OBSERVATION: If a justification is laconic, then given its O+, there should be // one justification that is equal to itself. // Could optimise more here - we know that a laconic justification won't contain // equivalent classes axioms, inverse properties axioms etc. If an checker doesn't // appear in O+ then it's not laconic! Set<OWLAxiom> justificationSigmaClosure = computeOPlus(justification.getAxioms()); ExplanationGenerator<E> gen2 = explanationGeneratorFactory.createExplanationGenerator(justificationSigmaClosure); Set<Explanation<E>> exps = gen2.getExplanations(justification.getEntailment(), 2); return Collections.singleton(justification).equals(exps); }
/** * Computes a result, or throws an exception if unable to do so. * @return computed result * @throws Exception if unable to compute a result */ public Set<Explanation<OWLAxiom>> call() throws Exception { found.clear(); ExplanationGenerator<OWLAxiom> delegate = factory.createExplanationGenerator(axioms, this); progressDialog.reset(); try { if (findAllExplanations) { delegate.getExplanations(axiom); } else { delegate.getExplanations(axiom, limit); } } finally { SwingUtilities.invokeLater(() -> progressDialog.setVisible(false)); } return found; }
public Set<Explanation<E>> computePreciseJustsOptimised(E entailment, int l) { this.limit = l; foundLaconicJustifications.clear(); ExplanationGenerator<E> gen = explanationGeneratorFactory.createExplanationGenerator(axioms, this); Set<Explanation<E>> regularJusts = null; try { ExplanationGenerator<E> gen2 = explanationGeneratorFactory.createExplanationGenerator(augmentedAxioms, this);
ExplanationGenerator<OWLAxiom> expGen = delegateFactory.createExplanationGenerator(pool); return expGen.getExplanations(expl.getEntailment());
for (final OWLClass estimatedRoot : estimatedRoots) { ExplanationGeneratorFactory<OWLAxiom> genFac = ExplanationManager.createExplanationGeneratorFactory(reasonerFactory, m); ExplanationGenerator<OWLAxiom> gen = genFac.createExplanationGenerator(allAxioms); OWLDataFactory df = manager.getOWLDataFactory(); Set<Explanation<OWLAxiom>> expls = gen.getExplanations(df.getOWLSubClassOfAxiom(estimatedRoot, df.getOWLNothing()));
ExplanationGenerator<OWLAxiom> expGen = delegateFactory.createExplanationGenerator(pool); return expGen.getExplanations(expl.getEntailment());
ExplanationGenerator<OWLAxiom> expGen = delegate.createExplanationGenerator(pool); return expGen.getExplanations(expl.getEntailment());
ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(flattenedAxioms); Set<Explanation<OWLAxiom>> expls = gen.getExplanations(entailment);
ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(oplusAxioms, new MediatingProgresssMonitor()); Set<Explanation<OWLAxiom>> oplusExpls = gen.getExplanations(entailment);
ExplanationGenerator<OWLAxiom> gen = delegate.createExplanationGenerator(workingAxioms, new MediatingProgresssMonitor()); if (rounds == 1) { regularJustificationsTimer.start(); ExplanationGenerator<OWLAxiom> explanationGenerator = delegate.createExplanationGenerator(sources); Set<Explanation<OWLAxiom>> regularExpls = explanationGenerator.getExplanations(laconicExpl.getEntailment()); try {
ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(oplusAxioms, new MediatingProgresssMonitor()); ExplanationGenerator<OWLAxiom> explanationGenerator = delegateFactory.createExplanationGenerator(sources); Set<Explanation<OWLAxiom>> regularExpls = explanationGenerator.getExplanations(laconicExpl.getEntailment()); try {
private Set<Explanation<OWLAxiom>> computeLaconicExplanations(Explanation<OWLAxiom> explanation, int limit) throws ExplanationException { try { if(modelManager.getReasoner().isConsistent()) { OWLReasonerFactory rf = getReasonerFactory(); ExplanationGenerator<OWLAxiom> g = org.semanticweb.owl.explanation.api.ExplanationManager.createLaconicExplanationGeneratorFactory(rf).createExplanationGenerator(explanation.getAxioms()); return g.getExplanations(explanation.getEntailment(), limit); } else { OWLReasonerFactory rf = getReasonerFactory(); InconsistentOntologyExplanationGeneratorFactory fac = new InconsistentOntologyExplanationGeneratorFactory(rf, Long.MAX_VALUE); LaconicExplanationGeneratorFactory<OWLAxiom> lacFac = new LaconicExplanationGeneratorFactory<>(fac); ExplanationGenerator<OWLAxiom> g = lacFac.createExplanationGenerator(explanation.getAxioms()); return g.getExplanations(explanation.getEntailment(), limit); } } catch (ExplanationException e) { throw new ExplanationException(e); } }