/** * Tries to shut down the reasoner within 1 minute * * @return {@code true} if the operation was successful * @throws InterruptedException * if the current thread was interrupted */ public synchronized boolean shutdown() throws InterruptedException { return shutdown(1, TimeUnit.MINUTES); }
/** * Tries to shut down the reasoner within 1 minute * * @return {@code true} if the operation was successful * @throws InterruptedException * if the current thread was interrupted */ public synchronized boolean shutdown() throws InterruptedException { return shutdown(1, TimeUnit.MINUTES); }
/** * Tries to shut down the reasoner within 1 minute * * @return {@code true} if the operation was successful * @throws InterruptedException * if the current thread was interrupted */ public synchronized boolean shutdown() throws InterruptedException { return shutdown(1, TimeUnit.MINUTES); }
@Override public void dispose() { LOGGER_.trace("dispose()"); owlOntologymanager_ .removeOntologyChangeListener(ontologyChangeListener_); owlOntologymanager_.removeOntologyChangeProgessListener( ontologyChangeProgressListener_); try { for (;;) { try { if (!reasoner_.shutdown()) throw new ReasonerInternalException( "Failed to shut down ELK!"); break; } catch (InterruptedException e) { continue; } } } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Override public void dispose() { LOGGER_.trace("dispose()"); owlOntologymanager_ .removeOntologyChangeListener(ontologyChangeListener_); owlOntologymanager_.removeOntologyChangeProgessListener( ontologyChangeProgressListener_); try { for (;;) { try { if (!reasoner_.shutdown()) throw new ReasonerInternalException( "Failed to shut down ELK!"); break; } catch (InterruptedException e) { continue; } } } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Override public void dispose() { LOGGER_.trace("dispose()"); owlOntologymanager_ .removeOntologyChangeListener(ontologyChangeListener_); owlOntologymanager_.removeOntologyChangeProgessListener( ontologyChangeProgressListener_); try { for (;;) { try { if (!reasoner_.shutdown()) throw new ReasonerInternalException( "Failed to shut down ELK!"); break; } catch (InterruptedException e) { continue; } } } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Override public void after() { try { assertTrue(reasoner_.shutdown()); } catch (InterruptedException e) { fail(); } }
reasoner.shutdown();
reasoner.shutdown();
reasoner.shutdown();
@Test public void tracingTest() throws Exception { Reasoner reasoner = TestReasonerUtils .createTestReasoner(manifest.getInput().getUrl().openStream()); try { TracingTests tests = getTracingTests(reasoner); TracingTestVisitor testVisitor = getTracingTestVisitor(reasoner); // visit all subsumptions twice: the second time to ensure // that the proofs are still the same tests.accept(testVisitor); tests.accept(testVisitor); } finally { assertTrue(reasoner.shutdown()); } }
@Test public void provabilityTest() throws Exception { // to save all loaded axioms final Set<ElkAxiom> ontology = TestReasonerUtils .loadAxioms(manifest.getInput().getUrl().openStream()); final TestLoader loader = new TestLoader(ontology); Reasoner reasoner = TestReasonerUtils.createTestReasoner(loader); try { // reasoner.getTaxonomy(); // ElkClass sub = elkFactory.getClass(new ElkFullIri("StiffNeck")); // ElkClass sup = elkFactory // .getClass(new ElkFullIri("PropertyOfPhenomenon")); // // getTestingVisitor(reasoner, ontology).subsumptionTest(sub, sup); TracingTests tests = getProvabilityTests(reasoner); tests.accept(getTestingVisitor(reasoner, ontology)); } finally { reasoner.shutdown(); } }
@Test public void randomWalk() throws Exception { // axioms that can change OnOffVector<ElkAxiom> changingAxioms = new OnOffVector<ElkAxiom>(128); // other axioms that do not change List<ElkAxiom> staticAxioms = new ArrayList<ElkAxiom>(); Reasoner incrementalReasoner; long seed = RandomSeedProvider.VALUE; LOGGER_.info("Initial load of test axioms"); InputStream stream = manifest.getInput().getUrl().openStream(); AxiomLoader fileLoader = new Owl2StreamLoader.Factory( new Owl2FunctionalStyleParserFactory(), stream).getAxiomLoader(DummyInterruptMonitor.INSTANCE); TestAxiomLoader trackingLoader = getAxiomTrackingLoader(fileLoader, changingAxioms, staticAxioms); incrementalReasoner = TestReasonerUtils.createTestReasoner( trackingLoader); incrementalReasoner.setAllowIncrementalMode(true); try { // incrementalReasoner.loadAxioms(); // let the runner run.. getRandomWalkRunner(MAX_ROUNDS, ITERATIONS).run( incrementalReasoner, changingAxioms, staticAxioms, seed); } catch (Exception e) { throw new ElkRuntimeException("Seed " + seed, e); } finally { stream.close(); assertTrue(incrementalReasoner.shutdown()); } }
assertTrue(standardReasoner.shutdown());