public boolean isConsistent() { prepare(); return _kb.isConsistent(); }
/** * {@inheritDoc} */ @Override public void prepareReasoner() throws ReasonerInterruptedException, TimeOutException { refreshCheck(); if (_kb.isConsistent()) _kb.realize(); }
public void prepare(final boolean doConsistencyCheck) { if (isPrepared()) return; _logger.fine("Preparing PelletInfGraph..."); load(); _kb.prepare(); if (doConsistencyCheck) _kb.isConsistent(); _logger.fine("done."); super.prepare(); }
@Override public boolean isConsistent() { return ((PelletInfGraph) _model.getGraph()).getKB().isConsistent(); }
@Test public void complexAllInfSat() { _kb = new OWLAPILoader().createKB(MiscTests._base + "one+one-consistent-and-all-inf-sat.owl"); assertTrue(_kb.isConsistent()); assertTrue(_kb.getUnsatisfiableClasses().isEmpty()); }
@Test public void testCyclicTBox1() { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl C = term("C"); kb.addEquivalentClass(C, not(C)); assertFalse(kb.isConsistent()); }
@Test public void testIrreflexive() { _kb.addObjectProperty(mbox); _kb.addIrreflexiveProperty(mbox); _kb.addIndividual(robert); _kb.addPropertyValue(mbox, robert, robert); assertFalse(_kb.isConsistent()); final Set<ATermAppl> explanation = _kb.getExplanationSet(); assertIteratorValues(explanation.iterator(), new Object[] { ATermUtils.makeIrreflexive(mbox), ATermUtils.makePropAtom(mbox, robert, robert), }); }
@Test public void simpleInconcistency() { individuals(_a, _b, _c); objectProperties(_p, _q); _kb.addDisjointProperty(_p, _q); _kb.addPropertyValue(_p, _a, _b); _kb.addPropertyValue(_q, _a, _b); assertFalse(_kb.isConsistent()); }
@Test public void complexAllUnsat() { _kb = new OWLAPILoader().createKB(MiscTests._base + "one+one-consistent-but-all-unsat.owl"); assertTrue(_kb.isConsistent()); assertEquals(_kb.getClasses(), _kb.getUnsatisfiableClasses()); }
@Test public void testNotIrreflexive() { objectProperties(_p, _q); _kb.addIrreflexiveProperty(_p); _kb.addSubProperty(_p, _q); assertTrue(_kb.isConsistent()); assertTrue(_kb.isIrreflexiveProperty(_p)); assertFalse(_kb.isIrreflexiveProperty(_q)); }
@Test public void testAsymmetricEquivalent() { objectProperties(_q, _r); _kb.addAsymmetricProperty(_q); _kb.addEquivalentProperty(_q, _r); assertTrue(_kb.isConsistent()); assertTrue(_kb.isAsymmetricProperty(_q)); assertTrue(_kb.isAsymmetricProperty(_r)); }
@Test public void testReflexiveSubPropertyExplicit() { objectProperties(_p, _q); _kb.addReflexiveProperty(_p); _kb.addSubProperty(_p, _q); assertTrue(_kb.isConsistent()); assertTrue(_kb.isReflexiveProperty(_p)); assertTrue(_kb.isReflexiveProperty(_q)); }
@Test public void test370() { // test case for issue #370. dataProperties(_p); individuals(_a); final ATermAppl dt = restrict(Datatypes.DECIMAL, minExclusive(literal("0.99", Datatypes.DECIMAL)), maxExclusive(literal("1.01", Datatypes.DECIMAL))); _kb.addType(_a, min(_p, 3, dt)); assertTrue(_kb.isConsistent()); }
@Test public void validLiteralRestrictedDatatype() { dataProperties(_p); individuals(_a); final ATermAppl uri = term("http//example.com/datatype"); _kb.addRange(_p, INTEGER); _kb.addDatatypeDefinition(uri, restrict(INTEGER, minExclusive(literal(0)))); _kb.addPropertyValue(_p, _a, literal("1", uri)); assertTrue(_kb.isConsistent()); }
@Test public void invalidLiteralStringRestriction() { assumeTrue(OpenlletOptions.INVALID_LITERAL_AS_INCONSISTENCY); dataProperties(_p); individuals(_a); final ATermAppl uri = term("http//example.com/datatype"); _kb.addDatatypeDefinition(uri, oneOf(literal("a"), literal("b"))); _kb.addRange(_p, uri); _kb.addPropertyValue(_p, _a, literal("a", uri)); assertFalse(_kb.isConsistent()); }
@Test public void someFunctionalP() { classes(_C, _D); objectProperties(_p); _kb.addFunctionalProperty(_p); _kb.addSubClass(_D, some(inv(_p), _C)); _kb.addSubClass(_C, some(_p, not(_D))); assertTrue(_kb.isConsistent()); assertTrue(_kb.isSatisfiable(_C)); assertFalse(_kb.isSatisfiable(_D)); }
@Test public void cachedIntersectionUnsat() { classes(_B, _C, _D); objectProperties(_p); _kb.addDisjointClass(_C, _D); _kb.addSubClass(_B, some(_p, some(inv(_p), and(_C, _D)))); assertTrue(_kb.isConsistent()); assertTrue(_kb.isSatisfiable(_C)); assertTrue(_kb.isSatisfiable(_D)); assertFalse(_kb.isSatisfiable(_B)); }
@Test public void propertyChainInverse() { classes(_C, _D); objectProperties(_p, _q, _r); _kb.addSubProperty(list(_r, _p), _q); _kb.addSubClass(_D, all(_q, _C)); assertTrue(_kb.isConsistent()); assertFalse(_kb.isSatisfiable(some(_p, and(_D, some(_p, and(some(inv(_r), _D), some(_p, not(_C)))))))); }
@Test public void transitivityInverse() { classes(_C, _D); objectProperties(_p, _q, _r); _kb.addTransitiveProperty(_r); _kb.addSubProperty(_r, _q); _kb.addSubClass(_D, all(_q, _C)); assertTrue(_kb.isConsistent()); assertFalse(_kb.isSatisfiable(some(_p, and(_D, some(_p, and(some(inv(_r), _D), some(_r, not(_C)))))))); }
@Test public void somePQallAnonInvR2() { classes(_C); objectProperties(_p, _q, _r); _kb.addSubProperty(list(_p, _q), _r); assertTrue(_kb.isConsistent()); assertTrue(_kb.isSatisfiable(_C)); assertTrue(_kb.isSatisfiable(some(_q, all(inv(_r), not(_C))))); assertFalse(_kb.isSatisfiable(and(_C, some(_p, some(_q, all(inv(_r), not(_C))))))); }