if (source == null) return null;
XBELTerm subject = source.getSubject().getTerm();
TermConverter tConverter = new TermConverter();
// Defer to TermConverter for statement construction
Statement dest = new Statement(tConverter.convert(subject));
XBELAnnotationGroup annotationGroup = source.getAnnotationGroup();
AnnotationGroupConverter agConverter = new AnnotationGroupConverter();
// Defer to AnnotationGroupConverter
dest.setAnnotationGroup(agConverter.convert(annotationGroup));
String comment = source.getComment();
dest.setComment(comment);
// Set statement relationship, if present on source
Relationship r = source.getRelationship();
if (r != null)
dest.setRelationshipType(fromString(r.value()));
XBELObject object = source.getObject();
if (object != null) {
if (object.isSetStatement()) {
XBELStatement statement = object.getStatement();
StatementConverter sConverter = new StatementConverter();
// Defer to StatementConverter
dest.setObject(new Object(sConverter.convert(statement)));
} else if (object.isSetTerm()) {
XBELTerm term = object.getTerm();
// Defer to TermConverter
dest.setObject(new Object(tConverter.convert(term)));
}
}
return dest;
}