public <RESULT> RESULT execute(final String name, final Supplier<RESULT> producer) { if (OpenlletOptions.USE_THREADED_KERNEL) return producer.get(); final Optional<Timer> timer = startTimer(name); try { return producer.get(); } finally { timer.ifPresent(Timer::stop); } }
public <RESULT> RESULT execute(final String name, final Supplier<RESULT> producer) { if (OpenlletOptions.USE_THREADED_KERNEL) return producer.get(); final Optional<Timer> timer = startTimer(name); try { return producer.get(); } finally { timer.ifPresent(Timer::stop); } }
protected void startTask(final String task) { verbose("Start " + task); _timers.startTimer(task); }
public void execute(final String name, final Consumer<Timers> consumer) { if (OpenlletOptions.USE_THREADED_KERNEL) { consumer.accept(this); return; } final Optional<Timer> timer = startTimer(name); consumer.accept(this); timer.ifPresent(t -> t.stop()); }
public void execute(final String name, final Consumer<Timers> consumer) { if (OpenlletOptions.USE_THREADED_KERNEL) { consumer.accept(this); return; } final Optional<Timer> timer = startTimer(name); consumer.accept(this); timer.ifPresent(t -> t.stop()); }
public Collection<PartialBinding> applyRete() { Optional<Timer> timer; if (OpenlletOptions.ALWAYS_REBUILD_RETE) { timer = _timers.startTimer("rule-rebuildRete"); _partialBindings.clear(); _partialBindings.addAll(_unsafeRules); _interpreter.reset(); timer.ifPresent(t -> t.stop()); } timer = _timers.startTimer("rule-reteRun"); _interpreter.run(); timer.ifPresent(t -> t.stop()); return _interpreter.getBindings(); }
public Collection<PartialBinding> applyRete() { Optional<Timer> timer; if (OpenlletOptions.ALWAYS_REBUILD_RETE) { timer = _timers.startTimer("rule-rebuildRete"); _partialBindings.clear(); _partialBindings.addAll(_unsafeRules); _interpreter.reset(); timer.ifPresent(t -> t.stop()); } timer = _timers.startTimer("rule-reteRun"); _interpreter.run(); timer.ifPresent(t -> t.stop()); return _interpreter.getBindings(); }
public boolean isDirectlyBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("dBlocking"); try { return isDirectlyBlockedInt(blocked); } finally { timer.ifPresent(t -> t.stop()); } }
public boolean isDirectlyBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("dBlocking"); try { return isDirectlyBlockedInt(blocked); } finally { timer.ifPresent(t -> t.stop()); } }
@Override public void classify() { ensureConsistency(); if (isClassified()) return; _logger.fine("Classifying..."); final Optional<Timer> timer = _timers.startTimer("classify"); // TODO : coordination of the name of the classifier with the Taxonomy builders.. final TaxonomyBuilder builder = getTaxonomyBuilder(); final boolean isClassified; synchronized (builder) { isClassified = builder.classify(); } timer.ifPresent(t -> t.stop()); if (!isClassified) return; _state.add(ReasoningState.CLASSIFY); _estimate.computKBCosts(); }
public void load(final Set<OWLOntology> ontologies) { final Optional<Timer> timer = _kb.getTimers().startTimer("load"); final Collection<OWLOntology> toBeLoaded = new LinkedHashSet<>(); for (final OWLOntology ontology : ontologies) load(ontology, false, toBeLoaded); _visitor.reset(); _visitor.setAddAxiom(true); for (final OWLOntology ontology : toBeLoaded) ontology.accept(_visitor); _visitor.verify(); timer.ifPresent(t -> t.stop()); }
@Override public void classify() { ensureConsistency(); if (isClassified()) return; _logger.fine("Classifying..."); final Optional<Timer> timer = _timers.startTimer("classify"); // TODO : coordination of the name of the classifier with the Taxonomy builders.. final TaxonomyBuilder builder = getTaxonomyBuilder(); final boolean isClassified; synchronized (builder) { isClassified = builder.classify(); } timer.ifPresent(t -> t.stop()); if (!isClassified) return; _state.add(ReasoningState.CLASSIFY); _estimate.computKBCosts(); }
/** * Extract modules from scratch * * @return */ @Override public MultiValueMap<OWLEntity, OWLEntity> extractModules() { final Optional<Timer> timer = _timers.startTimer("extractModules"); // _cache the axiom signatures processAdditions(); _additions.clear(); // no need to consider _deletions for initial module extraction _deletions.clear(); _changes.clear(); _nonLocalAxioms = false; _modules = new MultiValueMap<>(); extractModuleSignatures(_entityAxioms.keySet()); timer.ifPresent(t -> t.stop()); return _modules; }
/** * Extract modules from scratch * * @return */ @Override public MultiValueMap<OWLEntity, OWLEntity> extractModules() { final Optional<Timer> timer = _timers.startTimer("extractModules"); // _cache the axiom signatures processAdditions(); _additions.clear(); // no need to consider _deletions for initial module extraction _deletions.clear(); _changes.clear(); _nonLocalAxioms = false; _modules = new MultiValueMap<>(); extractModuleSignatures(_entityAxioms.keySet()); timer.ifPresent(t -> t.stop()); return _modules; }
public void load(final Set<OWLOntology> ontologies) { final Optional<Timer> timer = _kb.getTimers().startTimer("load"); final Collection<OWLOntology> toBeLoaded = new LinkedHashSet<>(); for (final OWLOntology ontology : ontologies) load(ontology, false, toBeLoaded); _visitor.reset(); _visitor.setAddAxiom(true); for (final OWLOntology ontology : toBeLoaded) ontology.accept(_visitor); _visitor.verify(); timer.ifPresent(t -> t.stop()); }
public void load(final Set<OWLOntology> ontologies) { final Optional<Timer> timer = _kb.getTimers().startTimer("load"); final Collection<OWLOntology> toBeLoaded = new LinkedHashSet<>(); for (final OWLOntology ontology : ontologies) load(ontology, false, toBeLoaded); _visitor.reset(); _visitor.setAddAxiom(true); for (final OWLOntology ontology : toBeLoaded) ontology.accept(_visitor); _visitor.verify(); timer.ifPresent(t -> t.stop()); }
@Override public boolean isSubClassOf(final ATermAppl c1, final ATermAppl c2) { if (!_doExplanation) { final Bool isKnownSubClass = isKnownSubClassOf(c1, c2); if (isKnownSubClass.isKnown()) return isKnownSubClass.isTrue(); } if (_logger.isLoggable(Level.FINE)) { final long count = _kb.getTimers().getTimer("subClassSat").map(t -> t.getCount()).orElse(0L); _logger.fine(count + ") Checking subclass [" + ATermUtils.toString(c1) + " " + ATermUtils.toString(c2) + "]"); } final ATermAppl notC2 = ATermUtils.negate(c2); final ATermAppl c = ATermUtils.makeAnd(c1, notC2); final Optional<Timer> timer = _kb.getTimers().startTimer("subClassSat"); final boolean sub = !isSatisfiable(c, false); timer.ifPresent(t -> t.stop()); _logger.fine(() -> " Result: " + sub + timer.map(t -> " (" + t.getLast() + "ms)").orElse("")); return sub; }
public boolean isBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("blocking"); try { return !blocked.isRoot() && (isIndirectlyBlocked(blocked) || isDirectlyBlockedInt(blocked)); } finally { timer.ifPresent(t -> t.stop()); } }
public boolean isBlocked(final Individual blocked) { final Optional<Timer> timer = blocked.getABox().getKB().getTimers().startTimer("blocking"); try { return !blocked.isRoot() && (isIndirectlyBlocked(blocked) || isDirectlyBlockedInt(blocked)); } finally { timer.ifPresent(t -> t.stop()); } }
@Override public void realize() { if (isRealized()) return; classify(); if (!isClassified()) return; final Optional<Timer> timer = _timers.startTimer("realize"); // This is false if the progress monitor is canceled final boolean isRealized; final TaxonomyBuilder builder = getTaxonomyBuilder(); synchronized (builder) { isRealized = builder.realize(); } timer.ifPresent(t -> t.stop()); if (!isRealized) return; _state.add(ReasoningState.REALIZE); _estimate.computKBCosts(); }