element.put("type", "uri");
element.put("value", UriRef.class.cast(resource).getUnicodeString());
} else if (resource instanceof PlainLiteral) {
element.put("type", "literal");
element.put("value", PlainLiteral.class.cast(resource).getLexicalForm());
Language lang = PlainLiteral.class.cast(resource).getLanguage();
if (lang != null) {
element.put("xml:lang", lang.toString());
}
} else if (resource instanceof TypedLiteral) {
element.put("type", "typed-literal");
element.put("datatype", TypedLiteral.class.cast(resource).getDataType().getUnicodeString());
element.put("value", TypedLiteral.class.cast(resource).getLexicalForm());