@Override public boolean isCancelled() { return progressMonitor.isCancelled(); } }
/** * Creates an explanation generator factory that will produce explanation generators that generate explanations * as to why an checker is entailed by a set of axioms. * @param reasonerFactory A reasoner factory that can be used for creating new reasoners if necessary * @return An explanation generatory factory that creates explanation generators for entailed axioms */ public static ExplanationGeneratorFactory<OWLAxiom> createExplanationGeneratorFactory(OWLReasonerFactory reasonerFactory, Supplier<OWLOntologyManager> m) { return createExplanationGeneratorFactory(reasonerFactory, null, m); }
public static ExplanationGeneratorFactory<OWLAxiom> createLaconicExplanationGeneratorFactory(OWLReasonerFactory reasonerFactory, Supplier<OWLOntologyManager> m) { return createLaconicExplanationGeneratorFactory(reasonerFactory, null, m); }
/** * 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); }
/** * 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); }
public void foundExplanation(ExplanationGenerator<OWLAxiom> explanationGenerator, Explanation<OWLAxiom> explanation, Set<Explanation<OWLAxiom>> explanations) { progressDialog.getProgressMonitor().foundExplanation(explanationGenerator, explanation, explanations); found.add(explanation); logger.info(MARKER, "Explanation {} found", found.size(), explanation.getEntailment()); }
public void addExplanation(Explanation<E> explanation) { if (!explanation.isEmpty() && allFoundExplanations.add(explanation)) { explanations.add(explanation); Collections.sort(explanations, explanationComparator); progressMonitor.foundExplanation(null, explanation, allFoundExplanations); } }
public int compare(Explanation<OWLAxiom> o1, Explanation<OWLAxiom> o2) { int diff = getAxiomTypes(o1).size() - getAxiomTypes(o2).size(); if (diff != 0) { return diff; } diff = getClassExpressionTypes(o1).size() - getClassExpressionTypes(o2).size(); if (diff != 0) { return diff; } return o1.getSize() - o2.getSize(); } });
private void recordJustification(E entailment, TelemetryInfo findOneInfo, Explanation<E> result) { TelemetryTransmitter transmitter = TelemetryTransmitter.getTransmitter(); if (!result.isEmpty() && entailment instanceof OWLAxiom) { @SuppressWarnings("unchecked") Explanation<OWLAxiom> result2 = (Explanation<OWLAxiom>) result; ExplanationTelemetryWrapper telemetryObject = new ExplanationTelemetryWrapper(result2, m); transmitter.recordObject(findOneInfo, "justification", ".owl.xml", telemetryObject); } }
@Override public ExplanationGenerator<OWLAxiom> createExplanationGenerator(Set<? extends OWLAxiom> axioms) { return createExplanationGenerator(axioms, new NullExplanationProgressMonitor<OWLAxiom>()); }
@Override public void foundExplanation(ExplanationGenerator<OWLAxiom> owlAxiomExplanationGenerator, Explanation<OWLAxiom> owlAxiomExplanation, Set<Explanation<OWLAxiom>> allFoundExplanations) { if (owlAxiomExplanation.equals(laconicExpl)) { preferredLaconicExplanations.add(laconicExpl); cancelled = true; } }
public static <E> Explanation<E> getEmptyExplanation(E entailment) { Set<OWLAxiom> emptySet = Collections.emptySet(); return new Explanation<>(entailment, emptySet); }
public static ExplanationGeneratorFactory<OWLAxiom> createLaconicExplanationGeneratorFactory(OWLReasonerFactory reasonerFactory, ExplanationProgressMonitor<OWLAxiom> progressMonitor, Supplier<OWLOntologyManager> m) { return new LaconicExplanationGeneratorFactory<>(createExplanationGeneratorFactory(reasonerFactory, m), m); }
@Override public boolean isCancelled() { return progressMonitor.isCancelled(); } }
@Override public ExplanationGenerator<OWLAxiom> createExplanationGenerator(OWLOntology ontology) { return createExplanationGenerator(ontology, new NullExplanationProgressMonitor<OWLAxiom>()); }
public static <E> ExplanationGeneratorFactory<E> createLaconicExplanationGeneratorFactory(EntailmentCheckerFactory<E> entailmentCheckerFactory, Supplier<OWLOntologyManager> m) { return new LaconicExplanationGeneratorFactory<>(createExplanationGeneratorFactory(entailmentCheckerFactory, m), m); } }
@Override public boolean isCancelled() { return progressMonitor.isCancelled(); } }
public boolean isCancelled() { return progressDialog.getProgressMonitor().isCancelled(); } }
/** * Determines if the process of finding laconic justifications is cancelled. This is called by our delegate and * by us as a check to see if we can break out. We don't have to continue finding laconic justifications if we have * found enough justifications up to the limit. * @return <code>true</code> if cancelled or <code>false</code> if not cancelled */ @Override public boolean isCancelled() { return isAtFoundLaconicJustificationsLimit() || progressMonitor.isCancelled(); }