/** * Assert that there is an exception as a result of comparing the two literals with the given * operator. * * @param lit1 The left literal * @param lit2 The right literal * @param op The operator for the comparison */ private void assertCompareException(Literal lit1, Literal lit2, CompareOp op) throws Exception { try { boolean returnValue = QueryEvaluationUtil.compareLiterals(lit1, lit2, op); fail( "Did not receive expected ValueExprEvaluationException (return value was " + returnValue + ") for " + lit1.toString() + op.getSymbol() + lit2.toString()); } catch (ValueExprEvaluationException e) { // Expected exception } }
@Override public URI getDatatype() { if (datatype == null) { if (literal.getDatatype() != null) { datatype = URIs.createURI(literal.getDatatype().toString()); } else { datatype = literal.getLanguage() == null ? net.enilink.komma.core.Literal.TYPE_STRING : net.enilink.komma.core.Literal.TYPE_LANGSTRING; } } return datatype; }
/** * Assert that there is no exception as a result of comparing the two literals with the given * operator and it returns true. * * @param lit1 The left literal * @param lit2 The right literal * @param op The operator for the comparison * @param strict boolean switch between strict and extended comparison */ private void assertCompareTrue(Literal lit1, Literal lit2, CompareOp op, boolean strict) throws Exception { assertTrue( "Compare did not return true for " + lit1.toString() + op.getSymbol() + lit2.toString(), QueryEvaluationUtil.compareLiterals(lit1, lit2, op, strict)); }
@Override public String getLanguage() { return literal.getLanguage().orElse(null); }
@Override public String getLabel() { return literal.getLabel(); }