/** * Check if the given {@link ElkClassExpression} is satisfiable, that is, if * it can possibly have instances. {@link ElkClassExpression}s are not * satisfiable if they are equivalent to {@code owl:Nothing}. A satisfiable * {@link ElkClassExpression} is also called consistent or coherent. Calling * of this method may trigger the computation of the taxonomy, if it has not * been done yet. * * @param classExpression * the {@link ElkClassExpression} for which to check * satisfiability * @return {@code true} if the given input is satisfiable * @throws ElkException * if the result cannot be computed */ public synchronized boolean isSatisfiableQuietly( final ElkClassExpression classExpression) throws ElkException { try { return isSatisfiable(classExpression); } catch (final ElkInconsistentOntologyException e) { // Any class is unsatisfiable. return false; } }
/** * Check if the given {@link ElkClassExpression} is satisfiable, that is, if * it can possibly have instances. {@link ElkClassExpression}s are not * satisfiable if they are equivalent to {@code owl:Nothing}. A satisfiable * {@link ElkClassExpression} is also called consistent or coherent. Calling * of this method may trigger the computation of the taxonomy, if it has not * been done yet. * * @param classExpression * the {@link ElkClassExpression} for which to check * satisfiability * @return {@code true} if the given input is satisfiable * @throws ElkException * if the result cannot be computed */ public synchronized boolean isSatisfiableQuietly( final ElkClassExpression classExpression) throws ElkException { try { return isSatisfiable(classExpression); } catch (final ElkInconsistentOntologyException e) { // Any class is unsatisfiable. return false; } }
/** * Check if the given {@link ElkClassExpression} is satisfiable, that is, if * it can possibly have instances. {@link ElkClassExpression}s are not * satisfiable if they are equivalent to {@code owl:Nothing}. A satisfiable * {@link ElkClassExpression} is also called consistent or coherent. Calling * of this method may trigger the computation of the taxonomy, if it has not * been done yet. * * @param classExpression * the {@link ElkClassExpression} for which to check * satisfiability * @return {@code true} if the given input is satisfiable * @throws ElkException * if the result cannot be computed */ public synchronized boolean isSatisfiableQuietly( final ElkClassExpression classExpression) throws ElkException { try { return isSatisfiable(classExpression); } catch (final ElkInconsistentOntologyException e) { // Any class is unsatisfiable. return false; } }
@Override public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException { LOGGER_.trace("isSatisfiable(OWLClassExpression)"); checkInterrupted(); try { return reasoner_ .isSatisfiable(owlConverter_.convert(classExpression)); } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod("isSatisfiable(classExpression)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Override public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException { LOGGER_.trace("isSatisfiable(OWLClassExpression)"); checkInterrupted(); try { return reasoner_ .isSatisfiable(owlConverter_.convert(classExpression)); } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod("isSatisfiable(classExpression)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Override public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException { LOGGER_.trace("isSatisfiable(OWLClassExpression)"); checkInterrupted(); try { return reasoner_ .isSatisfiable(owlConverter_.convert(classExpression)); } catch (ElkUnsupportedReasoningTaskException e) { throw unsupportedOwlApiMethod("isSatisfiable(classExpression)", e.getMessage()); } catch (ElkException e) { throw elkConverter_.convert(e); } catch (ElkRuntimeException e) { throw elkConverter_.convert(e); } }
@Test public void testSimpleSubsumption() throws ElkException { TestLoader loader = new TestLoader(); Reasoner reasoner = TestReasonerUtils.createTestReasoner(loader); ElkClass A = objectFactory.getClass(new ElkFullIri(":A")); ElkClass B = objectFactory.getClass(new ElkFullIri(":B")); loader.add(objectFactory.getSubClassOfAxiom(A, B)); assertFalse(reasoner.isSatisfiable(objectFactory .getObjectIntersectionOf(A, objectFactory.getObjectComplementOf(B)))); assertTrue(reasoner.isSatisfiable(objectFactory .getObjectIntersectionOf(B, objectFactory.getObjectComplementOf(A)))); }
@Test public void testSatisfiabilityExistential() throws ElkException { TestLoader loader = new TestLoader(); Reasoner reasoner = TestReasonerUtils.createTestReasoner(loader); ElkClass A = objectFactory.getClass(new ElkFullIri(":A")); ElkClass B = objectFactory.getClass(new ElkFullIri(":B")); loader.add(objectFactory.getSubClassOfAxiom(A, objectFactory.getOwlNothing())); ElkObjectProperty R = objectFactory.getObjectProperty(new ElkFullIri( ":R")); assertFalse(reasoner.isSatisfiable(objectFactory .getObjectSomeValuesFrom(R, A))); assertTrue(reasoner.isSatisfiable(objectFactory .getObjectSomeValuesFrom(R, B))); }
@Test public void testSatisfiabilityExistentialSubsumption() throws ElkException { TestLoader loader = new TestLoader(); Reasoner reasoner = TestReasonerUtils.createTestReasoner(loader); ElkClass A = objectFactory.getClass(new ElkFullIri(":A")); ElkClass B = objectFactory.getClass(new ElkFullIri(":B")); loader.add(objectFactory.getSubClassOfAxiom(A, B)); ElkObjectProperty R = objectFactory.getObjectProperty(new ElkFullIri( ":R")); assertFalse(reasoner.isSatisfiable(objectFactory .getObjectIntersectionOf(objectFactory.getObjectSomeValuesFrom( R, A), objectFactory .getObjectComplementOf(objectFactory .getObjectSomeValuesFrom(R, B))))); assertTrue(reasoner.isSatisfiable(objectFactory .getObjectIntersectionOf(objectFactory.getObjectSomeValuesFrom( R, B), objectFactory .getObjectComplementOf(objectFactory .getObjectSomeValuesFrom(R, A))))); }