if (logger.isDebugEnabled()) {
logger.debug("serializer() adding predicate " + currentTriple.getPredicate().toString() + " with object " + currentTriple.getObject().toString());
}
String property = currentTriple.getPredicate().getUnicodeString();
JsonLdProperty jldProperty = resource.getProperty(property);
if (jldProperty == null) {
jldProperty = new JsonLdProperty(property);
}
String strValue = currentTriple.getObject().toString();
JsonLdPropertyValue jldValue = new JsonLdPropertyValue();
if (currentTriple.getObject() instanceof PlainLiteral) {
PlainLiteral plain = (PlainLiteral) currentTriple.getObject();
if (plain.getLanguage() != null) {
jldValue.setLanguage(plain.getLanguage().toString());
}
strValue = plain.getLexicalForm();
}
else if (currentTriple.getObject() instanceof TypedLiteral) {
TypedLiteral typedObject = (TypedLiteral) currentTriple.getObject();
String type = typedObject.getDataType().getUnicodeString();
jldValue.setType(type);
strValue = typedObject.getLexicalForm();
}
else if (currentTriple.getObject() instanceof UriRef) {
UriRef uriRef = (UriRef) currentTriple.getObject();
jldValue.setType(JsonLdCommon.IRI);
strValue = uriRef.getUnicodeString();
}
jldValue.setValue(convertValueType(strValue));
jldProperty.addValue(jldValue);
resource.putProperty(jldProperty);
}
}
jsonLd.put(resource.getSubject(), resource);