public static SWRLLiteralArgument constant(final String constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final String value, final OWLDatatype datatype) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(value, datatype)); }
public static SWRLLiteralArgument constant(final float constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final int constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final String value, final String lang) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(value, lang)); }
public static SWRLLiteralArgument constant(final double constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final float constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final String value, final OWLDatatype datatype) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(value, datatype)); }
public static SWRLLiteralArgument constant(final int constant) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(constant)); }
public static SWRLLiteralArgument constant(final String value, final String lang) { return OWL._factory.getSWRLLiteralArgument(OWL.constant(value, lang)); }
@Test public void datatypeEnumeration() throws Exception { final OWLAxiom[] axioms = { OWL.propertyAssertion(_a, dp, OWL.constant(1)), OWL.propertyAssertion(_a, dp, OWL.constant(2)), OWL.equivalentClasses(_A, OWL.some(dp, _dt)), OWL.datatypeDefinition(_dt, OWL.oneOf(OWL.constant(1), OWL.constant(2), OWL.constant(3))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _A), 0, new OWLAxiom[] { axioms[0], axioms[2], axioms[3] }, new OWLAxiom[] { axioms[1], axioms[2], axioms[3] }); }
@Test public void subPropertiesOfFunctionalDataProperty() throws Exception { final OWLAxiom[] axioms = { OWL.functional(dp), OWL.subPropertyOf(dq, dp), OWL.subPropertyOf(dr, dp), OWL.propertyAssertion(_a, dq, OWL.constant(1)), OWL.classAssertion(_a, OWL.some(dr, XSD.INTEGER)) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, dp, OWL.constant(1)), 0, new OWLAxiom[] { axioms[1], axioms[3] }); testExplanations(OWL.propertyAssertion(_a, dr, OWL.constant(1)), 0, axioms); }
@Test public void testQuotedLiteral() { final OWLLiteral literal = OWL.constant("\"test\""); createReasoner(OWL.propertyAssertion(_a, _dp, literal)); assertTrue(_reasoner.isEntailed(OWL.propertyAssertion(_a, _dp, literal))); assertEquals(Collections.singleton(literal), _reasoner.getDataPropertyValues(_a, _dp)); }
@Test public void multipleDatatypeRange() throws Exception { final OWLAxiom[] axioms = { OWL.range(dp, XSD.BYTE), OWL.range(dp, XSD.NON_POSITIVE_INTEGER), OWL.range(dp, XSD.NON_NEGATIVE_INTEGER), OWL.subClassOf(_A, OWL.min(dp, 1)), OWL.classAssertion(_a, _A) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.propertyAssertion(_a, dp, OWL.constant(0)), 0, new OWLAxiom[] { axioms[1], axioms[2], axioms[3], axioms[4] }); }
@Test public void userDefinedDatatype1() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), OWL.equivalentClasses(_B, OWL.and(_A, OWL.some(dp, OWL.restrict(XSD.INTEGER, OWL.maxExclusive(10))))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
@Test public void userDefinedDatatype3() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), OWL.equivalentClasses(_B, OWL.and(_A, OWL.some(dp, _dt))), OWL.datatypeDefinition(_dt, OWL.restrict(XSD.INTEGER, OWL.maxExclusive(10))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
@Test public void ruleBuiltinTest1() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), SWRL.rule(SWRL.antecedent(SWRL.classAtom(_A, _x), SWRL.propertyAtom(dp, _x, _dx), SWRL.lessThan(_dx, SWRL.constant(10))), SWRL.consequent(SWRL.classAtom(_B, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
@Test public void ruleBuiltinTest2() throws Exception { final OWLAxiom[] axioms = { OWL.classAssertion(_a, _A), OWL.propertyAssertion(_a, dp, OWL.constant(9)), SWRL.rule(SWRL.antecedent(SWRL.classAtom(_A, _x), SWRL.propertyAtom(dp, _x, _dx), SWRL.greaterThan(_dx, SWRL.constant(5)), SWRL.lessThan(_dx, SWRL.constant(10))), SWRL.consequent(SWRL.classAtom(_B, _x))) }; setupGenerators(Stream.of(axioms)); testExplanations(OWL.classAssertion(_a, _B), 0, axioms); }
/** * A _data property range axiom should be removable without causing a full KB reload */ @Test public void removeDataPropertyRangeAxiom() { createReasoner(declaration(_dp), declaration(_C), range(_dp, XSD.INTEGER), propertyAssertion(_a, _dp, constant("foo"))); assertFalse(_reasoner.isConsistent()); final boolean changeApplied = processRemove(range(_dp, XSD.INTEGER)); assertTrue("Unable to remove _data property range axiom", changeApplied); assertTrue(_reasoner.isConsistent()); }
@Test public void datatypeDefinition() { final OWLDatatype between5and10 = OWL.Datatype("between5and10"); final OWLDatatype between6and8 = OWL.Datatype("between6and8"); createReasoner(OWL.datatypeDefinition(between5and10, OWL.restrict(XSD.INTEGER, OWL.minInclusive(5), OWL.maxInclusive(10))), OWL.datatypeDefinition(between6and8, OWL.restrict(XSD.INTEGER, OWL.minInclusive(6), OWL.maxInclusive(8))), OWL.equivalentClasses(_A, OWL.some(_dp, between5and10)), OWL.equivalentClasses(_B, OWL.some(_dp, between6and8)), OWL.propertyAssertion(_a, _dp, OWL.constant(9)), OWL.propertyAssertion(_b, _dp, OWL.constant(7))); assertTrue(_reasoner.isEntailed(OWL.subClassOf(_B, _A))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_a, _A))); assertFalse(_reasoner.isEntailed(OWL.classAssertion(_a, _B))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_b, _A))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_b, _B))); }