public void testSatisfiability(final boolean isSatisfiable, final ATermAppl... dataranges) throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { assertTrue(isSatisfiable == reasoner.isSatisfiable(Arrays.asList(dataranges))); }
@Ignore("Equal but not identical semantics is very counter-intuitive and currently Pellet treats equals values as identical") @Test public void equalbutNotIdenticalDateTimeOneOf() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl d = oneOf(literal("1956-06-25T04:00:00-05:00", DATE_TIME)); assertTrue(reasoner.isSatisfiable(Collections.singleton(d))); assertTrue(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-06-25T04:00:00-05:00", DATE_TIME)))); assertFalse(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-06-25T10:00:00+01:00", DATE_TIME)))); } }
/** * Verify that overlapping decimal ranges are satisfiable when evaluated independent of variables and constants * * @throws UnrecognizedDatatypeException * @throws InvalidLiteralException * @throws InvalidConstrainingFacetException */ @Test public void unarySatisfiableDecimalRanges() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> dataranges = getSatisfiableDecimalRanges(); assertTrue(reasoner.isSatisfiable(dataranges)); }
@Ignore("See ticket #524") @Test public void incomparableDateTime() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl d = restrict(DATE_TIME, minInclusive(literal("1956-01-01T04:00:00-05:00", DATE_TIME))); assertTrue(reasoner.isSatisfiable(Collections.singleton(d))); assertTrue(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-01-01T10:00:00", DATE_TIME)))); assertFalse(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-01-01T10:00:00Z", DATE_TIME)))); }
@Test public void floatInterval() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl floatInterval = restrict(FLOAT, minInclusive(literal(1.0f)), maxExclusive(literal(2.0f))); assertFalse(reasoner.isSatisfiable(Collections.singleton(not(floatInterval)), 1.0f)); assertFalse(reasoner.isSatisfiable(Collections.singleton(not(floatInterval)), 1.5f)); assertTrue(reasoner.isSatisfiable(Collections.singleton(not(floatInterval)), 2.0f)); }
/** * Verify that non-overlapping decimal enumerations are unsatisfiable when evaluated independent of variables and constants. * * @throws UnrecognizedDatatypeException * @throws InvalidLiteralException * @throws InvalidConstrainingFacetException */ @Test public void unaryUnsatisfiableDecimalEnumerations() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> dataranges = getUnsatisfiableDecimalEnumerations(); assertFalse(reasoner.isSatisfiable(dataranges)); }
@Ignore("Equal but not identical semantics is very counter-intuitive and currently Pellet treats equals values as identical") @Test public void equalbutNotIdenticalDateTime() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl d = restrict(DATE_TIME, minInclusive(literal("1956-06-25T04:00:00-05:00", DATE_TIME)), maxInclusive(literal("1956-06-25T04:00:00-05:00", DATE_TIME))); assertTrue(reasoner.isSatisfiable(Collections.singleton(d))); assertTrue(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-06-25T04:00:00-05:00", DATE_TIME)))); assertFalse(reasoner.isSatisfiable(Collections.singleton(d), reasoner.getValue(literal("1956-06-25T10:00:00+01:00", DATE_TIME)))); }
@Test public void intersectTextNegatedTextValue() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> types = Arrays.asList(PLAIN_LITERAL, not(value(literal("http://example.org")))); assertTrue(reasoner.isSatisfiable(types)); assertTrue(reasoner.containsAtLeast(2, types)); assertTrue(reasoner.isSatisfiable(types, literal("http://example.com"))); assertFalse(reasoner.isSatisfiable(types, literal("http://example.org"))); }
@Test public void intersectAnyURINegatedURIValue() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> types = Arrays.asList(ANY_URI, not(value(literal("http://example.org", ANY_URI)))); assertTrue(reasoner.isSatisfiable(types)); assertTrue(reasoner.containsAtLeast(2, types)); assertTrue(reasoner.isSatisfiable(types, literal("http://example.com", Datatypes.ANY_URI))); assertFalse(reasoner.isSatisfiable(types, literal("http://example.org", Datatypes.ANY_URI))); }
@Test public void intersectAnyURINegatedTextValue() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> types = Arrays.asList(ANY_URI, not(value(literal("http://example.org")))); assertTrue(reasoner.isSatisfiable(types)); assertTrue(reasoner.containsAtLeast(2, types)); assertTrue(reasoner.isSatisfiable(types, literal("http://example.com", Datatypes.ANY_URI))); assertTrue(reasoner.isSatisfiable(types, literal("http://example.org", Datatypes.ANY_URI))); }
@Test public void emptyFloatInterval() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl emptyFloatRestriction = restrict(FLOAT, minExclusive(literal(Float.intBitsToFloat(0x00000000))), maxExclusive(literal(Float.intBitsToFloat(0x00000001)))); assertFalse(reasoner.isSatisfiable(Collections.singleton(emptyFloatRestriction))); }
@Test public void floatRestrictionWithSevenValues() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl floatRestrictionWithSevenValues = restrict(FLOAT, minExclusive(literal(Float.intBitsToFloat(0x00000000))), maxExclusive(literal(Float.intBitsToFloat(0x00000008)))); assertTrue(reasoner.isSatisfiable(Collections.singleton(floatRestrictionWithSevenValues))); assertTrue(reasoner.containsAtLeast(7, Collections.singleton(floatRestrictionWithSevenValues))); assertFalse(reasoner.containsAtLeast(8, Collections.singleton(floatRestrictionWithSevenValues))); }
@Test public void intersectIntegerNegatedIntegerValue() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final Collection<ATermAppl> types = Arrays.asList(INTEGER, not(value(literal(3)))); assertTrue(reasoner.isSatisfiable(types)); assertTrue(reasoner.containsAtLeast(2, types)); assertTrue(reasoner.isSatisfiable(types, reasoner.getValue(literal(1)))); assertFalse(reasoner.isSatisfiable(types, reasoner.getValue(literal(3)))); }
public void integerExclusiveIntervalOverflow() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl integerExclusiveInterval = restrict(INTEGER, minExclusive(literal(Integer.MIN_VALUE)), maxExclusive(literal(Integer.MAX_VALUE))); assertTrue(reasoner.isSatisfiable(Collections.singleton(integerExclusiveInterval))); assertTrue(reasoner.containsAtLeast(Integer.MAX_VALUE, Collections.singleton(integerExclusiveInterval))); }
@Test public void emptyIntegerInterval() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl integerExclusiveInterval = restrict(INTEGER, minExclusive(literal(0)), maxExclusive(literal(1))); assertFalse(reasoner.isSatisfiable(Collections.singleton(integerExclusiveInterval))); }
@Test public void integerExclusiveIntervalExtreme() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl integerExclusiveInterval = restrict(INTEGER, minExclusive(literal(0)), maxExclusive(literal(Integer.MAX_VALUE))); assertTrue(reasoner.isSatisfiable(Collections.singleton(integerExclusiveInterval))); assertTrue(reasoner.containsAtLeast(Integer.MAX_VALUE - 1, Collections.singleton(integerExclusiveInterval))); assertFalse(reasoner.containsAtLeast(Integer.MAX_VALUE, Collections.singleton(integerExclusiveInterval))); }
@Test public void integerTwoValues() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl integerExclusiveInterval = restrict(INTEGER, minExclusive(literal(-1)), maxExclusive(literal(1))); assertTrue(reasoner.isSatisfiable(Collections.singleton(integerExclusiveInterval))); assertTrue(reasoner.containsAtLeast(1, Collections.singleton(integerExclusiveInterval))); assertFalse(reasoner.containsAtLeast(2, Collections.singleton(integerExclusiveInterval))); }
@Test public void floatTwoZeros() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl floatTwoZeros = restrict(FLOAT, minExclusive(literal(-Float.MIN_VALUE)), maxExclusive(literal(Float.MIN_VALUE))); assertTrue(reasoner.isSatisfiable(Collections.singleton(floatTwoZeros))); assertTrue(reasoner.containsAtLeast(2, Collections.singleton(floatTwoZeros))); assertFalse(reasoner.containsAtLeast(3, Collections.singleton(floatTwoZeros))); }
@Test public void intersectIntegerNegatedEmptyIntegerRange() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl type = not(restrict(INTEGER, minInclusive(literal("2", INTEGER)), maxInclusive(literal("1", INTEGER)))); final Collection<ATermAppl> types = Arrays.asList(INTEGER, type); assertTrue(reasoner.isSatisfiable(types)); assertTrue(reasoner.containsAtLeast(2, types)); }
@Test public void unionWithEmptyDatatype() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl dt1 = restrict(INTEGER, minInclusive(literal(1)), maxInclusive(literal(3))); final ATermAppl dt2 = restrict(INTEGER, minInclusive(literal(4)), maxInclusive(literal(6))); final ATermAppl dt3 = and(NEGATIVE_INTEGER, POSITIVE_INTEGER); final ATermAppl datarange = or(dt1, dt2, dt3); assertTrue(reasoner.isSatisfiable(Collections.singleton(datarange))); assertTrue(reasoner.containsAtLeast(6, Collections.singleton(datarange))); assertFalse(reasoner.containsAtLeast(7, Collections.singleton(datarange))); }