/** * Constructs a blackbox explanation generator. * @param axioms The ontologies that provide the source axioms for the explanation * @param checkerFactory A factory that creates the appropriate entailment checkers for the * type of entailment being explained. * @param expansionStrategy The strategy used during the expansion phase * @param contractionStrategy The strategy to be used during the contraction phase * @param progressMonitor A progress monitor - may be <code>null</code> */ public BlackBoxExplanationGenerator2(Set<? extends OWLAxiom> axioms, EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy<E> expansionStrategy, ContractionStrategy<E> contractionStrategy, ExplanationProgressMonitor<E> progressMonitor, Supplier<OWLOntologyManager> m) { workingAxioms = new HashSet<>(axioms); this.checkerFactory = checkerFactory; this.expansionStrategy = expansionStrategy; this.contractionStrategy = contractionStrategy; if (progressMonitor != null) { this.progressMonitor = progressMonitor; } else { this.progressMonitor = new NullExplanationProgressMonitor<>(); } this.m = m; }
/** * Constructs a blackbox explanation generator. * * @param axioms The ontologies that provide the source axioms for the explanation * @param checkerFactory A factory that creates the appropriate entailment checkers for the * type of entailment being explained. * @param expansionStrategy The strategy used during the expansion phase * @param contractionStrategy The strategy to be used during the contraction phase * @param progressMonitor A progress monitor - may be <code>null</code> */ public BlackBoxExplanationGenerator(Set<? extends OWLAxiom> axioms, EntailmentCheckerFactory<E> checkerFactory, ExpansionStrategy<E> expansionStrategy, ContractionStrategy<E> contractionStrategy, ExplanationProgressMonitor<E> progressMonitor) { workingAxioms = new HashSet<>(axioms); this.checkerFactory = checkerFactory; this.expansionStrategy = expansionStrategy; this.contractionStrategy = contractionStrategy; if (progressMonitor != null) { this.progressMonitor = progressMonitor; } else { this.progressMonitor = new NullExplanationProgressMonitor<>(); } }
@Override public ExplanationGenerator<OWLAxiom> createExplanationGenerator(OWLOntology ontology) { return createExplanationGenerator(ontology, new NullExplanationProgressMonitor<OWLAxiom>()); }
@Override public ExplanationGenerator<OWLAxiom> createExplanationGenerator(Set<? extends OWLAxiom> axioms) { return createExplanationGenerator(axioms, new NullExplanationProgressMonitor<OWLAxiom>()); }
public LaconicExplanationGenerator(Set<? extends OWLAxiom> axioms, ExplanationGeneratorFactory<E> explanationGeneratorFactory, ExplanationProgressMonitor<E> progressMonitor, Supplier<OWLOntologyManager> m) { this.man = m.get(); this.progressMonitor = progressMonitor; this.explanationGeneratorFactory = explanationGeneratorFactory; this.limit = Integer.MAX_VALUE; this.axioms = axioms; if (progressMonitor != null) { this.progressMonitor = progressMonitor; } else { this.progressMonitor = new NullExplanationProgressMonitor<>(); } this.foundLaconicJustifications = new HashSet<>(); try { this.ont = man.createOntology(Collections.unmodifiableSet(axioms)); } catch (OWLOntologyCreationException e) { e.printStackTrace(); } catch (OWLOntologyChangeException e) { e.printStackTrace(); } lastRegularJusts = new HashSet<>(); }
SyntacticLocalityModuleExtractor extractor = new SyntacticLocalityModuleExtractor(manager, workingAxioms.stream(), ModuleType.STAR); module = extractor.extract(asSet(entailment.signature())); BlackBoxExplanationGenerator2<OWLAxiom> gen = new BlackBoxExplanationGenerator2<>(module, entailmentCheckerFactory, new StructuralTypePriorityExpansionStrategy<>(null, m), new DivideAndConquerContractionStrategy<OWLAxiom>(), new NullExplanationProgressMonitor<OWLAxiom>(), m); Set<Explanation<OWLAxiom>> expls = gen.getExplanations(entailment, 1); Explanation<OWLAxiom> expl = expls.iterator().next();