*/
@SuppressWarnings("unchecked")
private JSONObject writeObject(BNodeManager bNodeMgr, Resource object) {
JSONObject jObject = new JSONObject();
if (object instanceof PlainLiteral) {
PlainLiteral plainLiteral = (PlainLiteral) object;
jObject.put("value", plainLiteral.getLexicalForm());
jObject.put("type", "literal");
if (plainLiteral.getLanguage() != null) {
jObject.put("lang", plainLiteral.getLanguage().toString());
}
} else if (object instanceof TypedLiteral) {
TypedLiteral literal = (TypedLiteral) object;
jObject.put("value", literal.getLexicalForm());
jObject.put("type", "literal");