final Resource subject = statement.getSubject();
final URI predicate = statement.getPredicate();
final Node object = statement.getObject();
if (object instanceof DatatypeLiteral) {
final DatatypeLiteral literal = (DatatypeLiteral) object;
addStatement(result, context, subject, predicate, literal.getValue(),
literal.getDatatype());
} else if (object instanceof LanguageTagLiteral) {
final LanguageTagLiteral literal = (LanguageTagLiteral) object;
addStatement(result, context, subject, predicate, literal.getValue(),
literal.getLanguageTag());
} else if (object instanceof Literal) {
final Literal literal = (Literal) object;
addStatement(result, context, subject, predicate, literal.getValue());
} else {
addStatement(result, context, subject, predicate, object.asURI());
}
}