*/
@Override
public XBELStatement convert(Statement source) {
if (source == null) return null;
XBELStatement xstmt = new XBELStatement();
Term subject = source.getSubject();
TermConverter tConverter = new TermConverter();
XBELSubject xs = new XBELSubject();
// Defer to TermConverter
xs.setTerm(tConverter.convert(subject));
xstmt.setSubject(xs);
AnnotationGroup ag = source.getAnnotationGroup();
AnnotationGroupConverter agConverter = new AnnotationGroupConverter();
// Defer to AnnotationGroupConverter
xstmt.setAnnotationGroup(agConverter.convert(ag));
String comment = source.getComment();
xstmt.setComment(comment);
// Set statement relationship, if present on source
org.openbel.framework.common.enums.RelationshipType r =
source.getRelationshipType();
if (r != null)
xstmt.setRelationship(Relationship.fromValue(r.getDisplayValue()));
Object object = source.getObject();
if (object != null) {
if (object.getStatement() != null) {
XBELObject xo = new XBELObject();
StatementConverter sConverter = new StatementConverter();
// Defer to StatementConverter
xo.setStatement(sConverter.convert(object.getStatement()));
xstmt.setObject(xo);
} else if (object.getTerm() != null) {
XBELObject xo = new XBELObject();
// Defer to TermConverter
xo.setTerm(tConverter.convert(object.getTerm()));
xstmt.setObject(xo);
}
}
return xstmt;
}